Saturday, December 9, 2017

Terrain Tags and AI map programming

Hi everyone,
The harem game engine has seen a tremendous amount of progress, and I will probably do a proper reveal of the game along with the overview storyline on my next post once I have the storyline in order.  But for now, I was going to talk more about game design relating to the overmaps.  This is a bit technical like the last post though.

(image reference is from Fire Emblem on the GBA)

In tactical games such as fire emblem, there are different types of terrains that effect the character differently.  An example of this would be terrain such as rivers, mountains or forest. They can effect the character's movement, give additional stats, be impassable by certain characters and so on.  But how is a system like this made?  One way is to differentiate different terrains by giving them tags.  Then effect the character based on what terrain tags are near.

This may sound a little confusing, but in case of the engine I'm using, first I start with something called a tileset(an image that is met to be broken into pieces and placed on the gamemap to form the land, each piece a fixed size(32x32 pixels) and is called a tile).  I place these tiles on the gamemap to form the land(the game's floor/background) you see while playing the game.  Tiles are very common in 2D games, including game engines such as Rpg Maker. 

With a system i made in place, the tiles themselves can be used to automatically mark different terrains.  For example, if you have different tiles depicting water such as a river or lake, you can give them all the water terrain tag.  When the system is in place, the tags look something like this:

 (different terrains are represented here by different numbers)

In this example, each type of tile has a numbered terrain tag.  The areas with no tiles have a terrain tag numbered "0".  Using a system like this, it is possible to have as many different types of terrain interactions as you want.  For example, if terrain tag 4 was for water, you could have the character movement be reduced when trying to pass through terrain tag 4.(another thing in the image above is automatic tiling, a script I made to automatically join tiles based on their origination to each other, similar to rpg maker).
------

Another thing tactical games have is an AI, or Artificial Intelligence for the computer player.  This can be made many different ways, but one way is to design it to think in a series of steps.  Here is a series of steps that can be used:

1st, at the beginning of the AI team's turn.  The first character in the team would look at it's stats and it's teammate's stats, as well as the enemy teams.

2nd, it would choose an action based on this information and what the character is capable of doing. There are many factors that can be considered here to help the AI choose an action such as level, health, attack, defense..etc. For example, in fire emblem, a healer AI character may notice that a character in it's team has low health.  So the character's desired action would be heal that character.

3rd, the character would move so that it can do this action.  In case of the healing character, he would move next to the character if the healer can walk that far.  If the healer cannot reach the injured character in that turn, the healer may see if they can heal someone else or just simply move closer to the injured character.  If the moving character was a sword-welder instead of a healer, they may move for the purpose of getting closer to an enemy that they can attack.

4th, the character will do the desired action.  In case of the healer, they would heal the injuried character that they are now standing next to.

5th, the character's turn would be over, so they would be marked as inactive and then this whole process would repeat with the remaining team members until there is no one left to move.

Note:pathfinding is used throughout these steps for the AI.
----
This is one of the ways to program the movement for the AI on an overmap.

Tactical games are among the most complex games to make but hopefully none of what I said was too confusing.  Anyways, I will probably do a reveal of the game on the next post.
Also, you can still vote on the poll here.

Um, that's all for now,
see you later.


No comments:

Post a Comment