Devlog #1 : Hexagonal Tile Map
Devlog #1 : Hexagonal Tile Map

Hey, I’m Thomas. Welcome to Coding Mojo. Today showcasing the very first version of the Tile Map it took a while to get there as I needed few preliminary packages but now the basics are done things should speed up a bit. First package, backend side, allows to communicate easily with dynamoDb database. It’s kinda crude for now but enough for my use case. I can easily create tables, and it include a support for versioned items. Versioning prevents writing against race conditions. To update an item, we must provide it’s actual version in DB otherwise the request is rejected. In the future, this package will also take care of communicating with redis cache to limit DB calls. Frontend end Backend communicate via a JSON REST API. I made a simple package in Unity to create backend call faster and easier. To get a more readable code, all JSON serialization is hiden in package logic. This package expose the class GET, POST, PUT and DELETE. Simply feed them a result template in form of a serializable class. This is an exemple of a POST call, Tile_UpdateForPosition is updating the type of a tile. This package named JSON REST CLIENT, is monobehaviour free and use Async / Await. I kinda struggled to get this package works with the Unity : Json Utility Tool, forcing myself to use for a time the Newtonsoft package : JsonDotNet. My difficulties were due to usage of Dictionnaries that does not seems to be handled by Unity native Json Utility. It’s now fixed thanks to switching from Dictinnaries to List. Once basics done, I started to code the map logic. I was not sure about the tile shape, cubic like minecraft ? Isometric like Dofus ? Or Hexagonal like Civilization ? In doubt, the backend support all of them with the idea to, maybe, sell this package later to help me finance this project. In addition to basic fonctionalities, like read and write a tile in DB, I splitted map in zones so I can get a full zone in one single call. Here, zone sizes are 10x10x10 tiles Then, adding position validation teached me the hard way that floating point in Javascript are a pain. Finally, I added to this first version world’s boundaries a default tiles types. Thus, tiles at world’s limits, like bottom ones, won’t be upgradable and in this case of ‘Magma’ type. Tiles included in wold’s boundaries but not yet in DB will be of type ‘Air’. Frontend side, we can display one zone, switch to build mode, and create two tiles types : ‘Dirt’ and ‘Rock’. Building can only be done on existing tile and we cannot build outside of current zone. We can also destroy a tile. I’m still not sure of the rules around user’s building, but this system will be very helpful as map editor. I did first asset myself and I’m quiet happy with it. The side chamfer underline the map grid, this should be very useful for player. I’m less happy with the tiles superposed, I should maybe have different skin for tiles on top of a column. To be tested. May you have any question or comment, please use the comment section. For me it’s coffee time, bye!

1 thought on “Devlog #1 : Hexagonal Tile Map”

  1. Welton King says:

    Great video – you have a very nice system here which will make map design much easier – can't wait to see more 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *