Skip to main content
gamedev.net
🔒 Locked

Example Entity Editors?

Started by RabblePants Dec 14, 2005 at 8:38 PM 1 replies 850+ views
Original Post
RabblePants
RabblePants
Hi all, I hope this is the right forum for this thread :) Anyhow, I'm busy making an editor for my engine, and I'm trying to make it as data-driven as I possibly can. One of the issues I'm thinking about is how to create an intuitive 'entity editor' which would both handle scripts and 'game state' changes. I've looked at GameMaker's object editor (but only for a few minutes to be honest), and I like how it ties events to objects, and based on those events it can execute some number of actions. This is pretty nice, and I'm drawing a lot of inspiration from that setup. However, I also want to manage the object 'states,' so that I can take specific actions depending on my current state. Adding a command in an event that says 'Set State' is easy enough, however it becomes rather difficult to track states, and get a clean and visual idea of the object's state 'progression', if you will. So, can anyone point me to example entity/object editors that also manage states cleanly from the perspective from the user? Many thanks for any help :) Graf
HellRiZZer
HellRiZZer
There is a great tutorial in one of GPG books that explains how to have a property map for the entities.
If you cant reach it, here's an advice. You should create a base class CEntity that has the ability to add private/protected members of the derived classses to the map and also have get/set methods their modifications. There are some great classes that you can use (boost::property_map or boost::multi_map, or plain simple std::map) for those purposes (also with boost::variant), or you can simply have a list of all possible basic types with pointers to the original data. There is a great tutorial on CodeProject about a property editing (I believe its in Property Map section) that allows you to do just that and track when the value has been changed.

Good luck.
RabblePants
RabblePants
Quote:
Original post by HellRiZZer
There is a great tutorial in one of GPG books that explains how to have a property map for the entities.
If you cant reach it, here's an advice. You should create a base class CEntity that has the ability to add private/protected members of the derived classses to the map and also have get/set methods their modifications. There are some great classes that you can use (boost::property_map or boost::multi_map, or plain simple std::map) for those purposes (also with boost::variant), or you can simply have a list of all possible basic types with pointers to the original data. There is a great tutorial on CodeProject about a property editing (I believe its in Property Map section) that allows you to do just that and track when the value has been changed.

Good luck.


Thanks for the response :) However, I'm not too concerned with the actual implementation (for general entity properties I'm already using a custom property grid to input files and lists and so on).

Also, the problem isn't editing properties of an entity .. it's editing and setting up game state transitions.

For example..

Entity is idle by default. If entity gets a 'run' event, entity switches into 'run' game state (with accompanying script or compiled code to make it move forward). While running, entity might decide to jump, which takes it into a jump state. Then I place in the restriction that says an enemy can only attack from idle and run state, but not from jumping.

Keeping track of these states are important and can get very cumbersome when done in code. For simple entities it's easy to express the restrictions in code, but for more complex entities debugging all the state changes is a horrible p.i.t.a.

I'm thinking I could take GameMaker's 'interface' of tying events to objects (entities), and add a new 'command' that says "Set State : Jump", and have a whole new event list for that particular state.

That way I can differentiate between getting the 'attack' command from an idle state vs a jumping state. Although this abstracts it away from code .. for sufficiently complex entities even this might get confusing.

Graf

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.