Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Why there is nothing explainable concerning tiled maps? — Gideros Forum

Why there is nothing explainable concerning tiled maps?

The examples is just a bunch of code... no coment... the program site also has no any support... Can't google anything 'cause I can't find anything anywhere... Don't understand that... Just wanted to show what I've created... How can I not do a so simple thing?

Likes: Apollo14, antix

+1 -1 (+2 / -0 )Share on Facebook
«1

Comments

  • Apollo14Apollo14 Member
    edited January 2018 Accepted Answer
    Hi @Paulo777
    As a new user of Gideros I can share some thoughts.
    When it comes to tutorials&documentation, Gideros looks newbie-unfriendly compared to extremely popular engines like Construct or Unity.

    But community&maintainers are extremely helpful. Any question here is answered within few hours, by people who actually develop Gideros. And it changes the whole situation.

    So Gideros looks unfriendly from the start, but wins at the end.

    When I have something to ask I try to use Google search, like:
    site:giderosmobile.com tiled
    Most of the time answers already exist on forum.
    If not, we can ask here, any question is answered withing few hours.

    https://github.com/1dot44mb/gideros/tree/master/tools/TiledAsWorldEditor

    Likes: antix, Paulo777

    > Newcomers roadmap: from where to start learning Gideros
    "What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
    “The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
    +1 -1 (+2 / -0 )Share on Facebook
  • SinisterSoftSinisterSoft Maintainer
    edited January 2018 Accepted Answer
    @Paulo777 - Tilemaps are great.

    The actual map data is a rectangular grid that can be huge - many screens in size. Think a Mario or Sonic size map or bigger. The individual x,y sections of the map are called 'tiles', in the old days we used to call them 'blocks'.

    The tilemap also needs to have a pointer to a texture. This is the graphic data for the actual map.

    You can change the x or y position of the tilemap and it will be clipped to the screen (or viewport). For example to scroll the screen left you would subtract from the x so its origin is more off the screen to the left and so on. Don't panic as like I said it's clipped so you are not really drawing off the edge of the screen.

    You can set a tile or clear a tile. When setting a tile you can also specify if the tile should be flipped in various combinations.

    A tile that has been cleared is not drawn at all - so if you have a map with a lot of empty sections then it will be drawn extremely quickly.

    Basically within Gideros what happens is that only the area of the tilemap that is currently on screen is analysed and then a single mesh is made of all the tiles that have been set for that specific area. That mesh is then the thing that is drawn.

    There are some helper functions for doing specialist games such as endless runners, this is a function to move all the blocks in a specific direction. You then just feed the edge with new data. This isn't a smooth scroll though - so inbetween needing to move and feed you would smooth scroll with the modulo of whatever the tile size is and so on. If you are not doing an endless map then you don't really need to worry about this though.

    Likes: Paulo777

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • antixantix Member
    Accepted Answer
    @Paulo777 Gideros has a steep learning curve compared to some other engines but the effort required is totally worth it. Once you are a bit more familiar with how stuff works you will be richly rewarded :)

    Having said all that, yes there could be better documentation and such, especially for things like TileMaps.
  • Paulo777Paulo777 Member
    edited January 2018
    Hello everybody really thank you for the responses... I have been learning from scratch from 0 and so on... I really found Gideros intuitive and practic to learn and apply, and I'm learning by the tutoriais in the Gideros site.

    Now I am stuck on this: TiledMaps. Because the only example that has, is the sewer and desert. It is made in an older version of the Tiled (program) and there is no any explanation on the code itself then I have no any Idea of what's going on in there.

    The Tiled program, I can generate .lua files... and in the lua files there is a lot of configurations of what I've done... However I have no any idea of how to manage it, show it, do whatever I want to do because there is nothing can find then I don't understand the code I don't know what to do then It is useless... I tried to use some parts of the code from the sewer/desert (tried to used the whole code) nothing worked it gives me errors that I don't know how It comes from... If you all have some light to me up I am greatly appreciated
  • offtopic: @antix, although i never used tilemaps, in many other aspects i find that the learning curve of gideros is actually far from steep, one of the best i've encountered. this may be subjective, i agree. yet, starting to develop with gideros is as easy as it gets, including testing on device. and starting to do the real programming work was also quite smooth for me (admittedly i was familiar with sprite hierarchies and events, coming from flash).

    Likes: antix

    +1 -1 (+1 / -0 )Share on Facebook
  • see video - the principles are the same

    Likes: Paulo777

    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
    +1 -1 (+1 / -0 )Share on Facebook
  • Open Sewer.lua in another editor to see the entire code



    image.png
    711 x 475 - 80K
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • Paulo777Paulo777 Member
    edited January 2018
    Sorry but this doesn't help... The matter is not how to do... but how to make all of it work in the gideros... what is what... tiles... tilessets... how to display it on screen... how to declare instances or if I can use directly... how to manage everything I've created... the matter is in the MAIN lua file... it is just BLANK... because I have no any ideia what to write on that
  • olegoleg Member
    edited January 2018
    see the example of sewer

    Look for the commands you do not understand in the documentation

    http://docs.giderosmobile.com/reference/gideros/TileMap/new

    start with something simple

    from studying tables

    with the study of sprites

    study of events

    I also recommend:
    https://www.packtpub.com/game-development/gideros-mobile-game-development

    Likes: Apollo14

    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
    +1 -1 (+1 / -0 )Share on Facebook
  • Thank you for the links... I'm studying and I got encouraged to go deeper on the sewer/desert code and facing the errors.. but has anyone got stuck on this? attempt to index field 'data' (a nil value) the line is local gid = layer.data[i]
  • @Paulo777 this error means that your table layer.data[i] has no value.(nil value) so when you try to assign it to variable gid it is raising an error hence that table pointer is nill.

    I strongly suggest you to start as simple as possible as @oleg suggests. Before diving into tiles code, try to study the basics like tables, parameters, scopes, gideros events , loops and logical operators and clauses,sprites . When you understand those it will be much more easy to understand and trace any code.
  • olegoleg Member
    edited January 2018
    Paulo777 said:

    Thank you for the links... I'm studying and I got encouraged to go deeper on the sewer/desert code and facing the errors.. but has anyone got stuck on this? attempt to index field 'data' (a nil value) the line is local gid = layer.data[i]

    here is a short test
    local map = require("sewers")
    print(map.layers[1].data[1])



    11.JPG
    696 x 273 - 63K

    Likes: Paulo777

    11.JPG 63.2K
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
    +1 -1 (+1 / -0 )Share on Facebook
  • Paulo777Paulo777 Member
    edited January 2018
    Hey... really thank you one more of attention aggregated for more understanding... Now I got to get it working. But there is a thing That I didn't get... My lua file has 4 layers and It just ignore the other 2 layers as it didn't really exist... I just want to know why it does happen... You can see... the print code show 4 layers but I set the for loop to 2 otherwise the compiler crashes... stating the error mentioned above...


    Capturar.PNG
    1040 x 545 - 345K

  • need to look at the code
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • Paulo777Paulo777 Member
    edited January 2018
    This is the level and the main .lua code
    lua
    lua
    level.lua
    8K
    lua
    lua
    main.lua
    2K

    Likes: antix

    +1 -1 (+1 / -0 )Share on Facebook
  • olegoleg Member
    Accepted Answer
    you do not have a table "data" in the Danger layer

    Likes: Paulo777

    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
    +1 -1 (+1 / -0 )Share on Facebook
  • Exactly! Really Thank You Over Again... Now I'm starting to take off!

    Likes: antix, Apollo14

    +1 -1 (+2 / -0 )Share on Facebook
  • Hello anybody!
    Doing some more tests I created a map a little bigger, but I'm having a trouble: it is not showing it entirely as has been built. I don't know if gideros supports only some resolution, some configuration... some light would be greatly appreciated
    lua
    lua
    level_1.lua
    36K
    Capturar2.PNG
    772 x 659 - 188K
  • in the data there are large numbers I guess the reason for them

    Снимок.JPG
    352 x 207 - 37K
    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
  • totebototebo Member
    edited January 2018 Accepted Answer
    The big numbers are tiles that have been flipped, the flip data is included in the number. I'm sure there is a reason for this deliberate obfuscation, but it confused me until I found the solution here.

    To get the actual values you can use this code:
    FLIPPED_HORIZONTALLY_FLAG @ 0x80000000
    FLIPPED_VERTICALLY_FLAG @ 0x40000000
    FLIPPED_DIAGONALLY_FLAG @ 0x20000000
     
    local flip_horizontally = bit.band(gid, FLIPPED_HORIZONTALLY_FLAG)
    local flip_vertically = bit.band(gid, FLIPPED_VERTICALLY_FLAG)
    local flip_diagonally = bit.band(gid, FLIPPED_DIAGONALLY_FLAG)
    local gid = bit.band(gid, bit.bnot(bit.bor(FLIPPED_HORIZONTALLY_FLAG, FLIPPED_VERTICALLY_FLAG, FLIPPED_DIAGONALLY_FLAG)))
    Then you can use these flags to modify the TileMap tile accordingly, using setTile():
    TileMap.FLIP_HORIZONTAL 
    TileMap.FLIP_VERTICAL 
    TileMap.FLIP_DIAGONAL

    Likes: oleg, Paulo777, antix

    My Gideros games: www.totebo.com
    +1 -1 (+3 / -0 )Share on Facebook
  • olegoleg Member
    Accepted Answer
    @totebo
    I make the data cleaner
    to the atlas I add 3 variants of the returned tile
    and after export, I delete these pictures

    Likes: Paulo777

    my games:
    https://play.google.com/store/apps/developer?id=razorback456
    мій блог по гідерос https://simartinfo.blogspot.com
    Слава Україні!
    +1 -1 (+1 / -0 )Share on Facebook
  • Paulo777Paulo777 Member
    edited January 2018
    Oleg and Totebo thank you over again!
    Totebo, it worked like a charm! It loaded all my map!

    Likes: totebo

    +1 -1 (+1 / -0 )Share on Facebook
  • Tricky! I haven't used or come across flipped tiles yet. Something to be aware of I suppose.
  • You might want to use the new bitwise operators rather than the bit library when dealing with the flipped tiles, etc, they should be faster.

    Likes: antix

    Coder, video game industry veteran (since the '80s, ❤'s assembler), arrested - never convicted hacker (in the '90s), dad of five, he/him (if that even matters!).
    https://deluxepixel.com
    +1 -1 (+1 / -0 )Share on Facebook
  • Hey, what 'bout using platform layer and background layer, for example: When I'm about to create a runner game, there is a layer with 'ground' to run on, and the 'sky', or 'cities' or anything behind. How is that in the layer. I've created some in the tiled program, but I have no idea of how to integrate it on the game as of 'rocks' to collide with, or 'enemies', coins... objects we create in the map that we can deal with it and manage actions in it... It's kinda hard to google it
  • antixantix Member
    Accepted Answer
    @Paulo777, So you have 3 layers...
    1. Background (your sky, cityscape, etc)
    2. Platforms (what the player jumps about on)
    3. Objects (the things that collide with the player like rocks and coins)

    Is that correct?
  • Yeesss! I can create it on Tiled, the Gideros documentation that @oleg posted has helped me, but I wanted to know how to use everything I've created on Tiled and manage it on Gideros. I'm making a spaceship shooter, and I managed to deal with the layers, I've learned here and digging in the code, testing I'm figuring out even better how Gideros works and how everything works I'm feeling amazed and learning a lot. But what if when I'm about to insert collision objects in the level? the Tiled documentation doesn't bring material on how to work with the code generated
  • @Paulo777 it's pretty hard to say how to add collision items without a clear explanation of how your tiled map is structured, and how your levels flow.

    So if the level has walls that your ship can crash into that's one kind of collision. If there's a layer that describes enemies and collectables then that's different too.

    Is your shooter side scrolling or forward scrolling?

    Maybe you are just generating enemies and stuff offscreen on a timer? That's also dfferent.

    It's very hard to present something that covers every condition I'm afraid.

    The best thing is to find out what is considered best practice for your chosen genre (SHMUP in your case) and follow that method.

    I'm sure if you can post something a bit more than "it's a spaceship shooter" we could totally help you more. Do you have a small design document that describes the game, and it's basic mechanics? It's always good to make one for each project you start, just so you can plop it out in a thread when you need a bit of help :)
Sign In or Register to comment.