GameRules question

#1
Hi. I‘m having some questions about Game Rules. The problem is that I don‘t really understand them. I‘ve already looked at some examples and also into some of the GameSDK stuff. However there are still multiple questions that I have.

Just to look at a simple example: Inside GameSDK and the 5.3.4 Templates, there is the CGameRules class. This one gets registered inside the factory with the name „GameRules“.
After this we can register the game modes based on these „GameRules“ (which is like I mentioned the name of the CGameRules GameObject). We do this with the function:
RegisterGameRules(modeName, „GameRules“);
So we now have a game mode based on the „GameRules“ GameObject.

But what I don‘t understand: All game modes are registered with the „GameRules“ GameObject ... so it seems as if they all use the same implementation and it seems as if they all do exactly the same (because they use the same GameObject). However of course if we try to set different game rules inside of GameSDK, they are doing different stuff. I don‘t get how this works. They all do different stuff despite the fact that they all use the same GameObject implementation.

Next thing would be the GameRulesModules inside GameSDK. I‘ve looked into them and specially into the GameRulesModulesManager. Here the game modes are loaded from an .xml and then they are registered as game rules.

However what I don‘t get:
What are these modules used for? And how does the GameRules system work? Let‘s say that I change the current game mode in the console. What happens internally? So basically: how do I use it?
And no matter what game mode is currently active: inside GameSDK if we want to get the current game rules, we always cast them to CGameRules. This makes sense since they are all based on the „GameRules“ GameObject, but I don‘t get why they behave differently if this implementation is always the same class.

I hope that someone can give me an explanation. The documentation seem to be pretty thin about this.

Thanks for your time and have a great day
- Jannis

Re: GameRules question

#3
Thanks for the reply. Yes you‘re right. Of course we could just use our own implementation to handle the game. Specially if there is only a singleplayer mode or similar.

However I guess that it is very useful to know about the GameRules system. This comes in handy if you really need different game modes. So there is no use (in my opinion) to bypass it with custom code. I just hope that someone can explain to me how all of this stuff works together.

- Jannis

Who is online

Users browsing this forum: No registered users and 5 guests