Paging terrain from heightmap data

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
wowdevver24
Posts: 26
Joined: Mon Jan 04, 2010 8:02 pm

Paging terrain from heightmap data

Post by wowdevver24 »

Hi,

I cannot seem to work out how to get terrain to load dynamically so I could load say a whole world from heightmap data as in world01_01.bmp up to say world99_99.bmp dynamically it's confusing as hell can someone help with some sample code on loading a set of heightmaps once you reach the edge of another

Here is a diagram of what I am trying to achieve

Code: Select all

[x] = loaded map tile(generated from heightmap)
[o] = not loaded map tile/unloaded map tile(to be generated from heightmap)
[p] = map-tile player is on

[o][o][o][o][o][o][o][o][o][o][o][o]
[o][o][o][o][o][o][o][o][o][o][o][o]
[o][o][o][o][o][o][o][o][o][o][o][o]
[o][o][o][o][o][o][o][o][o][o][o][o]
[o][o][o][o][o][o][o][o][o][o][o][o]
[o][o][o][o][x][x][x][o][o][o][o][o]
[o][o][o][o][x][p][x][o][o][o][o][o]
[o][o][o][o][x][x][x][o][o][o][o][o]
[o][o][o][o][o][o][o][o][o][o][o][o]
[o][o][o][o][o][o][o][o][o][o][o][o]
[o][o][o][o][o][o][o][o][o][o][o][o]
[o][o][o][o][o][o][o][o][o][o][o][o]
[o][o][o][o][o][o][o][o][o][o][o][o]
[o][o][o][o][o][o][o][o][o][o][o][o]

as you may be able to see in the diagram all tiles around the player are loaded so if the player moved to the right in the diagram the three tiles on the left of the players last position would be unloaded and three tiles on the players right would be loaded

the only thing I can think of at the moment is loading all the data into an array for every map tile using the in-built culling and hoping for the best, alternatively assuming the map goes from 01_01->99_99 the loaded tiles would be calculated relative to the players position

Code: Select all

//assuming players x & y co-ords are set
//load tiles (assuming if they are already loaded to leave them be)

//top row
loadtile(player.x-1,player.y-1);
loadtile(player.x,player.y-1);
loadtile(player.x+1,player.y-1);
//middle row
loadtile(player.x-1,player.y);
loadtile(player.x,player.y);
loadtile(player.x+1,player.y);
//bottom row
loadtile(player.x-1,player.y+1);
loadtile(player.x,player.y+1);
loadtile(player.x+1,player.y+1);
hopefully someone can help
Remember all information is contextual and if I do not understand the context I cannot gras the information
Grumpy
Posts: 77
Joined: Wed Dec 30, 2009 7:17 pm
Location: Montana, Usa

Post by Grumpy »

This looks like something I will be tackling after I figure out how to make my own terrain.
My best guess is each array will point to an andividual .bmp file on the server side, then transfered to the pc and load to scene manager as the character moves through the terrain.
theres veary little I can find on tiled terrain managers on the site so far (though a few discussion groups says so).
If you have other thoughts, as Ross Perot would say, "I'm all ears."
code happens
Post Reply