Jibble

Author Topic: MODULE: Tilemap v1.0 - module for easing tile-based game creation.  (Read 5559 times)

Wyz

  • anno 1986
    • I can help with making music
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • I can help with web design
    • Wyz worked on one or more games that won an AGS Award!
    •  
    • Wyz worked on one or more games that was nominated for an AGS Award!



This module contains a set of useful functions for creating tile based games. It allows tilesets (a sprite containing tile images) to be defined and used to draw tilemaps (a map that defines which tile should be drawn where). It contains simple and a bit more advanced functionality and tries to ease the amount of work needed to make a tile based game with AGS. The module is self documented: that means when using a function in your code the autocompleter will popup with an hint what the function does and how to use it. All functions in this module start with "Tilemap" so they can be recognized easily. You can also check the script header file to see the complete list of available functions.

I will put useful code snippets in this post later but you can also request them!
If you have questions about how to use this module or have comments feel free to post here!

I hope that it will be useful to someone. :-D
« Last Edit: 20 Jan 2020, 12:46 by Wyz »
Life is like an adventure without the pixel hunts.

Ghost

  • AGS Baker
  • Rottwheelers
  • Time to give up.
    • Ghost worked on one or more games that won an AGS Award!
    •  
    • Ghost worked on one or more games that was nominated for an AGS Award!
I bet there'll be some future games taking advantage of this! Thanks for sharing; I'll surely check it out (nod)

Greetings, Wyz,

I'm trying to understand this module because I need it to create mini-games and turn-based battles like Heroes of Might & Magic.
I haven't succeded yet.
Could you please make any nebut sleek demo to make it easier to understand?

...Maybe one room where the tiles move and interact with each other.. 

Wyz

  • anno 1986
    • I can help with making music
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • I can help with web design
    • Wyz worked on one or more games that won an AGS Award!
    •  
    • Wyz worked on one or more games that was nominated for an AGS Award!
Sure, I'll whip something up. :-D

Update:
I tried to keep it simple but I might have gone a bit overboard with the scrolling. It is just a sample of what you could do but is not necessarily what you want or a good example what this module can do. It needs AGS 3.2.1.
Tilemap example v1.0.0
« Last Edit: 20 Jan 2020, 12:48 by Wyz »
Life is like an adventure without the pixel hunts.

DoorKnobHandle

  • Mittens Serf
    • DoorKnobHandle worked on one or more games that won an AGS Award!
    •  
    • DoorKnobHandle worked on one or more games that was nominated for an AGS Award!
Nice work, should help a lot of people out, especially those interested in making an RPG with AGS! Also, that is the best 8x8px stickman sprite and walkcycle I've ever seen! :)

Baron

  • Mittens Serf
  • AGS Baker
  • Rottwheelers
  • Not-so-Evil Banana Dictator
    • I can help with AGS tutoring
    • I can help with voice acting
    • Best Innovation Award Winner 2011, for the concept and management of SWARMAGS
    • Baron worked on one or more games that won an AGS Award!
    •  
    • Baron worked on one or more games that was nominated for an AGS Award!
Tilemap example v1.0.0

This link seems to be dead.  Can I have another?

miguel

  • Onions? Give me back my onions!
    • miguel worked on one or more games that was nominated for an AGS Award!
Working on a RON game!!!!!

Wyz

  • anno 1986
    • I can help with making music
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • I can help with web design
    • Wyz worked on one or more games that won an AGS Award!
    •  
    • Wyz worked on one or more games that was nominated for an AGS Award!
« Last Edit: 14 Jun 2014, 16:05 by Wyz »
Life is like an adventure without the pixel hunts.

Tournk

  • I have this talent of being boring.
    • I can help with characters
    • I can help with story design
 Nice. I'll soon find a use for this module after learning how.  :)
Reaction is always funny.

Tournk

  • I have this talent of being boring.
    • I can help with characters
    • I can help with story design
This module is amazing! But how do you create the map from the tiles? I don't see any in the room script. Or the .TMX file that does it? ???
Reaction is always funny.

Wyz

  • anno 1986
    • I can help with making music
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • I can help with web design
    • Wyz worked on one or more games that won an AGS Award!
    •  
    • Wyz worked on one or more games that was nominated for an AGS Award!
Well, I did this manually by just typing in the values but I can see how that is inconvenient. ;) But if you want I can write an exporter. :)

Btw the TMX files can be opened with Tiled.
Life is like an adventure without the pixel hunts.

Wyz

  • anno 1986
    • I can help with making music
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • I can help with web design
    • Wyz worked on one or more games that won an AGS Award!
    •  
    • Wyz worked on one or more games that was nominated for an AGS Award!
So I've wrote an exporter, or actually a converter to be more precise.
It takes TMX files and turns it into something you can load into your project. Ok so how does this work? Well first you make a map with one of your favourite tile editors and save it as a .tmx-file. This is a pretty wide supported format so I expect most editors can do this; Tiled can for sure.
Then you select that file in the converter and hit 'Convert' (more detailed instructions are in the readme file of the zip). What tis does is create an image file you can import into you project as a sprite. The module as a few functions to handle maps in sprite format: convert it to regular tilemaps so you edit them in game or directly draw it on a surface. That's about it, so check it out!
« Last Edit: 09 Sep 2014, 17:26 by Wyz »
Life is like an adventure without the pixel hunts.

arj0n

  • Mittens Vassal
  • art consists in drawing a line somewhere
    • arj0n worked on one or more games that won an AGS Award!
    •  
    • arj0n worked on one or more games that was nominated for an AGS Award!
Will check this out for sure, interesting stuff wyz.

Sorry to bump this... Can you upload the Convertor again, please?

Wyz

  • anno 1986
    • I can help with making music
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • I can help with web design
    • Wyz worked on one or more games that won an AGS Award!
    •  
    • Wyz worked on one or more games that was nominated for an AGS Award!
Sure no problem, I've updated the link in the first post. :)
Life is like an adventure without the pixel hunts.

So I've wrote an exporter, or actually a converter to be more precise.
It takes TMX files and turns it into something you can load into your project. Ok so how does this work? Well first you make a map with one of your favourite tile editors and save it as a .tmx-file. This is a pretty wide supported format so I expect most editors can do this; Tiled can for sure.
Then you select that file in the converter and hit 'Convert' (more detailed instructions are in the readme file of the zip). What tis does is create an image file you can import into you project as a sprite. The module as a few functions to handle maps in sprite format: convert it to regular tilemaps so you edit them in game or directly draw it on a surface. That's about it, so check it out!

Quick question. If I make my maps in Tiled and use the converter, will the collisions and layers be converted as well, or just a flat image?

Wyz

  • anno 1986
    • I can help with making music
    • I can help with story design
    • I can help with translating
    • I can help with voice acting
    • I can help with web design
    • Wyz worked on one or more games that won an AGS Award!
    •  
    • Wyz worked on one or more games that was nominated for an AGS Award!
The exported maps contain a single layer each but the converter lets you select a layer so you can convert them all separately if you want to. As far as I can tell collisions are just layers so that should work as well.
A limitation of the module is it only supports one tileset per map so if you're planning maps that is something to keep in mind. It also does not support objects at all unfortunately. :)

I hope that helps. :)
Life is like an adventure without the pixel hunts.

Would anyone accept a commision to add features to this existing module or create a new tile engine with additional features?