Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Tiled TMX Map Loader 2.0

Author
Message
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 30th Dec 2013 15:24 Edited at: 8th Jul 2014 18:38
What is this?

A loader for Tier 1 AppGameKit to load Tiled map files in .TMX format. No Base64/etc. yet.

How did it come about?

I decided I wanted to use Tiled for my current project, and was a bit horrified at the thought of writing my own loader (which I certainly could have done, but it would have taken ages and too much brain-power), so Googled "agk tmx loader" and Phaelax's loader came up, among others. I tried them all and Phaelax's one was the most complete.

So I made a small test map in Tiled and tried to use the loader, but it generated the same error as spasski pointed out. That was disappointing and annoying as I had no idea if I was doing something wrong or if it was Phaelax's code. Well, after a great deal of experimenting I discovered the bug - in the loader. I fixed it, and had a quick glance over the rest of the code. It seemed less complicated than I originally thought, so I read through the most important bit - tmx_LoadMap(). I found it only supported less than half that which Tiled supported, and, most importantly, didn't support objects or custom properties. I needed to use objects, so I set about adding support for them...

...and ended up adding support for everything.

More detailed information is contained in the file. Actually I'll paste it here as well:



I certainly haven't tested everything but I've done minimal testing as I've gone a long and I'm fairly sure it should all work just fine, but there's a good chance I've failed to add a function that should be there or left the innards of one function with the innards of the function it was copied from. Well, not a good chance, but still a chance.

The point is, if you find a bug, tell me and I'll fix it right away

I don't really know how long this took me, but I would guess somewhere between 8 and 10 man-hours.

I'll do some speed comparisons tomorrow as it may be faster than Phaelax's original loader, or it might be much slower...dunno.

I still have some things I want to do with it, but I'm far too tired to do anything more tonight. -__- ZZzzzz...



Many thanks to Phaelax for the original loader

[01/01/14] Update: Fixed a bug or two and realised you can set properties for each individual tile (before you place them)....hhhh... MORE things to add...
[25/01/14] Update: Fixed a bug with tmx_GetTilesetPropertyCount() (thanks to george++ for pointing this out )
[09/07/14] Update: Changelog:


Enjoy

Attachments

Login to view attachments
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 30th Dec 2013 17:21 Edited at: 30th Dec 2013 17:23
Great Work Clonkex !

I also worked on a TMX Loader in the same way

The biggest problem is the display performances on huge maps for mobile devices. i have tried to do a View/Screen Culling on displayed tiles only but the loop to test each tile takes a lot of time lol.

Maybe the idea would be to check screen bounds X1,Y1,X2,Y2 and determine mathematically tiles area to display or not and create a tmx_UpdateMapView() for that or a "ScrollMap(offsetX,offsetY)" which also implements this culling.

In fact, The problem is the number of tiles to manage simultaneously....

Another approach, if there is no need to manage tiles individually (visibility or animation), would be to regroup tiles at loading and merge them into larger images/sprites (memory block with cache feature to prevent losing times for the next loadings) to reduce number of sprites and improve performances.

--------------
luschie
10
Years of Service
User Offline
Joined: 20th Dec 2013
Location:
Posted: 30th Dec 2013 18:47
That's just simply awesome! Many thanks!
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st Dec 2013 00:35
Quote: " as it may be faster than Phaelax's original loader"

Hey hey now, let's not get carried away!


Quote: " biggest problem is the display performances on huge maps for mobile devices."

I wonder if there would be any difference if you clipped each sprite to the viewport area. Or are they automatically culled/ignored if positioned off screen?


If you'd like to add Base64 support, here's my AppGameKit library that might help you:
http://www.zimnox.com/resources/agk/snippets/showcode.php?c=56


Nice work. I know I had partial support for collision data, but it might have only been in the DBP version.

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 31st Dec 2013 01:15
Quote: "Great Work Clonkex !"

Quote: "That's just simply awesome! Many thanks!"

Quote: "Nice work."


Thanks!! It's always great to hear my work (even if it was primarily for my own use) is appreciated

Quote: "Hey hey now, let's not get carried away!"


lol I'll do some tests later. Oh wait, no there's a bug. It's not loading overworld.tmx without crashing. I knew it was a bad idea to post it without actually testing it I'll fix it later

Quote: "If you'd like to add Base64 support, here's my AppGameKit library that might help you:"


Excellent, thanks, I'll have a look later

MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 31st Dec 2013 04:53
Hmmmf i can't get your lib to work with my isometric or ortho maps. i have no time to debug for the moment but i will


Quote: "I wonder if there would be any difference if you clipped each sprite to the viewport area. Or are they automatically culled/ignored if positioned off screen?"


(using my own tmx lib...)

i think they are automatically culled : When i scroll outside the map (black screen) , FPS is at 60 (on android an on PC but on iOS, being outside of the map doesn't affect FPS which is maintained to 45 (ipad 2)... when i enter the map (filling the screen), the FPS decrease to 25/30fps (on samsung S3 and google nexus 10 (huge resolution...)... but on ipad 2, it stays at 45 ). I've tried with an orthogonal map without any transparency ... same problem On PC it's the same thing. 600 fps outside the map and 250 inside it (yet it's a high-end PC ...)

Clonkex : what is your FPS when a map fills your entire screen with your lib ? (and on what device ?). (on nexus 10 ... 2560x1600 so it represents a lot of tiles ... sure ... but ..:p). I simply would like to gzt 60 fps when displaying a map on a mobile device even if i have to display 3000 tiles on screen at the same time (which is the case with high resolution mobiles with 32x32 tiles for example)

I'm sure i'm having a problem elsewhere and i don't see it ... i will investigate further.

--------------
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 31st Dec 2013 06:55
I haven't actually tested iso maps yet and I've just started searching for the bug that's crashing overworld.tmx. After I've got it working with all the tests I can throw at it I'll do some performance testing.

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 31st Dec 2013 14:58 Edited at: 31st Dec 2013 15:08
Ok, I still have yet to test iso or staggered maps, but all ortho maps should load now. The problem was that my code assumed there would always be properties set for the map... once I figured out what I'd done, it was a 2 minute fix.

New version uploaded on first post (if you read this within about 5 minutes of me posting it, just give me some time to actually update the first post ).

Once again I'm up far too late and horribly tired....

Oh, and happy new year to those living on a bit of the world that has spun around far enough!

EDIT: Hooray, my loader does appear to be faster! overworld.tmx loads in about 5.7 seconds with Phaelax's loader and about 3.1 with my version There's a lot more speed improvements I could make but they would just add unnecessary complexity.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 31st Dec 2013 18:57
Quote: "There's a lot more speed improvements I could make but they would just add unnecessary complexity."

It's never unnecessary if it's improving something! What did you change in the loader to make it faster?

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 1st Jan 2014 05:44
Quote: "It's never unnecessary if it's improving something!"


Well...maybe, but I envision the code becoming too complicated to debug effectively

Quote: "What did you change in the loader to make it faster?"


Well probably the biggest change was making it only check for XML tags when necessary (mostly). So, for example, it only checks for the "map" tag once and not repeatedly in a loop. It also only checks for the "image" tag of a tileset after it's found the "tileset" tag and only checks until it finds the "/tileset" end tag (technically it makes some assumptions in some areas, but I'm fairly sure they're accurate), and so on.

I also improved code layout (IMO), drastically improved consistency and despite my greatest urges I continued your coding style (ugh...unnecessary spaces everywhere ) so none of the code is out of place.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 1st Jan 2014 22:04
Spaces makes the code readable! I say sir, I do bite my thumb at thee!

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 2nd Jan 2014 02:13
Quote: "Spaces makes the code readable!"


So they say. I've never agreed, even though almost everyone else does :-|

Quote: "I say sir, I do bite my thumb at thee!"


I had to google that to work out what you meant Did you say/think that in an English accent? Sounded like you had for some reason

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 2nd Jan 2014 09:35
Check out Romeo and Juliet!

-- Jim - When is there going to be a release?
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Jan 2014 11:22
lol, yes. I cannot say that line without an accent!

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 2nd Jan 2014 14:13
The quote is actually wrong, Phaelax.

Play the attached MP3 for the correct line, and (dare I say it) correct accent.

Biting your thumb and then flicking it from behind your teeth at somebody was the Elizabethan equivalent of sticking a finger.

Useless AppGameKit Trivia: I once acted as Macbeth, and was probably, at 5'6", the shortest in the history of theatre. In the National Youth Theatre I was understudy for the ghost of Hamlet's father; the actor was 6'4" and I couldn't see out of the visor of his armour! Fortunately he remained fit, and I never had to do it in a performance. Those who witnessed the understudy rehearsals said that it lent a strange and appropriate echoing acoustic to the voice issuing from an unoccupied helmet, but that ghosts don't normally trip over the scenery and say the F word when exiting.

-- Jim - When is there going to be a release?

Attachments

Login to view attachments
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 3rd Jan 2014 06:30 Edited at: 3rd Jan 2014 06:32
It wasn't intended to be an exact quote, more of a paraphrase. I listed to the clip. I was taught to put more emphasis on the ending of words than how people normally talk. I did a small bit in a shakespearean play long ago. Blow, blow thou winter wind!

Although, technically speaking, given the time period of Macbeth, you're probably closer to the real height back then than someone who's 6'4.

3d point in space
15
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 5th Jan 2014 03:09 Edited at: 5th Jan 2014 03:39
i already solved this problem long time ago in 2012 i just have not done any thing with it sorry about that I was making a gui to handle tmx but there was no interest in it I think its finally time that I put my editor on the forums because I can't fix it because I stopped working on it, but my problem was that I wanted to sell it.


here are the exports that can go to tier one also

I think its the second export i believe



The export can be loaded in Tier one I think I have a newer verson though this is one of the older versions but it works, and actually this export is extremely fast to load in both tiers I write some more documentation when I get to it.

What I did is I converted the TMX into a agk save file which can be loaded with the commands in agk which is very fast I tested it and it loads fast, but u you can also use that convertor to make a save agk file and convert it back to agk I think.

Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.

Attachments

Login to view attachments
george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 19th Jan 2014 12:44 Edited at: 19th Jan 2014 13:26
Hi Clonkex,
It seems that the function

is not working as expected.
The

is always lower than the

by 1 and the number of properties is

I suggest a quick fix to this as follows:


Do you have any time plans for support for per-tile properties?
xGEKKOx
AGK Master
15
Years of Service
User Offline
Joined: 7th Dec 2008
Location: Italy
Posted: 19th Jan 2014 19:56 Edited at: 19th Jan 2014 19:58
Nice work Clonkex, i done a similar "tile manager" some months ago under c++ for iOS, when i started to use Tiled too.
Really nice work on Tier 1!!!

Edit : Ops, i see is by Phaelax, anyway nice job both!

Long life to Steve!
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 23rd Jan 2014 10:13
Quote: "Check out Romeo and Juliet!"


Oh I have, only it was years ago and I wouldn't remember much

Quote: "lol, yes. I cannot say that line without an accent!"


lol

Quote: "Those who witnessed the understudy rehearsals said that it lent a strange and appropriate echoing acoustic to the voice issuing from an unoccupied helmet, but that ghosts don't normally trip over the scenery and say the F word when exiting."


lol!

Quote: "i already solved this problem long time ago in 2012"


What problem?

@george++:

Ah, thanks for pointing that out. I haven't touched the loader for some time now, but I'll have a quick look and see if I can't see the real bug.

Quote: "Do you have any time plans for support for per-tile properties?"


Do you need them? Like, in particular? I do have plans for them, but then I have plans for lots of things that won't happen for some considerable time. If you particularly need per-tile properties, I'll do my best to add support... wouldn't want to stand in the way of a new project!

Quote: "Nice work Clonkex"


Thanks!

Quote: "Ops, i see is by Phaelax, anyway nice job both!"


Indeed; credit where credit's due!

george++
AGK Tool Maker
17
Years of Service
User Offline
Joined: 13th May 2007
Location: Thessaloniki, Hellas
Posted: 23rd Jan 2014 15:29
Quote: "If you particularly need per-tile properties, I'll do my best to add support... "

Thank you very much for your generous offer. I asked only to see if I can count on complete loader like this in the near future
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 25th Jan 2014 02:35 Edited at: 25th Jan 2014 02:55
Quote: "Thank you very much for your generous offer. I asked only to see if I can count on complete loader like this in the near future"


Well, it depends. I have a lot on at the moment, so it might not happen for a few weeks (though I hope much sooner), but if by "near future" you mean within the next month or so, I would say you can pretty much count on it

EDIT: I found the bug with tmx_GetTilesetPropertyCount() (in about 7 seconds). It was a stupid little error:

Should have been:


I'll see about getting support for per-tile properties in.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Jan 2014 18:46
Does TMX even support individual tile properties?

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 26th Jan 2014 02:30
Quote: "Does TMX even support individual tile properties?"


Apparently, but maybe not the way you think. They're per...um... tileset-tile. As in, each available tile, not the actually placed tiles. If you right-click the tiles in the tileset window you can set properties for each one. The Overworld map has some tile properties set.

Duffer
21
Years of Service
User Offline
Joined: 9th Feb 2003
Location: chair
Posted: 26th Jan 2014 11:38
@ Clonkex,

This is awesome.

Does it work with ISO tiles yet?

a long time dabbler with DBC and DBPro with no actual talent but lots of enthusiasm...
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Jan 2014 23:15
Quote: "They're per...um... tileset-tile. As in, each available tile, not the actually placed tiles"

That's what I thought. That kind of discouraged me a little because it made it more difficult to fine tune my collision from within the tmx file.

Quote: "Does it work with ISO tiles yet?"

I don't know if Clonkex kept the iso support or not, but original version version supported it.

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 29th Jan 2014 03:25 Edited at: 2nd Aug 2014 05:16
Quote: "This is awesome."


Quote: "Does it work with ISO tiles yet?"

Quote: "I don't know if Clonkex kept the iso support or not"


I did indeed keep iso support, but whether it works or not is anyone's guess (if you can test it for me that'd be good - I don't have time right now). I basically rewrote essential systems within the loader without any testing, but I'm surprised how few bugs have cropped up.

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 29th Jan 2014 03:57
Quote: " but I'm surprised how few bugs have cropped up"

Because we're just that awesome!

Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 29th Jan 2014 04:18
Quote: "Because we're just that awesome!"


Indeed!

Lost Dragon
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 25th Feb 2014 04:43
I got around to testing this.

Unless I made a mistake (always possible)...

Using Phaelax's original example maps and your revised loader the iso and staggered loading modes both appear to be broken.

"Zelda" and ortho work okay.

Neat project.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Feb 2014 05:59
Broken in what way? Is it just not displaying the tiles correctly?

Lost Dragon
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 25th Feb 2014 06:05 Edited at: 25th Feb 2014 06:14
I get a "subscript is out of bounds at line 419 in tmx_engine.agc" error when attempting to use this updated loader and your staggered or iso maps.

I thought perhaps the map format used in your original example was out of date now so I loaded it back into the current version of the Tiled map editor and saved it again but that didn't help.

Does anyone get this if you use this loader and the example maps Phaelax made?

Attached is my crashing version. All I did was make the necessary command name change (freemap is named tmx_DeleteMap now) and I added a few lines for keyboard support, but that shouldn't affect the loading of the maps.

Choose iso or staggered and you should get an error. Zelda and ortho should be okay.

Attachments

Login to view attachments
Lost Dragon
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 26th Feb 2014 05:52
Is there a function to get a tile's sprite or "gid" using (x,y) grid coords?

I thought tmx_GetTileIndex would be what I wanted but it isn't.

What I'm trying to do is detect which tile the player is standing on so I can do things like make a certain sound effect or slow him down, etc.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Feb 2014 14:49 Edited at: 26th Feb 2014 17:28
I'm taking a look at it this morning. It's the first I've really looked through Clonkex's new code. I can confirm your error and I believe it has something to do with a new array he's using, though I'm not quite sure the need for TMX_Tiles[] when TMX_Map[] holds the tiles.


Base64 (uncompressed) support looks like it could be easier to implement than I thought. Doing it now!

Well, I've now wasted 2 hours on getting it to work. The problem is decoding to a byte array and not ascii, otherwise any tiles with a gid of 0 are getting ignored which then throws off the entire thing.

Lost Dragon
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 26th Feb 2014 18:09
Thanks for having a look at it.

Is 0 what's assigned when no tile is placed in the map editor?

I'm still attempting to make a function that will work out what sprite is under the cursor. Since tile properties haven't been implemented yet that is the only way I know to implement any terrain effects (lava, swamp gas, rough terrain, etc.) - check what tile is under the player and then alter his movement (or do damage) based on what he's standing on.

I need more sleep to conquer this. LOL.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Feb 2014 18:38
This should get you the sprite associated with the specified tile.



And I now officially have base64 encryption (uncompressed) implemented and working. It seems ok with small files, but large maps such as my zelda overworld take a few minutes to load. The main problem I see is the fact that the base64 data is a single string. AppGameKit handles the 400 character string in the example map just fine. The 120k character line is posing a problem. What I might have to do is load the TMX file into a memblock first then work with it that way, maybe it'll be faster with the decryption.

Lost Dragon
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 26th Feb 2014 18:59
Dude. You are a coding machine.

TGC should pick this up and highlight it if hasn't been already. It's a significant chunk of code that has some nice features.

Is the base64 encoding basically used to obscure map details from curious players?
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 26th Feb 2014 19:25 Edited at: 26th Feb 2014 19:26
If you look at the xml format, each layer has a data tag which contains many TILE tags. A tile tag for each square in the map. The example map has 20x20 tiles, so each layer (all 3 of them) contains 400 tile tags in the data. The overworld map has a total 22,528! The only thing these tags store is the gid. It's wasting a lot of space by repeating <tile gid=" "/> over and over. The base64 encryption doesn't store all that text and instead only stores 4 bytes for each tag to represent the gid. That effectively trims 14 bytes per tile. This data is the only thing that gets encrypted. So it's not so much for obfuscation as it is for compressing the file size.

My overworld map saved in plain xml is 867kb. With base64 it's cut down to only 242kb. That's less than 1/3 the original size! The example map went from 23.8kb to 7.57kb. Again, about a 1/3 of the size.

Lost Dragon
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 26th Feb 2014 19:44
Ah okay. I would have thought that the smaller size would load faster, but I guess having to decode it makes up the difference.

If you're on a PC it wouldn't matter so much but for mobile devices that have limited space I see the utility.

Cool.
Lost Dragon
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 26th Feb 2014 23:30 Edited at: 26th Feb 2014 23:57
I tried the code you posted.



It's giving me a different number for each block.

Eg output: grass at 1,1 is 10005, same grass graphic at 1,2 is 10030

That is the kind of output I got when I tried to make the function too.

What I was trying to get (and didn't succeed) was some code that would allow me to do something like...

If sprite(x,y) = 1 then grass_walk_normal
If sprite(x,y) = 2 then mud_walk_slow

So if I pointed at grass at 1,1 it'd report tile block 1.
If pointed at grass 10,15 it'd report tile block 1.
If pointed at grass at 400,400 would report tile block 1.

If I pointed at mud at 20,20 it'd report tile block 2.

And so on.

I achieved this with my own map format but I don't understand the functions here or how to access the tiles once they are drawn out.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Feb 2014 05:52
Each tile is a different sprite so yea it'll be different numbers. And technically, they all use the same image. So what you really want to check is the sprite frame. (yup they're animated sprites)

I believe the command is getSpriteCurrentFrame()

Lost Dragon
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 27th Feb 2014 18:56 Edited at: 27th Feb 2014 20:46
*edited with fixed code*




That will give you the tile sprite ID under the mouse cursor (using Phaelax's example maps). Note: some of the maps in the example code have multiple layers. If the sprite ID is not reported like you think it should the object you're mousing over is probably on a layer besides 1 (which is all this code looks at).

You can use that to tell what terrain a character is standing on. An example of use would be doing damage to a player because he's standing on a lava block.

It would probably be simple to make a function out of it.

Feel free to include it in your library update if you do one later. It seems like something that people will want.

Thanks for the assist. I'll go play with this library some more. Being able to load up tmx files is really nice.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 27th Feb 2014 20:43
Add these functions to the library, they might help ya.



Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 2nd Mar 2014 11:50
Quote: "your revised loader the iso and staggered loading modes both appear to be broken."


I thought it would be. I didn't even test that.

Quote: "I thought tmx_GetTileIndex would be what I wanted but it isn't."


What did you want?

Quote: "And I now officially have base64 encryption (uncompressed) implemented and working. It seems ok with small files, but large maps such as my zelda overworld take a few minutes to load."


Oh, do share!

Quote: "The main problem I see is the fact that the base64 data is a single string. AppGameKit handles the 400 character string in the example map just fine. The 120k character line is posing a problem."


I have an idea as to how to get around that, but I don't want to tell until I know if it's a really dumb idea

Sorry for disappearing for all this time - my computer died and I had to spend $700 replacing the great bulk of the parts... On the up side, I now have a much better PC

Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 2nd Mar 2014 18:45
Ouch, that sucks!

Quote: "Oh, do share!"

You can find it in my updated code here. I also added CSV support as well, using AGK's token commands made it really easy.

I'm thinking the extra long string I could perhaps read the file into a memblock and work from it there.

3d point in space
15
Years of Service
User Offline
Joined: 30th Jun 2009
Location: Idaho
Posted: 2nd Mar 2014 19:53
hu i thought people would like to look at what I did for a tmx loader oh well I do not care. I could not fix the parts of animation in my program so I decided to make it free. The tmx part still works though and it makes the files into agk files with x,y properties.

Its a lot faster to make a save file with agk with that program that he provided than open a tmx up. I measured the speed and it is 3 times as fast. Because all your loading is x y cords and the sprite sheet number instead of the hole tmx.

Developer of Space Chips, pianobasic, zipzapzoom, and vet pinball apps. Developed the tiled map engine seen on the showcase. Veteran for the military.
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 3rd Mar 2014 03:09 Edited at: 3rd Mar 2014 03:47
Quote: "Ouch, that sucks!"


Indeed, but as I say, I can now play AC3, GTA4, Minecraft and a huge number of other games smoothly on medium-high graphics! I can even FRAPS Minecraft and maintain 120fps!

Quote: "I'm thinking the extra long string I could perhaps read the file into a memblock and work from it there."


That sounds like a good start.



Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 4th Mar 2014 00:40
Just a little tidbit of info, image layers and objects layers really are no different than the regular map layers. You shouldn't need to maintain separate arrays for each type.

Lost Dragon
14
Years of Service
User Offline
Joined: 22nd Aug 2010
Location:
Posted: 6th Mar 2014 18:59
Quote: "Quote: "I thought tmx_GetTileIndex would be what I wanted but it isn't."

What did you want?"


What I wanted was the sprite ID of the tile, but I got it worked out.

I can load a bunch of tile properties from a text file and compare my list against whatever the player is standing on to check for terrain movement.
Clonkex
Forum Vice President
14
Years of Service
User Offline
Joined: 20th May 2010
Location: Northern Tablelands, NSW, Australia
Posted: 10th Mar 2014 05:28
Quote: "Just a little tidbit of info, image layers and objects layers really are no different than the regular map layers. You shouldn't need to maintain separate arrays for each type."


I kinda do. I'm not sure how else each layer would record its contained items without duplicating variables unnecessarily. Well, I suppose I can think of a way, but even then it uses more memory. It's mostly to save on memory, and besides, it's not difficult in the least having multiple arrays.

Login to post a reply

Server time is: 2024-11-25 18:55:46
Your offset time is: 2024-11-25 18:55:46