Game Logic
Cap
Member Posts: 225
Hey,
are there any good resources about logic in games?
I coded a checkers game years ago and had to search information about the min-max algorithm to make the AI work. I think in almost every game genre a good game logic can help you out. So does anyone know a good online resource or something like that?
Thanks.
are there any good resources about logic in games?
I coded a checkers game years ago and had to search information about the min-max algorithm to make the AI work. I think in almost every game genre a good game logic can help you out. So does anyone know a good online resource or something like that?
Thanks.
Comments
Think of it like rolling a die - an enemy will perform an action depending on what number is rolled.
For example, one of my boss characters moves around the screen to particular points. The order is randomised. If I 'rolled' a one, he'll move to the centre. A two, to the top right of the screen etc etc.
I like it because even though the boss will always be there at the end of the level, he'll move differently each time. It becomes a skill test, as opposed to a memory test.
You can do the same with firing. On a one, fire down. On a two fire two shots diagonally down etc etc
Then there's the other school of thought that says enemies should follow patterns. So a boss may shoot at you first, move, shoot at you again, move, shoot a different projectile, move, shoot the original projectile. Again, you can do the same with movement, and you can even randomise it so that the order of the pattern is different.
Which makes it a non-pattern I guess.
THEN there's stuff like modulation, with which you can make an enemy react to you dependent on distance. If player is near enemy, enemy shoots at player for example.
And then there's states. How does the enemy react when near you? What if you're not shooting? What if you're far away?
Essentially, everything can be distilled down to certain triggers that make the enemy react to the player.
I like to mix it up a bit, but there's many techniques out there you can use. The idea is to make the enemy logic 'believable'. It doesn't actually have to be particularly 'smart' - you can fake it
My opinion, tis all. I'm sure others have their own ideas and methods!
Hope it helps,
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io