Building A Simple Game on Top of Tiled?

(Jason Noble) #1

Ok, here’s my objective:

I want a C++/Qt application that will display a map (a hexmap I already created in Tiled). Then I want to build a hierarchy of military units that will be placed on the map, run an algorithm which will choose the optimal moves for the units, and then be able to “step” through the moves and display the new unit positions on the map.

I downloaded the Tiled repository but I’ve never worked with an app this large, AND I’m a newcomer to Qt/gui programming in general. I figured I could take the Tiled code and prune away what I don’t need, then add the functionality that I want, but I’m struggling to even navigate the source code. For example, I can’t find a .ui file for the map editor, and such. I’d like to add a tab next to “Objects” and “Images” where I can build out the military units and assign them hexes on the map. And add some buttons for executing the “game” algorithm and playing the moves.

I’ve got about 2 weeks to get all this done for an IEEE peer-reviewed research conference I’m trying to attend. :frowning: Any suggestions on the fastest way to hack what I need together? I’m on Debian Linux and I’m using QtCreator, if that helps at all.

(Thorbjørn Lindeijer) #2

I know it’s a bit late for your project, but I’d ignore the whole Tiled editor source code and only take the part in src/libtiled, which helps you to load and render the map in your game (check out src/tmxviewer for a small example application using libtiled).

You could place tiles with custom properties to assign military units to hexes. In your game code, you’d process the map and turn these into entities with proper gameplay logic.

I think the fastest way is just to copy the src/libtiled folder and using the libtiled-static.pri file to include it in your project (if you’re using qmake).