3D tile engine
-
Chris.Bailey
- Posts: 9
- Joined: Thu Aug 14, 2008 7:20 am
3D tile engine
Hello everyone! I've got a project in mind but I am having a bit of difficulty getting started with it. I have been reading through the forum for several hours trying to find an example or any bit of information that would prove useful and I have been mostly unsuccessful. What I would like to do is create a simple way of displaying a small 3d map in the style of traditional "tactical" rpgs. More importantly than just displaying this map, each sector or "tile" needs to contain a large amount of information. In the languages I am used to I would probably just create a sector class that contained the texture information and whatever other variables I might find necessary along with a few methods for changing that information. Then I would populate a multidimensional array with instances of that class. Is that the kind of approach I should use for C++ and Irrlicht? Any help that could get me started would be much appreciated and I apologize for the newbiesh question.
PS: If I've missed something in the documentation and/or on the forums that would explain this to me feel free to flame me =)
PS: If I've missed something in the documentation and/or on the forums that would explain this to me feel free to flame me =)
If you have to ask this question, then no, you obviously lack the creativity and open-mindedness.Is that the kind of approach I should use for C++ and Irrlicht?
That being said, create a hillplane scene node, and individually raise/lower the vertices to create a "tile" effect. I'm guessing you want something like this?:

Also check out the game "Warchief's Warboard" in the project announcements forum.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
-
Chris.Bailey
- Posts: 9
- Joined: Thu Aug 14, 2008 7:20 am
The reason i asked what the purpose of your tile idea was that you dont' really need it for building up your scene, you'd only need it for things like moving NPCs around or things like that, or if you've got a large world you can split it into tiles and hide ones that you don't want rendered to improve performance.
-
Chris.Bailey
- Posts: 9
- Joined: Thu Aug 14, 2008 7:20 am
Blindside - I'm looking through the API and I can't find the Hillplane scene node. I found hillplane mesh but I'm not sure if they are the same thing. If the mesh IS what you referenced then I have another question. I noticed that you could specify a tile size and the number of tiles when you initialize the mesh. How do you address an individual "tile" afterward, does it work like an array?
-
Chris.Bailey
- Posts: 9
- Joined: Thu Aug 14, 2008 7:20 am
JP - The main reason I wanted to use "tiles" was that I thought it would simplify things like path finding, character movements etc. I am *very* new to 3d programming and not familiar with the terminology so you will have to excuse me if I am easily confused or if I don't make much sense.
1. I will need to store information relevant to each "tile" on the map. Things like the type of terrain, the texture that should be applied to it, characters that are currently on the tile etc. (I think this would be the best way at least).
2. The maps will be very small in size compared to most of what I have seen in 3d games. Each tile will be large enough for a single object or character and a map will be at most 40x40 tiles.
1. I will need to store information relevant to each "tile" on the map. Things like the type of terrain, the texture that should be applied to it, characters that are currently on the tile etc. (I think this would be the best way at least).
2. The maps will be very small in size compared to most of what I have seen in 3d games. Each tile will be large enough for a single object or character and a map will be at most 40x40 tiles.
Maybe someone else can say whether a tile system is useful for map layouts but personally i think i'd just use IrrEdit to construct my scene and get a list of the relevant objects from that like things that can be picked up and then handle them in game based on proximity.
A tile approach could be good for simple AI, it's what i did in my dissertation for FPS AI, but it wasn't very realistic looking for that as the NPCs moved N,S,E,W in a grid based fashion, i guess you could do NE, SE, etc as well to improve the look of it though. Another approach for pathfinding is to use waypoints, check out my IrrAI project in the projects forum, might be of some use to you possibly.
A tile approach could be good for simple AI, it's what i did in my dissertation for FPS AI, but it wasn't very realistic looking for that as the NPCs moved N,S,E,W in a grid based fashion, i guess you could do NE, SE, etc as well to improve the look of it though. Another approach for pathfinding is to use waypoints, check out my IrrAI project in the projects forum, might be of some use to you possibly.
-
Chris.Bailey
- Posts: 9
- Joined: Thu Aug 14, 2008 7:20 am
Thank you for the replies JP. Unfortunately I can't get IrrEdit working in Wine OR Caldega so I guess I'm out of luck. The only computer I have with windows is my wifes laptop. That sort of simple AI would be exactly what I need when it comes to movement. The whole thing would revolve around grid based movement. I am basically trying to reproduce a semi-popular form of 2d system with the power and flexibility of a 3d engine.
Thinking about it now, just make a 2d array arrangement of CubeSceneNodes, and scale them on the Y axis up/down to create a height field type thing.
I think a tile system would simplify path finding since you could use some grid based techniques such as wavelet etc, without having to manually place waypoints.
Cheers
I think a tile system would simplify path finding since you could use some grid based techniques such as wavelet etc, without having to manually place waypoints.
Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
-
Chris.Bailey
- Posts: 9
- Joined: Thu Aug 14, 2008 7:20 am
Simply using cube scene nodes could be rather expensive, i found that when trying to create a maze from cube scene nodes, though i used like 25 cubes for one small section of wall, lol, young and naive...
But it's a good idea and could be made more efficient by sticking the cube nodes into a single (or fewer) mesh buffer, based on the texture used on them of course.
But it's a good idea and could be made more efficient by sticking the cube nodes into a single (or fewer) mesh buffer, based on the texture used on them of course.
-
Chris.Bailey
- Posts: 9
- Joined: Thu Aug 14, 2008 7:20 am
I think that it will be ok as far as resources are concerned since it will be a relatively small amount of cube nodes. I've run into a little bit of a problem though when it comes to address each cube node. Let's assume the following.
The problem I'm having is that I need a way to reference each individual cube node but I'm not sure how they are listed. Can you define an ID when it's initiated, are they all contained in a list somewhere? And most importantly how do I access them? 
Code: Select all
struct sector
{
int x;
int y;
int z;
};
sector map[10][10];
for (int x=0; x<10; x++)
for (int y=0; y<10; y++)
smgr->addCubeSceneNode()
Now how do I reference that cube to change it's position and scale?
