Jump to content
  • Advertisement
Sign in to follow this  
JoshuaBaker

Unity Gamestates and their uselessness

This topic is 2346 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

In the past iv setup my simple games with using game states. A game state, at its most basic is setup like this...

class GameState {
void Init();
void Update();
void Draw();
}

Initialize the objects you need during the game state, update logic, draw graphics. This works and is very simple to understand.
As i move forward and expand my games, making them more complex and interesting i build myself an entity system, such as the Component model from Dungeon Siege or Unity Engine. As i add more components, through code or script, the update function of the game state becomes less and less useful to the point of it literally only telling the component manager to update.

Also i add a scene manager to my game, this manager is tied into the components, render components within the component manager handle the nodes within the scene. This continues much as before and eventually my Draw function also serve no true purpose.

Seeing as Init is now simply a laundry list of commands to piece together components and nodes it can be moved into an XML format and removed from hardcoding. Does gamestate even truly serve a purpose now? Is this the correct path i should be taking? Thoughts?

Share this post


Link to post
Share on other sites
Advertisement
In your case probably not. You need to find a solution that best fits your problem. Not try to fit your problem to a specific solution. If you continue to try you will be unhappy with your code and working on your project will be like going in to do battle with the framework of your game just so you can get it to behave in the way you want it to.

That sounds like something you do at work because you have to. Not something that you do as a hobby( Unless you are masochistic).

There have been a lot of good articles on the game entity architecture. I am not sure of you subscribe to game developer magazine. But they have an excellent article In last month's issue describing the past, current and future of the game entity architecture.

I believe it was the November 2011 issue. http://www.gdmag.com/
Otherwise there have been some excellent posts through-out these forums.

Although it sounds to me like you are pretty well versed in this architecture.

Share this post


Link to post
Share on other sites

( Unless you are masochistic).
...
I believe it was the November 2011 issue. http://www.gdmag.com/


You have no idea :) lol, ill have to check that article i havent kept up to date with reading the mag, i tried the digital version, and now i never read the darn thing. Thanks for the pointer.

Im just trying to do this stuff in my free time, learning as i go. I understand the reasoning why books and tutorials start off using somethign like a game state, but in the long run its actually hurt me because i have a hard time finding information on the more advanced systems being used these days. Iv tried to piece together what can from all over. Iv found some decent books that overview alot of differnt areas, but not much that gets into actual code. Something of an intermediate step between newbie and Unreal engine architect lol

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!