Ogmo blank tiles (-1 in XML) showing as last tileset [Solved]


(Lozza JP) #1

Hi all, can’t seem to find any documentation on this problem.

Creating levels in OGMO with our tilesets and if, if I am correct, you right click during a layer mode and it sets that tile to -1. I also think by default all tiles are -1.

The problem we are having is that it is wrapping back to our last tile on our tilemap image and placing it everywhere a blank tile should be, so we are having to manually change it to a blank space which is our 0 tile.

Any insight to whats going on please?

p.s. we would rather not have to change every -1 (last tile place) to a blank spot just to accommodate.


(Jacob Albano) #2

This is an outstanding issue of incompatibility between Flashpunk and Ogmo. It’s not something that will be fixed, it’s just a difference in the way each one does things. The usual solution is to simply skip tiles that are equal to -1 when iterating through and loading your tilemap.


(Lozza JP) #3

Oh so you can keep a full drawn tile on the last part of the grid, and write some code to skip the -1 in xml?


(Jacob Albano) #4

Exactly. Flashpunk wraps to relative tile indices (-2 would be the second-to-last tile, for example), but Ogmo has no way of representing an empty tile without resorting to negative numbers. Just check the index and pass it by if it’s below 0.


(Lozza JP) #5

Thank you very much!


(Lozza JP) #6

I am having trouble figuring this out for my self -_-

		mapImage = new Tilemap(Assets.BASETILE, uint(mapXML.@width), uint(mapXML.@height), 24, 24);
		mapImage.loadFromString(String(mapXML.baseTiles), ",", "\n");

I am looking at the Tilemap documentation of FP, does it involve a nested for loop checking getTile for value somehow and using clearTile?


(Jacob Albano) #7

You won’t be able to use loadFromString() in this situation. The approach has been detailed a few times on the forum already. Search for “ogmo -1” and I guarantee you’ll find what you’re looking for.


(Lozza JP) #8

I swear I searched for that before and couldn’t find much.

Anyway just had a mini brain wave while reading everyone elses and found a really easy fix (depending on game scale)

right click .oel in flashdevelop, find and replace all -1 with 0.


(Zachary Lewis) #9

That’ll work, but when you load that .oep back into Ogmo, instead of having blank tiles (no tile data) in those locations, it will have the first tile (tile index 0) in those locations. This may not be an issue, depending on how you’re creating your game.


(Lozza JP) #10

Yea we will keep all tiles at 0 blank, a lot easier than tracking the -1, or at the very least frees up one tile space.

Just a note to anyone doing a similar thing, FlashDevelop crashes on large levels trying to change so many -1 to 0.

Windows notepad handles it very effectively, as does notepad++ but I found at times notepad++ adding line feeds or carriage returns in places and corrupting the oel file for FP purposes.


(Jacob Albano) #11

Sounds like a lot of trouble that could just be avoided by accounting for the -1 value in your code. Speaking from experience with this exact problem, you don’t want to be fighting with your tools if you can get your code to do the work for you.


(Zachary Lewis) #12

Speaking of tools, the best text editor I’ve ever used is Sublime Text, hands down.


(Lozza JP) #13

This might sound a bit pedantic but I feel my .oel files shouldn’t have any -1 and should be 0 in order to be “right”, at least for me :confused:


(Jacob Albano) #14

As long as you don’t plan to ever open those .oel files in Ogmo again, that’s fine. Please don’t suggest it to other people as a solution though. It might work for you but it’ll probably cause somebody else trouble down the road.


(Lozza JP) #15

Yea well the -1 are just minor annoyances. Plan to finish the level completely then replace them.