• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Game Mechanics Ally and Enemy fighting each other. In a programmer's perspective.

F

FallFlat

Guest
If you have experienced implemented this system before. Please enlighten me.
If there is only one Player's object, making enemies with AI to just follow and attack the player once it's notices him, should be enough. However, if there are ally objects who will not follow and attack the player, but instead they will do this to enemy objects. Enemies will now have to detect then follow and attack allies too.
These are really confusing to me. I am not a programmer, but i have collaborated with one. I would like to make a coding request with more specific detail. Instead of, please make me a system where "Ally and Enemy objects fighting each other".
Thank you very much.
 
Prioritize things with actual AI.

Is the player closer? Go for the player.
Do I attack the closest foe? Do that.
Is the player's friends more important? Go for the the player's friends.
Is someone near death? Go for that person.
Does this particular enemy ALWAYS try to kill the player and ignore the player's friends? Go for the player.

Also, don't forget to use parent objects. Like you can have 30 enemy objects, but make sure their parent object is obj_ENEMY. That way you only need to program the obj_ENEMY and change the details of each enemy object so they feel different. Do the same for obj_ALLY. If there are 10 types of allies, give them all the obj_ALLY as a parent.
 

GMWolf

aka fel666
Make the player object and ally too.
That way the AI it cares about attacking allies.
In this case, inheritance is your friend.
 
Top