AGK Libraries

Base64 Encoder/Decoder

Encodes and decodes base64 strings. View the source code here.




TMX Importer v.1.0

This library will allow you to load a TMX tile map into your AGK program. TMX maps are created using Tiled, a popular map editor. The file format is a simple XML file, but Tiled allows the map data to be stored as either XML or in Base64 with various compression methods. This library currently only supports map data saved in XML. From Tiled, click on the Map menu and select Map Properties. Make sure your layer format is set to XML.

The current version of the library does not support separate TSX tilesets, the tileset information must be saved in the map tmx file in the default manner. Tiled should do this automatically anyway, so unless you explicitly export the tileset to TSX yourself, you shouldn't have to worry about anything.

What this library can do for you is it will parse the TMX file and create and render the map itself, automatically setting up for the map layout as defined by the file. Tile supports 3 map display layouts: orthogonic, isometric, and isometric staggered. All commands work independent of the layout format, so you as the user never have to worry about what type of map you've loaded.

Download 1.3MB




Pathfinder v.1.0

This library was originally created for DarkBasic Pro by TGC forum member IanM. I have ported it over for use with AGK.

What this library contains is a set of functions for finding paths around around obstacles in a tile-based world using two different algorithms; the A* method and a flood fill. While the flood fill may be slower, it does have its advantages. The way it's implemented allows you to search from the same source to multiple destinations where searches after the first are much less expensive. It allows you to search for paths using either 4 or 8 directions and optionally restricting diagonal movement between blocked cells, meaning the path can travel diagonally only if the surrounding area is free. This prevents paths from "cutting" corners through obstacles.

Why I decided to port this library rather than write my own? Having used Ian's library in DarkBasic for RTS purposes, I already knew his implementation worked well. And with code syntax similarities between DB and AGK, it was easy to port and required only a fraction of the time to gain the necessary functionality.

If you would like further information about A* pathfinding, the two best resources on the subject that I know of are:

Download 1.0MB