Tile based map

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
tBane
Posts: 33
Joined: Wed Feb 21, 2024 2:25 pm
Location: Poland

Tile based map

Post by tBane »

Hi.
I am newbie in Irrlicht and I need a create Tile based map.
How do this?

Image
Last edited by tBane on Wed Feb 21, 2024 8:00 pm, edited 2 times in total.
CuteAlien
Admin
Posts: 9651
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Tile based map

Post 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?
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
tBane
Posts: 33
Joined: Wed Feb 21, 2024 2:25 pm
Location: Poland

Re: Tile based map

Post 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
Noiecity
Posts: 92
Joined: Wed Aug 23, 2023 7:22 pm
Contact:

Re: Tile based map

Post 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
**
If you are looking for people with whom to develop your game, even to try functionalities, I can help you, free and in an anonymous way if necessary. You can send me a private message.

https://www.artstation.com/noiecty
**
CuteAlien
Admin
Posts: 9651
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Tile based map

Post 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.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
tBane
Posts: 33
Joined: Wed Feb 21, 2024 2:25 pm
Location: Poland

Re: Tile based map

Post 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.
CuteAlien
Admin
Posts: 9651
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Tile based map

Post 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.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply