Archived

This topic is now archived and is closed to further replies.

Erkki

2D game engine structure

Recommended Posts

Erkki    122
I''m designing and programming a simple 2D top-down view RPG/hybrid game (not tile-based). I haven''t found any good resources on what kind of class structures to use so I came up with this (see the image below). If anyone could give me their opinion and / or point me to some good tutorials or source code, I would really appreciate it. The diagram isn''t final, just a sketch really. WorldObject -- all world objects are subclasses of this. Zone -- physical and logical zones (water body, village). Terrain -- grass, snow, water etc. can be defined by zones. Scenery -- objects that don''t do anything by themselves. rocks, trees etc. Actors -- objects that can move, have AI, communicate with other objects. NPCs, vehicles, player etc. All the above classes will of course have many-many subclasses. Camera -- the camera is a world object because it is positioned inside the world. It will tell the Renderer what to render. Also it may tell any LOD systems what is far from view and what is near. Simulation -- not really a class, but the diagram is supposed to show that the simulation aspects of the game (movement, collisions, AI) is kept separate from the objects.

Share this post


Link to post
Share on other sites
Ravyne    14300
Looks fairly good to me. I can tell you''ve thought about it, which is the main thing, because you could set this up a dozen different ways that are equally right. As long as you''ve thought about YOUR method, you''re probably good. On thing I don''t see however, is any sort of scripting. You''ll almost certainly need it so where will it fit in? Simulation perhaps? Depending on how much you want your scripts to be able to interact with other parts of the game it may need to be a more fundamental feature located lower in your hierarchy.

Ravyne, NYN Interactive Entertainment
[My Site][My School][My Group]

Share this post


Link to post
Share on other sites
Erkki    122
You''re right. I think I have to rethink this part a bit.

I think there are 3 big subsystems that I just put under "Simulation" in the above diagram:
Game logic, Scripting, Simulation

Share this post


Link to post
Share on other sites