This course will become read-only in the near future. Tell us at community.p2pu.org if that is a problem.

Main Project Step 2 - Plan your Game Engine


For this week: Take the game idea you described in the previous step and begin breaking it down into objects and methods.

 

Figure out what the main objects in your game engine are going to be, and what sort of public methods each one going to have.  Write a "skeleton" Javascript file with some constructors and prototypes -- they don't have to <i>do</i> anything yet, so you don't need to write the code <i>inside</i> them; this is more of a planning / architecture exercise.

Of course the constructors and methods you're writing now will not be carved in stone.  I guarantee they will evolve as you start writing your actual game code.  The point of the exercise is just to get you to start thinking ahead.

For instance: Say I was writing a turn-based strategy game where a player has some number of Units; each unit has a set of Orders that it's capable of.  The player clicks on each Unit (in any order) and chooses an "Order" for each one from a menu.  Once the player is happy with the orders for all their units, then they click a "Done" button.  Then all of their Units will execute their Orders, the player's turn ends, and it becomes the opponent's turn.

The skeleton of some of my key constructors and prototypes might look something like this (very, very rough draft)

Task Discussion