Entities

Anything that can change in Intelligence will be an entity. The static parts of a map are the quadtree, the changing parts are entities. The quadtree can influence entities (collisions, treadmill floors, etc.), but for the most part it’ll be passive. I have quadtree loading and drawing working fully already, so next I clearly need to work on entities. But they’ll be basically all of the game, so I’m not really sure where to begin on them. They’re…complicated.  They will have one or more functions governing their behavior (I might conceivably want more than one; for instance, one for player controls and one for physics), a position, a texture (which may be animated, and a behavior function will take care of animation), a size, and maybe some more properties I haven’t thought of yet. They’ll need to be able to give messages to the player through text, and run around on predetermined paths. I’ll need the possibility of multiple player characters which can be switched through while playing a level, and perhaps I’ll need to be able to have the level control one of those player characters while he’s not being controlled. It’s some complicated stuff, but I think I can manage it.

Basically, once it’s done, the main loop of the game will be incredibly simple. Just update every entity, draw the quadtree, draw every entity. Do this synced to the screen’s refresh rate, and you’ve got yourself a fully playable game. Obviously, the most important part is the entities, so I need to get started on them. I guess first I need to figure out what all they need in their main structure (which I basically figured out above), and then make that structure and some functions to work with instances of it. Then put one of those in the map structure, start making some simple behavior functions, and see how it goes from there. The ones for AI and such will definitely be the most interesting, and they’ll have to have some variables which can be controlled in the map files on disk. This probably doesn’t make sense to anyone but myself, but getting my thoughts written down definitely helps me organize them.

This has been quite helpful. I’ll try writing about tricky problems to help solve them more in the future.

Advertisements