Engines that can read game logics from map properties, instead of external scripts

First of all hello, and congratulations on the fantastic work you did with this editor! I am new and so far took a brief look, to get an idea on what features it has and what it can do. But onto my question:

I’ve been looking for an easy way to create open-source 2D games (such as an RPG or side-scroller or point-and-click), preferably in HTML5 or a standalone script language like Python. I found several such engines which support Tiled maps. However they all require you to script most logics for your game manually: You must call your own functions to load the scene, manually define all enemies and items, etc. I know a bit of programming and a bit more scripting, so writing a few functions is doable… but also a time consuming and tiring process, which means less time to make games or detail them. I prefer SDK’s where you can do everything from a window and by using menus, and scripting is optional or only needed for extra functionality… such as RPG Maker, Blender Game Engine, Unity, or OHRRPGCE. So I was wondering whether there is a way to use Tiled as not just a map editor, but a full game SDK.

Yes: I know that Tiled is intended to be a map editor only, and not a complete game maker! It doesn’t even have menus for setting up advanced actions and triggers, nor can it run any games by itself. It does however have a powerful ability which would allow it to define entire games: You can create and place objects on your map, and these objects may contain custom properties. These could be used to indicate what each object’s role is, contain modifiable values, or even address script functions from the engine of choice. An engine intended for this purpose could simply read the map and determine what everything is supposed to do.

Example: You add an object with the player sprite to your map. Then you give this object a custom property called ‘function’ with the value ‘set_player()’. You then add another property called ‘movement_speed’ with the value ‘4’. Next you export your map to a tmx file and run it through the game engine. The engine sees the ‘function’ property and executes the builtin function ‘set_player’ on the object, which configures it to act like a player (move with the arrow keys, have the camera centered on it, etc). It next looks for the value of the ‘movement_speed’ property to determine how fast the player walks, and in this case finds ‘4’. Congratulations, you can now walk around the map as a character! Needless to say this is a very simplistic example, and there would be a LOT more to have in these functions to setup a functional game… not to mention defining enemies, items (weapons and armor and health), triggers to change the map, etc.

So are there any game engines that can do this, and allow values or functions to be directly specified in Tiled without having to create any custom script to write the game? It would be very convenient if entire games could be exported as just a series of tmx files this way (accompanied by their graphics and sounds), and to play them you only execute the first tmx.

Thanks for the compliments! Indeed Tiled doesn’t provide a “Game Maker” or “RPG Maker” experience out of the box, but in combination with a game engine it can certainly be done. The idea is that Tiled is flexible enough to be of use to a wide variety of games and game engines, so it leaves that part open.

Since you mentioned HTML5 and tight integration of objects with behaviour defined in code, melonJS comes to mind. It does not come with built-in high-level game logic (though it features lots of common game logic), but if you define your enemy types with melonJS you can easily have it instantiate those types based on objects placed in Tiled and set custom properties on them to tweak their behaviour.

Ok… I looked a bit more at the way Tiled works, and further refreshed my memory on how most HTML5 game engines operate. I thought to be even more clear and technical about exactly what I’m looking for. Since HTML5 is where I’m most interested to do 2D games, I will focus on it in my examples.

Most HTML5 game engines are composed of multiple components… like a scene manager which takes care of assembling and loading the world, a sound manager to trigger sounds, sometimes even a physics engine for objects. A person who wants to create a game on top of such an engine has to make a new javascript file for their game. In this file, they reference and use functions provided by the engine, combined with assets such as sprite / tile images and Tiled maps. For example: To create your first scene, the usual procedure is to call the a function of the form “world1 = my_engine.scene_manager.create(”./maps/world1.tmx"){ … }", whereas to define an object (like an enemy) in this world, you would use something like “my_engine.object_manager.add_monster(world1){ … }”. In essence, you use a load of engine functions in your own scripts to create your game and its logics, and Tiled only to design the map and reference where objects defined in these scripts will appear.

What I’m interested in is a somewhat reversed procedure: You don’t define objects and their logics in a script file then simply use Tiled to place them on the map… instead you define objects and how they work directly from within Tiled, by giving them custom properties which name the engine functions that should be executed on that object. To continue on my above example: The monster wouldn’t be defined by having a game.js call “my_engine.object_manager.add_monster()”… instead there would be no game.js at all, and in Tiled you would select the monster object and give it a custom property named “on_game_start” with the value “my_engine.object_manager.is_monster(true)”, which tells the engine that when the game starts it should set that object to act like a monster NPC with the default settings.

Some might say this is pointless, because it’s not that hard to code the logics of your game in javascript. It is however a more draining process, whereas this would make things a lot easier. Some game developers like myself prefer to spend more time playing with the graphics and placing stuff on the map, and less time with our nose in code. Adding dozens of properties to objects in Tiled can be way easier than creating a script and manually writing the same dozens of functions, because you have a visual representation of what you’re adding them to as well as a GUI to guide you.

So I hope this explains what my idea is exactly… and that people could put up with so many paragraphs of text :stuck_out_tongue: In either case Tiled doesn’t need to change anything for this… the question is whether there is a game engine that can interpret custom properties in Tiled maps the way I’m describing.

Yeah, defining those enemy types separately is the annoying part… as well as all items and their in-depth functionality (weapons / armor / potions / etc). I’m in a sense thinking about a common framework, which already has all these “types” prepared or a way to make them work using a few parameters in Tiled. In either case I shall surely take a look at melonJS, it looks pretty nice and perhaps this common interface can be scripted on top of it.