What is Modding?
Modding is when you use the special mod API included in this game to modify or change some aspect of the game. This can be used to add new content, such as weapons, vehicles, or even islands, or simply modify existing enemies or battles to make them more challenging.
How Can I Mod?
To start off, you will need a few things:
-The file location of the Aground game (probably somewhere on your C: drive)
-A text-editing software such as Notepad++ or Atom
Where to find the game files:
If you saved it under steam games, which is the default option, then the files should be under C:\Program Files (x86)\Steam\steamapps\common\Aground or something similar.
Once you have found the game files, open the “data” folder. Then open the “core” folder. You will now be presented with the xml files that make up the game. What’s xml you say? It stands for eXtensible Markup Language. The actual game code is written in HAXE, which uses input from the xml files to create the things you see in the game. Anyone who knows where to look can edit these xml files, adding new content!
As an example, lets open up the “start” folder (data\core) and open (in your text editor) start.xml. You will now see a large file that defines the start island.
To create a mod, go to data\mods\ and create a folder with the name of your mod. Then create a new xml file inside that folder with the name mod.xml and post the following code:
<?xml version=”1.0″ encoding=”utf-8″ ?>
<description>Description of the Mod</description>
<author>Your name and whoever may have collaborated</author>
xml code goes here
After this, you are now ready to start adding your own content!
The simplest place to start is adding a new item. If you open up data\core\items\items.xml, you will see a large list of item defenitions. For example: <item id=”steel_bar” type=”resource” cost=”75″ weight=”5″ icon=”steel_bar.ico” />
Lets break down what the above line of code is saying/
<item /> the tag that the game reads to know to make an item
id=”steel_bar” the id of your item, which is used to obtain or make the item.
type=”resource” where the item shows up in inventory, along with a couple other things. Types include: resource, food, object, equipment, tool, spellbook, blueprint, etc.
cost=”75″ this item will cost 75 coins to buy in the store
weight=”5″ how much the item weighs in your inventory
icon=”steel_bar” what tile to display when you see the item in your inventory or elsewhere.
Other parameters that are common:
animation=”anim_id” plays an animation in your inventory (such as fire boar)
slot=”slot_name” if this item is equippable, where it can be equipped
durability=”value” how many uses the item has
The best way to find examples is to look in the game code, plenty of examples exist for many things. Most item parameters are fairly simple.
How Can I Add Tiles?
Now that you know how to make items, lets move on to tiles, or images. Every enemy, item object, structure, npc, etc. has a tile. This tile is what the game is told to display when that thing is displayed. Tiles consist of three parts: A tilesheet defenition (the image the tile comes from); a tile defenition (where on that tilesheet the tile can be found); and a tile call (in the thing that uses the tile, you will see tile=”tile_id” or icon=”tile_id”)
To create this tile, you first need a tilesheet. For our example let’s use, again, the steel bar. As you see above the steel bar item defenition, there is a tile defenition. the tile for steel bar is: <tile id=”steel_bar.ico” sheet=”items.png” x=”38″ />. This means that the tile “steel)bar.ico” is found on the sheet items.png at x=”38″, or the 38th tile.
Most icon tilesheets are actualy a special case, since the default tile size is 10 high by 16 wide, the size of an icon, there is no need to define items.png as a tilesheet. If you did however, it would look like this: <tilesheet id=”items.png” width=”16″ height=”10″/>.
<tilesheet /> – Tells the game to define a tilesheet
id=”items.png” – use the image “items.png” in the folder this xml file is in
width=”16″ – seperate the image into colums of 16 pixels
height=”10″ = seperate the image into rows of 10 pixels
Once your sheet is defined, just use the tile defenition to call your tilesheet. Remember that the placement on the sheet start from 0, so the top left tile would be x=”0″ y=”0″ and increase from there.
To call your tile in an item or object, use either tile=”tile_id” or icon=”tile_id.” Icon is used for items mostly, while tile is for structures. When in doubt over whether which to use find an example in the code.
As with before, this is just a basic look at tilesheets. Iregular tilesheets can be defined, such as that for the dragon boss. These work much the same way except that you must defined each frame of the sheet with its own line of code.
How Can I Make an Enemy?
At this point, you might have taken some time to code yourself a shiny new sword that can kill anything in one hit. Now its time to make some enemies to kill!
Enemies are defined much the way everything else is, using an <enemy /> tag. For an example, lets use the boar found on the starting island.
<enemy id=”boar” tile=”boar” health=”4″ damage=”2″ range=”7″ type=”surface” trapped=”pig”
capture=”2″ kill_achievement=”boar” night=”false”>
<run><play object=”this” animation=”roar” /></run><target id=”rat” />
<loot p=”4″ />
<loot id=”milk” p=”1″ />
<loot id=”meat” p=”16″ />
Enemies, as you can see, are a bit more complex. Lets simplify this a bit.
<enemy id=”dummy_boar” tile=”boar” health=”4″ damage=”2″ range=”7″ type=”surface”>
<loot id=”meat” />
Our new dummy boar will run around the surface, and will drop a meat when killed. The most important parameters here are:
id=”dummy_boar” the id of the enemy, used to summon it into your world
tile=”boar” – uses the boar tile to show and play animations
health=”4″ – Has 4 health
damage=”2″ = deals 2 damage per attack
range=”7″ – how far it can see and chase you
type=”surface” – some enemy types are surface, golem, and wyrm. These are based off the basic archetypes you see in early game. Type dictates their behavior.
<loot id=”meat” /> – when killed, drops a meat
To create yourself an enemy, just draw it up, define the tilesheet, define the tile, and call it. Then flesh it out giving it an attack and some loot. If you want to get more complicated, look at other enemies for ideas on how to create some custom attacks!
How Do I Make Animations?
As you may have noticed in the dummy_boar explaination, I mentioned animations! Animations are a series of tiles the game plays in sucsession when an event happens. Some common animations are: Idle (plays when the subject isnt moving); move or walk (plays when the subject moves); and attack (plays when the subject attacks). The game automaticaly looks for animations with the name “enemy_id.action” when the subject carries out said action.
Animations consist of a base tile, a number of frames to play, and optional parameters for the framerate of the item. For example: <animation id=”fire_boar.roar” x=”11″ count=”10″ /> the boar’s animations are more complicated, using both x and y. In this anim, the game sees that the fire_boar is using the fire boar tile, and says “hey! its not doing anything. Ill play the idle animation.” it then sees x=”11″ meaning play the 11th frame after the fire_boar tile, and play that and the 9 more frames after it. If you see y=”value” along with x=”value”, this is just another way of navigating to the tile sot start. Remember that this is using the original tile as (0,0), so if the start tile is not (0,0) of the sheet then the coordinates will be different. If you see length=”value”, this means “play each frame value number of times in sucession before moving on. This can be used to slow down animations.
This is a just a basic explaination of examples, remember these three things: count is number of frames; length is framerate; and the (x,y) you tell it to look at uses the tile as (0,0).
A second way to do animations is to define each frame after the other, this is used if your frames are not consecutive.
Where Can I Get More Help?
There is a very active communtiy of modders who check steam, reddit, and discord regularly. The main modding hub is on discord.gg – https://discord.gg/ZDyYpTE. We await your ideas of what to add to this great game!
The best way to learn new things is to look in the game code. If you want to know how something works, look at it! This is a great way to learn and expand your knowledge.
Hope you enjoy the Guide about Aground – How to Make Mod in Game Guide , if you think we should add extra information or forget something, please let us know via comment below, and we will do our best to fix or update as soon as possible!
- All Aground Posts List