Monday, March 17, 2014

Game Maker Scripting for Mystery Game

Well, I spent most of the night scripting for the game and decided to share with people some of the Game Maker Language (GML) work that I am doing.

Right now by project is concerned with basic AI routines such as seek, flee, and flocking techniques. These techniques are easily to prototype using the Game Maker Language.

Seek routines are AI methods that have the Artificial Intelligence look for the player. This can either be to rotate towards (like a turret) or move towards (pretty much everything else). In a simple Finite State Machine - as I have implemented - the AI is typically given a sight range as a condition of 'seeing' the player. When the player or target falls withing this range the AI will start to move towards the target.

Flee routines are essentially the opposite of a seek function for Artificial Intelligence. The AI moves in a direction that is not towards the target. In my game, this is implemented by storing the original spawn {x, y} coordinates. When the player is outside of the seek range, and the AI is outside a certain "wander threshold" the AI will simply return to that spawn point.

Flocking is something that I never really dealt with before in working with Artificial Intelligence. This is mostly because I prefer other game programming areas such as rendering. But, it also has to do with the fact that other game engines used collision boxes and did not allow objects to overlap each other (like players in an MMORPG). This I dealt with by having the AI detect other objects near it. If there was, it would implement a separating velocity between itself and the other AI. This came in handy when many enemies were chasing the player. It prevented them from stacking.

In regards to AI, that is all I really had to do myself for my Mystery Game. Game Maker has some neat path-finding tools built in such as mp_potential_step_object() method. This allowed for easy terrain avoidance in a top down 2-D map.

No comments:

Post a Comment