Page 1 of 1

Tile based map

Posted: Wed Feb 21, 2024 6:54 pm
by tBane
Hi.
I am newbie in Irrlicht and I need a create Tile based map.
How do this?

Image

Re: Tile based map

Posted: Wed Feb 21, 2024 7:19 pm
by CuteAlien
You seem to be doing it already in your other thread? It didn't looks so bad. There you seem to have created one node per tile. Which is one way to do it. The other way would be to create a node which contains all tiles and has functions to access them. But unless the world is really huge it doesn't matter too much which way you do that. What are you stuck with?

Re: Tile based map

Posted: Wed Feb 21, 2024 7:24 pm
by tBane
I need a example because i am newbie in Irrlicht and no know how start.
I need a tile based map which services collisions

Re: Tile based map

Posted: Wed Feb 21, 2024 7:43 pm
by Noiecity
It depends, will you use 3D geometry or use 2D sprites? In any case, the most optimal way, although it requires more work, is to write the coordinates, and based on those coordinates to write the conditions, but this usually carries much more work

Re: Tile based map

Posted: Wed Feb 21, 2024 7:51 pm
by CuteAlien
I'm a bit confused as you already seem to have one in the other thread. Which looks pretty nice with just the collisions missing. And I already gave you 2 solutions how to write those. Maybe just try first if you can implement one of those. And when stuck with it ask more questions?

edit: With the picture you just added - that looks a bit more complicated. Doesn't seem to be simple tiles. Thought adapting your original code still probably good way to approach it. Not sure as the transitions look like they were done with some clever algorithm.

Re: Tile based map

Posted: Wed Feb 21, 2024 8:02 pm
by tBane
I'm trying to create this map. I have the coordinates. I don't know how to correct start creating a map using Irrlicht.

Re: Tile based map

Posted: Wed Feb 21, 2024 8:31 pm
by CuteAlien
Yeah, that one is a bit interesting due to the transitions between the tiles. Which tile will be selected when you click one of the transition polygons?

There is also different ways to approach this. Using one tile per node seems tricky for this. For the 6 sides you could say half the side for connecting polygons belong to each tile. But the triangle gap polygons... no idea to which node they would belong to.

So I'd likely create a single mesh for the whole map and re-create it each time one of those tiles changes height (just assuming they do). Unless it's too expensive (depends again on size). And then write my own collision routines (just check ray against each triangle and then figure out to which tile each one belongs).

At least that's what I might do if it only uses vertex colors as in your image above. With different texture per tile this map will get a lot more complicated.