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:
$roles=array(
    
'godfather'=>array('starting_faction'=>'mafia','nightkillable'=>0,'investigatable'=>0,'roleblockable'=>1,'nightaction'=>null),//etc
    
'bulletproof_townie'=>array('starting_faction'=>'townie','nightkillable'=>0,'investigatable'=>1,'roleblockable'=>0,'nightaction'=>null)
);

$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 (
    id int(11) NOT NULL AUTO_INCREMENT,
    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,
    dateline datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id) )'
);

$db->query('CREATE TABLE IF NOT EXISTS mg_actions (
    id int(11) NOT NULL AUTO_INCREMENT,
    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.)
    dateline datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    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
10-06-2012, 05:08 AM
RE: Building my own forum mafia game
The page is too wide for me to click like Huh

But anyway.

LIKE!!!

For no matter how much I use these symbols, to describe symptoms of my existence.
You are your own emphasis.
So I say nothing.

-Bemore.
Find all posts by this user
Like Post Quote this message in a reply
10-06-2012, 08:11 AM
RE: Building my own forum mafia game
Wow, awesome idea! What about PMing, would we will have to use the forum system or would there something built into the game that we could use?
Find all posts by this user
Like Post Quote this message in a reply
10-06-2012, 09:22 AM
RE: Building my own forum mafia game
I see where you missed a spot around 2/3 down the page, but otherwise it's not a bad effort on your part. Big Grin

"All that is necessary for the triumph of Calvinism is that good Atheists do nothing." ~Eric Oh My
Find all posts by this user
Like Post Quote this message in a reply
10-06-2012, 09:32 AM
RE: Building my own forum mafia game
Me too, page is too long to like. I'm a fan!
Find all posts by this user
Like Post Quote this message in a reply
10-06-2012, 10:06 AM (This post was last modified: 10-06-2012 09:40 PM by DeepThought.)
RE: Building my own forum mafia game
(10-06-2012 08:11 AM)Magoo Wrote:  Wow, awesome idea! What about PMing, would we will have to use the forum system or would there something built into the game that we could use?
PMs would be built into the game.

PHP Code:
$db->query('CREATE TABLE IF NOT EXISTS mg_comments (
    id int(11) NOT NULL AUTO_INCREMENT,
    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,
    dateline datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
    PRIMARY KEY (id) )'
); 
The table has 'to_player_id' and 'to_faction_id'
They can be used one or the other - not both.

That way I can use the mg_comments table for all pm/comment activity.

At the end of the game all will be revealed - probably be fun to read all the scheming going on behind the scenes.

Since no-one knows your username till the end of the game it should all work better. I don't expect people to use the in-game pm system to chat each other up but you never know with these things! lol

Since you get to pick sex and player name seduction is possible. Now I'll close my eyes and you guys can pretend to be Gwyneth Paltrow.

Either way everything that happens in the game is revealed in the end. All actions and scripted randomness... EVERYTHING!

Big Grin

“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
[+] 2 users Like DeepThought's post
10-06-2012, 10:12 PM
RE: Building my own forum mafia game
You could make a substantial sum with this if you put it on facebook.

Under Repair.
Find all posts by this user
Like Post Quote this message in a reply
[+] 1 user Likes itsacow's post
10-06-2012, 11:10 PM
RE: Building my own forum mafia game
Unfortunately several facebook versions already exist. The market is already saturated with games like this.

If a single competent developer can create a game like this in a week to a month, chances are it's already been done.

(10-06-2012 10:12 PM)itsacow Wrote:  You could make a substantial sum with this if you put it on facebook.

“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
11-06-2012, 03:45 AM
RE: Building my own forum mafia game
Who cares about what's out there, do this for your fun and your new knowledge, not for the money. Screw FB anyway.

[Image: a6505fe8.jpg]
I have a theory that the truth is never told during the nine-to-five hours.
-Hunter S. Thompson
Find all posts by this user
Like Post Quote this message in a reply
[+] 1 user Likes Filox's post
Post Reply
Forum Jump: