Page 1 of 1

small web-based online game

Posted: Wed May 21, 2008 1:43 pm
by Monopoly
I am planing to write a small web-based online game and I plan to write it in php (using mysql).


I am on the stage of writing the basic plan of the script , but even know I get confused .


Before asking help , I'd like to describe what the game "will" be about (and it will be only if you help me) .


Users register then log in .
Players fight each other using atack/block combinations (they click radio-type posts and then submit them), Example : if a fighter
selects atack "head" but his enemy sets block as "chest" then his enemy loses hp. Get it ?
Players may select their enemies from the the "fight list" and wait for an approval to fight , or vice versa , join the "fight list".
This game is some sort of a fight-club.
Some huge online games use this core (example combats.ru).

I hope you would understand...



While writing the plan of the core of the fight I get confused and I can't find a easy solution.


It would be very very VERY very very kind of you , if you help me or give a link where such help is to be found.


Please help me :oops:

Re: small web-based online game

Posted: Thu May 22, 2008 3:08 am
by Maugrim_The_Reaper
The best advice is to write out exactly how combat works. Break into steps - if necessary use boxes, and link them with arrows to show how options can split into varying steps.

When that's done implement one step at a time. Use small functions/methods where possible - don't create a massive 3000 line script in a single function. Try to bundle duplicated code into their own helper functions.

Re: small web-based online game

Posted: Fri May 23, 2008 2:25 pm
by Monopoly
Do you think the game should be object-orientated? It's really small...

Re: small web-based online game

Posted: Mon May 26, 2008 3:23 am
by Maugrim_The_Reaper
Lean towards objects for most things. The thing about objects is that they lend themselves to breaking complex tasks into a tree of smaller pieces you can pull from. If you just need to go hell and hash out something quickly - then feel free to do so. Just label it as a "prototype" and once done look for code duplication, too many if...else branching, etc. These will give you clues as to what objects and flex points are needed for an OOP implementation.