Building my own forum mafia game
Post Reply
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
10-06-2012, 05:04 AM (This post was last modified: 10-06-2012 05:44 AM by DeepThought.)
Building my own forum mafia game
I'm planning to build one thats driven entirely by code so it doesn't need a gamemaster to tally votes and so forth.

One of the features will be separating you forum username from the Character you play in the game. You will be able to register and select a sex and select from a list of names. eg: Al Capone, Angelina Jolie, etc...

I'll start putting up the skeleton plans here with sql table stucture and hardcoded role configuration:

PHP Code:

$abilities=array(); //gotta start somewhere!

$db->query('CREATE TABLE IF NOT EXISTS mg_players (
    player_id int(11) NOT NULL,
    game_id int(11) NOT NULL,
    forum_uid int(11) NOT NULL, -- forum user id
    player_name varchar(64) NOT NULL, --In game name of player (No-one will know your forum identity till after the game)
    faction_id int(11) NOT NULL, -- group this user belongs to (eg: cult, mafia, other, townie, mafia2, etc)
    gamestate text NOT NULL, --json encoded data containing the players point of view in the game
    player_status tinyint(4) NOT NULL DEFAULT 0,
    PRIMARY KEY (player_id, game_id))'

$db->query('CREATE TABLE IF NOT EXISTS mg_game (
    game_id int(11) NOT NULL AUTO_INCREMENT,
    initial_state text NOT NULL,
    current_state text NOT NULL,
    timeslot_ends datetime NOT NULL, -- time the game is forced to move to the next day or night ( players forfeit their actions if they do not submit decisions within the allocated time)
    status tinyint(4) NOT NULL DEFAULT 0, -- status of the game (in progress,finished,etc.)
    gametime int(11) NOT NULL DEFAULT 0, -- integer represents current game time 0=first night, 1=first day, etc..
    PRIMARY KEY (game_id) )'

$db->query('CREATE TABLE IF NOT EXISTS mg_comments (
    player_id int(11) NOT NULL,
    game_id int(11) NOT NULL,
    to_faction_id int(11) NOT NULL,
    to_player_id int(11) NOT NULL,
    comment text NOT NULL,
    PRIMARY KEY (id) )'

$db->query('CREATE TABLE IF NOT EXISTS mg_actions (
    player_id int(11) NOT NULL,
    game_id int(11) NOT NULL,
    faction_id int(11) NULL,
    action_target int(11) NOT NULL, -- player_id this action is targeting.
    action_text text NULL, -- text used for the action response
    action_data text NULL, -- json encoded additional data (could be used for extra info - which item the inventor used, which ability jack-of-all-trades used, etc.)
    game_time int(11) NOT NULL, -- in which day/night cycle this action is completed.
    public_action tinyint(4) NOT NULL DEFAULT 0, -- are the results of this action visible to all players? (eg: successful kills)
    PRIMARY KEY (id) )'

Keep in mind this is a rough concept.. Haven't really thought this through and plans will change as I progress.

This game has a huge number of states.. All the logic needs to be mapped out, especially for the complex roles. The game documentation doesn't cover all I need so decisions need to be made on how to handle things is a suitable generic manner.

eg: Cops may simply return a guilty or innocent result against the investigation target depending on the player being mafia, townie, or serial killer. I may add generic items later that could be found by cops which will be added into the role configuration array.

“Forget Jesus, the stars died so you could be born.” - Lawrence M. Krauss
Find all posts by this user
Like Post Quote this message in a reply
[+] 3 users Like DeepThought's post
Post Reply

Messages In This Thread
Building my own forum mafia game - DeepThought - 10-06-2012 05:04 AM
Forum Jump: