Tileset image-based map loader

This forum is currently in read-only mode.
From the Asset Store
Hand-animated Sprite Base for isometric game/animation development
  • So I'm working on a tile-based map system. It will (eventually) load tiles from an array specified in an ini, though I haven't got around to that yet because of one rather big problem.

    So I'm using Image Manipulator to load the tileset image in data/tiles/debug.png. Then I cut the tiles up using crop. Then I use Image Manipulator to copy its image onto a sprite. But once I do this, every instance of that sprite uses that image, overwriting the previous one. I don't want this. I want the sprite to have a unique image when it is created, but I don't know how to do it. Should I even be using the sprite object? I don't know.

    Anywhere, here's the project folder with the .cap. If you can find the time, please take a look at the events in the Engine layout and tell me what I'm doing wrong that causes this to happen.

    http://dl.dropbox.com/u/28629176/gamedev/game.zip

    I also noticed that my "Tiled Background" object isn't tiling at the correct size. Though I'm using events to load a 24x16 image (in data/floors/tiles.png) into it, it tiles at 23x15. This doesn't exactly halt the progress of the project but is there a way to fix this, too?

    Thanks anyway.

  • You're better off using a tiled bg object for your tileset and image offset to get your tiles!

  • You're better off using a tiled bg object for your tileset and image offset to get your tiles!

    What are the implications on memory usage for loading the tileset texture for every tile, though?

    EDIT:

    So it's definitely not possible it seems. I don't like the idea of loading the tileset texture into, maybe ~1000 tiled background objects and I don't think it would work anyway since I'm using irregular 24x16 sized tiles. Any other bright ideas on how tile maps could work in Construct?

  • I'd load every single tile into a sprite animation. You could save a lot of events by looping through the frames. I'd suggest you take a look at the (old) forums, too.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • > You're better off using a tiled bg object for your tileset and image offset to get your tiles!

    What are the implications on memory usage for loading the tileset texture for every tile, though?

    EDIT:

    So it's definitely not possible it seems. I don't like the idea of loading the tileset texture into, maybe ~1000 tiled background objects and I don't think it would work anyway since I'm using irregular 24x16 sized tiles. Any other bright ideas on how tile maps could work in Construct?

    You didn't get the idea. You'd create just one tb-object and load the tileset into. Then you use as many instances of this tb as you need. In your example, every tb instance would have that 24x16 size while the actual tile from the tileset is selected in runtime using the image offset actions of the tb. Picking of the tb-instance can be done in various ways (for each-loop, pv, uid, etc.). This way you will have exactly one copy of the tileset in VRAM. This method is more or less what you would use in tilebased game makers.

  • Thanks for elaborating, Tulamide. I was on my phone and didn't want to type all of that out ^^;

  • looks like I'll at least have to hold onto the Image Manipulator object to check the tileset image size

    but Tiled Background's set offset isn't even doing anything for me, I'm calling it but nothing is happening

  • The texture must be a power of 2 size for image offset to work. You can use empty space if needed.

  • The texture must be a power of 2 size for image offset to work. You can use empty space if needed.

    I can't say I like that or having empty space but at least it works

    Now there's only one problem left:

    <img src="http://dl.dropbox.com/u/28629176/gamedev/wrong_tiling.png" border="0" />

    Why does this happen?

  • Eh..that's interesting. Might be due to the weird size. Tiles in general are 8x8,16x16,32x32, and so on.

  • Would be interesting to have the original, because I couldn't reproduce it. Loaded several 24x16 images and the tb always tiled them correctly, no lines missing.

  • Are those images taken from the layout editor or from the running game? If the zoom level in the layout editor is like..165 or something, then stuff like this will happen.

  • Ah, my bad. Solar is right. I just tested in edittime, where everything's ok. But in runtime it tiles after 23 and 15 instead of 24 and 16. Never noticed that before. I always work with n� textures for the tb, and those work.

    So, to get them tiled 24x16 you need to add one row and column (paint a 24x16 tile on a 25x17 canvas)

  • okay well I can't get the tiled background object to load an image at runtime that applies to every instance of that object. I have to do it for every single tiled background object when it is created which causes the VRAM usage to inflate like crazy (~120mb for a 2D game I am #1 optimizer). what am I doing wrong?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)