Dragonfly Q&A

On page 93, where do I start populating the world?

0 like 0 dislike
The book didn't say where. Instead, it just mentions to populate the world, after starting up the GameManager, and before running the GameManager (via run()). GameManager doesn't have "populateworld()" in the book, so I don't think we have to write a declaration and definition for it.

Is it okay if I place it near the start of the run() function, but just before going into the game loop? By logic, it sounds reasonable, but just in case the book wants us to put the "populating" codes in specific spots in the source codes, I would like to confirm if this is okay?

Gotta double make sure.
asked Sep 13, 2014 in Engine Development by tom_mai78101

1 Answer

0 like 0 dislike
Best answer

Populating the world is not a function of the game engine, but rather is something the game code does.  Remember the tutorial's populateWorld() function?  This was part of our "10,000" foot view of game code (bottom of page 13).

So, the game code does:

 GameManager startup()

 populateWorld() // the game developer writes this
 GameManager run()

For project2a, you, acting as the "game developer", will make some simple game objects (derived from Object) to populate the world with.

answered Sep 14, 2014 by claypool
selected Sep 18, 2014 by tom_mai78101
More information about Dragonfly can be found on the Dragonfly Home Page.