How do you guys work with your game logic? I have a situation which probably others have come upon and I’d like to know if there’s any solution available to make it easier…
I have a certain “level” which I would like to keep some basic functionality scripts running (character movement, certain interactions) but have the ability to set this same level with different objectives. My first idea was something like an external XML informing the “rules” and “goals”, while not having to change anything within the Unity scene in fact (other than targeting a different XML file).
Does anyone know of anything of similar functionality for Unity? Thanks!
I think you might be asking two separate questions.
The first part “I would like to keep basic functionality scripts running” would be a game controller of some description, you can name it generically or specifically to the game type. In a stupid little zombie prototype I posted on these forums yesterday I made the island game object, which exists throughout the game, as the game controller. In a word game, I have made the game board the game controller, in an RPG I made a “hand of god” object that was the game controller.
The second question I see is “how do I vary the goals and objectives based on the level.” Well, if the objectives and goals are not too dissimilar, i.e. its the same rules but slightly harder each level, e.g. spawn more zombies and make them faster, you can handle that in your game controller through whatever mechanism you choose, e.g. algorithmic function, data files stored as XML for instance, hard-coded values. If your objectives are very different, for example level 1 requires you to collect precisely nineteen and two eights (but not a quarter) sneezes from the flying fairies, but on level 2 you need to sprinkle two dozen rainbows around, then you will need to come up with a game play mechanism that permits you to do that and that is a question that is very deep and difficult to answer without knowing more about your particular approach.
I see… Basically I have different valves… And in one certain setup say valves A, B and C need to be opened in that order. In another setup valves E, F, and A, for example, need to be opened in that order. That’s the very basic approach…
Basically what I wanted to know is if there’s any existing “framework” to control game logic from outside of Unity. Where I would only program behaviors (the mechanism to open a valve, mechanism to move the character and collision, etc) in Unity, while keeping game logic (which valves need to be opened and in which order, for example) external.