What is the best (simplest) Tile-Map Engine?

Monkey Forums/Monkey Beginners/What is the best (simplest) Tile-Map Engine?

GarBenjamin(Posted 2015) [#1]
Hello.

I am currently exploring my options for 2D game dev. Have been using Unity for about 20 months now and keep thinking it is way overkill for 2D games.

So I started looking for alternatives and document my findings on my site: http://garsgames.com/blog/game-development/testing-2d-game-development-systems/

Obviously, I am down to Monkey X now. Only been using it a couple days and so far I like it a lot.

Just curious what the best tile-map engine is for Monkey X?

Sure I can easily knock out one. In fact I already have as can be seen on the Monkey X page on my site. However, I've read about a Tiled map loader and also other things such as the Diddy module.

Just curious which is the easiest (quickest) to work with? Really all I want is just the most basic stuff. Being able to design my levels (so some kind of basic editor), loading the map data into Monkey X program, displaying it, being able to "read" a map cell and change the tile residing in a map cell. Anything more is just extra baggage that I won't have a use for.

Is there something like this available or should I just knock it out myself? Basically, I don't want to reinvent the wheel and this is why I am asking.

Thanks!


Playniax(Posted 2015) [#2]
Yes, I think you can probably use Diddy (free) although I thought it was only the loader but you can test this by downloading Diddy :)

Or our framework Ignition X (not free) has a tile engine that supports tiled.

You can use it standalone (lightweight low-dependency) or with the Ignition X scenegraph based engine.

There are probably others, maybe have a look at phantom but I don't know that much about it.


Nobuyuki(Posted 2015) [#3]
Rolling your own right now isn't such a bad idea, but for tiled support, diddy's is the only one I know of which is free and relatively complete. It feels a bit over-engineered sometimes, but you can use it without diddy with a few slight modifications and its a pretty decent implementation. Samah's recently done some work on it, and I'm using it in my next project myself, so expect a few bugfixes and feature additions to this module to end up in diddy's mainline eventually...


Samah(Posted 2015) [#4]
@Nobuyuki: It feels a bit over-engineered sometimes...

It was originally (maybe somewhat naively) designed to work in tandem with the screen framework, and the coupling with the XML module is very tight. This is mostly due to the fact that when I wrote it, Skn3's XML module did not yet exist (publicly at least).
I'm in the process of reengineering some of it, but of course backward compatibility is always a problem.
I'll likely put it in its own directory, move the loader to a separate monkey file, and strip out the XML dependencies. Then I'll make another loader that supports the new SAX engine, and possibly one for Skn3's parser.
The only thing I really dislike about this is that I don't want to be reliant on another 3rd party framework. This is where we need Maven for Monkey!


GarBenjamin(Posted 2015) [#5]
Thanks for the fast replies. Appreciate it!

I only have the free version of Monkey X at this point since I am just starting on the process of testing many different 2D game dev kits.
If I find Monkey X is the one I can develop 2D games in the quickest then I will certainly buy it and likely will grab that Monkey X Studio bundle.

Sounds like Diddy has the tile-map management integrated as part of a larger system... but hey... maybe that screen framework will be something that can save some time in another area. I will check it out.


MikeHart(Posted 2015) [#6]
fantomEngine features tilemaps too, but it is also integrated into the engine just like with iknishion.


GarBenjamin(Posted 2015) [#7]
I tried Diddy tonight. I spent a couple hours working with it and could never get my tilemap to display. lol I am sure it is because I need to learn the framework and really understand how it is meant to be used. In the interest of saving time I am just going to write my own Tiled map loader tomorrow.

I am sure Diddy is great because I checked out some of the examples and they were very good! I think it would be helpful if there was a manual or some kind of documentation for it. I went through all of the code in an attempt to understand it. Then checked the platformer game example code too. That helped but there just seems to be so much more to it than simple tilemap management I think I'd almost need to spend a day just going through the code of the module and the examples to really wrap my head around it all. If I end up sticking with Monkey X I will have another go at using Diddy.


Samah(Posted 2015) [#8]
@GarBenjamin: Sounds like Diddy has the tile-map management integrated as part of a larger system...

I'm working on removing a lot of the dependencies in the tilemap engine. You can use it with Skn3's XML module now, if you prefer.
The dependency on the containers module is gone, and I'm hoping to do some black magic to make the screen framework an optional dependency. At the moment it's imported even if you don't use it.


bitJericho(Posted 2015) [#9]
hey, I also have my tiled loader which I think you referred to: https://github.com/bitJericho/bit.tiled

I haven't tried it out with the latest version of tiled but if you have any trouble I can fix it up for you on the spot. It's fully documented, if you go to help > modules > bit.tiled (after you rebuild documentation).

I'm also in IRC off and on every day.


Danilo(Posted 2015) [#10]
There is also Flixel for Monkey. It comes with Bananas that show tile map support:
map = New FlxTilemap
map.LoadMap( ... )


More libs are listed in the Module Registry.


Ironstorm(Posted 2015) [#11]
fantomEngine features tilemaps too, but it is also integrated into the engine just like with iknishion.


Made my day :-D


MikeHart(Posted 2015) [#12]
@Ironstorm: You didn't know about it?


GarBenjamin(Posted 2015) [#13]
bitJericho: hey, I also have my tiled loader which I think you referred to: https://github.com/bitJericho/bit.tiled

I haven't tried it out with the latest version of tiled but if you have any trouble I can fix it up for you on the spot. It's fully documented, if you go to help > modules > bit.tiled (after you rebuild documentation).


Hey thanks for reminding me. I am on lunch break and just grabbed it. This is very straightforward and only took about 15 minutes to get my Tiled map loading and displaying. The only issues I ran into are (1) I needed to get the skn3.xml module and (2) edit my Tiled map file to remove the path information Tiled had included because that was causing the tiles image to not load.

A quick look at the module's code, inserting a couple of print statements to gather info and I was good to go! I will have to mess around with it more and see how scrolling is handled and so forth but looks great so far!

A couple things: I have hit that rebuild documentation button many times now and nothing ever changes. I see no documentation for any modules I have downloaded. In fact under help there is NO "modules" item even displayed. I do notice during the rebuild of the documentation it always mentions missing link for 3rd party modules. Maybe it is a Pro only feature.

Here is a screenshot:


So, I don't know what is going on. I keep thinking maybe there is more to using Monkey X than I am aware of. Like maybe I need to manually be editing some config file or something.

Also, it is very odd this forum does not have a simple reply button/link to easily reply to a specific post. I get that most of us are probably "old school" around here but still this simple feature would make using the forum a lot simpler and certainly help any new people to not be turned off so fast. Having to copy and paste in the Quote code seems pretty antiquated. lol


bitJericho(Posted 2015) [#14]
Go to file > options and make sure the Monkey Tools Path points to the main monkey folder, for me (on pro with jungle ide) it points to:

C:\Users\me\Documents\Monkey X Studio\MonkeyX\MonkeyXPro84c

Then your modules go into C:/Users/me/Documents/Monkey X Studio/MonkeyX/MonkeyXPro84c\modules or perhaps modules_ext? I used to put it in modules when I wasn't using pro.


GarBenjamin(Posted 2015) [#15]
I put them in the modules folder where I installed Monkey on my C drive. I'll definitely check that File->Options path again. I think it is already pointing to the install location and will double check to be sure. Thanks.


GarBenjamin(Posted 2015) [#16]
Yeah it is pointing to the correct path. Maybe the Rebuild Help is just broken in the free version?

I shouldn't need docs at this point. Your module is very straightforward and tightly focused on working with only Tiled TileMaps.

I'm going to get started on the scrolling now.

Thanks for taking the time to give me some things to check into!


bitJericho(Posted 2015) [#17]
Sounds good. I installed the free version and it builds the help as expected. Not sure what the problem would be. Here's a copy of the docs just in case you want to review them:

https://www.dropbox.com/sh/tzt9xxhy75kvjf6/AABSGbi_44Pnm9efS-RoLgmHa?dl=0


GarBenjamin(Posted 2015) [#18]
Ah cool. I appreciate it. Don't really need them though. Finally got some time to get back to this project and it all came together fast.

Experiment 3 in Monkey X using Tiled and your bit.tiled module has been added to my Monkey X page: http://garsgames.com/blog/game-development/testing-2d-game-development-systems/review-monkeyx-2d-game-development/

Tilemap work is done with and now it is time to get on to the next thing. Basically I am just trying to see how long it takes to get together all of the stuff needed to make a 2D game, how long it takes to actually develop with each programming language and API and how enjoyable the process is. Monkey X is rocking so far!


bitJericho(Posted 2015) [#19]
Nice blog. Seems like you and I have similar coding preferences haha. I'd love to see what you can do with audio since monkey is sorely lacking!

I didn't include any rendering as there are numerous rendering APIs out there none of which are the same. In fact I didn't even really like doing the image loading but I didn't wanna mess with interfaces. Maybe one of these days I'll spruce it up though. Thanks for the write up it's cool to see someone making use of something I made!

Personally I think Monkey X is the best language out there :)

Oh I also see on your other page that you're a fan of blitz. I'm sure you've noticed but it took me a week or two to realize, Monkey X is the next incarnation from Blitz, see the copyright at the bottom of the page.


GarBenjamin(Posted 2015) [#20]
@bitJericho:

Alright, I finished my Audio Manager. I didn't waste time trying to support everything out there.

Just 4 out of the top 5 (most used) browsers.

Not sure what kind of computer or OS you are using. You can check it out and see if music and sounds actually work for you.

I tested on FireFox, IE, Chrome and Opera on my Windows laptop and audio work in all of them.

At some point I need to upload all of the source from my work over the past several days. I have tried to be thorough in documenting my experience as a new user of Monkey X on my website though. So, hopefully that may help others thinking of giving Monkey X a try. Or maybe even help lead some people to Monkey X.


Danilo(Posted 2015) [#21]
Music works in Safari on Mac OS X.
Works with Windows Phone 8 using Internet Explorer.
Works with MS Surface 2 /RT tablet using Internet Explorer.

Does not work on iPad (Safari and Google Chrome).
Does not work with Nexus7 Android tablet (Google Chrome).


GarBenjamin(Posted 2015) [#22]
Thanks for testing. Yeah music doesn't play on my NEXT tablet either but I am not worried about that. I'd do a dedicated mobile build for those kind of devices and I have very little interest in cell phone / tablet games anyway. Mainly because they suck as game machines at least to me. Something like the Nvidia Shield or a good old Nintendo DS now that is real mobile gaming! :)


bitJericho(Posted 2015) [#23]
I added a few new things to my tiled loader; see http://www.monkey-x.com/Community/posts.php?topic=8816&post=109189

I also checked out your problem you said:

edit my Tiled map file to remove the path information Tiled had included because that was causing the tiles image to not load.


I found that by default tiled does not add any path information. Perhaps your images were in a completely different location than your maps. I don't think there's much I can do in that case.

Anyway, hope to see you back again soon!


Steve Ancell(Posted 2015) [#24]
I don't use a map editor myself. I made my own loader class for loading in plain text files that contain directives, these are then made sense of by my own parser in the program. If that makes any sense.


bitJericho(Posted 2015) [#25]
Yep that's how I used to do it. However, tiled is really powerful in that it's all right there and the xml files are easy to edit by hand. (I found adding 50 properties is a whole lot faster by hand than in tiled!)

And while I don't think the xml layout for tiled was well thought out, it is thought out enough to be extremely powerful and easy to use (they made some technically boneheaded calls, like ordering things from the top to the bottom when the XML spec allows for loading out of order, or creating child elements when none are really needed). You can place tiles and objects. Tiles and objects each can have a list of as many properties as you like (these are stringmaps). So between stringmaps for any particular tile and objects, you can encode a ton of stuff. I can set position and rotation for objects on the map, set the object's images and animation data, set its physics, and have it all in one human readable map file. You can just about store all the game parameters in a map file and just have your program process all the properties!

One thing I've done is I wanted box collision for a project, so I loaded a "collision" tileset and made images so I could see my collision boxes in the editor. I don't render these in the game engine. To check for collision, I encoded the collision area as tileset properties. So now anytime I place a specific tile down, the engine knows that a small section of that tile is a collision box, and the image I have in the editor matches it. With tiled I can then turn on and off my collision layer so I can edit with or without seeing my collision areas. I also use this for zones. Instead of blocking on a collision tile, I just process what's supposed to happen when a player goes in an area.

Tiled is easily the best map editor I've ever come across!


GarBenjamin(Posted 2015) [#26]
@bitJericho

Just letting you know I had to make an update in my local copy of your bit.Tiled module.

I didn't see any way to actually update the tile map so I added the following right after your GetTileValue method:
Method SetTileValue:Void(x:Int, y:Int, tileID:Int)
    DataResource[y * Self.Parent.Width + x] = tileID
End


Just figured I'd let you know in case you wanted to make the update on your end and post in your github.

I am sure this would be useful to many people because it is pretty common to update the map perhaps unblocking an entrance or like in my case I activate "light up" check point markers as the player reaches them. For a new game, I scan the map and change any lit checkpoint markers back to unlit checkpoint markers and so forth.


Salmakis(Posted 2015) [#27]
my Suggestion: write your own!
its quite easy with monkey & mojo / mojo2 to write your own very fast and optmized tileMap thingie.
you can adapt, modify and optimize it for specific Tasks depending on what you want for your current Project.
copy it and comment out/delete stuff you dont Need in other Projects.
in example my complete tilemap can have tiles in differend sizes per layers, multilayers, generate a minimap texture with Color per tile, smooth Scrolling and zoom, entitymaps (for anything that is moving), mapsize can be "infinity" with an octree.

so when you write your own, you gonna learn alot of stuff, and gives you 100% freedon and no boundarys like any prebuild engines have.


bitJericho(Posted 2015) [#28]
Hey salmakis. You can kinda do different sized layers with tiled by loading and rendering two different maps simultaneously. Everything else you described is already there. The memory footprint is very low unless you use all the features :) It grows basically along with your map size. You're right though, there's nothing like the freedom of your own engine. I wouldn't recommend tiled or any of our tiled modules until you've created your own maps so you understand what is what.

To Gar, I'm currently rewriting the engine and will make sure I have a number of functions including your suggestion to assist with realtime map editing. I may also include an export function down the road that I'm sure will be useful. I'm another week or two away from completing it.


GarBenjamin(Posted 2015) [#29]
Yeah it is easy enough to write one and something I used to do. These days there are so many good options available there really is no reason to roll your own. It also makes it so there are some standards. Like if everyone was using one of the popular map editors such as Tiled then it becomes very easy to swap maps, allow players to make maps for games and so forth without everyone needing to learn a custom editor for each game.

There is some good learning to be had in making map editors and such and I did that a lot 20 years ago. Now I just want max dev speed.


golomp(Posted 2015) [#30]
In my opinion, the best tile map engine is the one you build by yourself.

For at least these reasons :
- you have included only the functionnality you need
- you masterise it's evolution

(and it's a very good programming exercise)


Samah(Posted 2015) [#31]
@golomp: In my opinion, the best tile map engine is the one you build by yourself.

I would also use the one I built myself. :P


GarBenjamin(Posted 2015) [#32]
Ha ha. Yeah I can understand that. I used to do the same thing. Mainly because they are so straightforward to knock out AND you can customize it the way you want.
The last real full featured map editor I made was actually back on the Amiga in Blitz. It supported up to 3 or 4 I forget which map layers because at the time I figured I would never need more than that. And it also supported an object marker layer (for identifying zones for collisions, entering areas, triggering events, etc) and an item/enemy layer.

The greatest advantage with rolling your own was to make it so it can handle everything you need because map editors used to be pretty basic "back in the day". I almost created one for this test game (actually at first I started to just hard-code the map).

Decided to look around and see if any of the modern map editors had increased the standard features and was very happy to see they do. They are very well done these days to support games with support for objects and so forth. Things like Tiled, Dame, OGMO Editor and Tile Studio speed up development considerably.

Still it is fun to write your own for the heck of it. :)