Terrain rendering via mysql.

Post your questions, suggestions and experiences regarding to Image manipulation, 3d modeling and level editing for the Irrlicht engine here.
Post Reply
Blake
Posts: 4
Joined: Sun Jun 25, 2006 2:55 am

Terrain rendering via mysql.

Post by Blake »

I'm wondering whether its possible to render a terrain via a mysql database.
I plan to have the table looking like, (x,y->,z1,z2,z3,z4[sections of each tile])

x,y = tile by tile
z1 -> z4 = Height.

If i have a tile with four corners, then each would be assigned z1 -> z4,
_____
|z1---|z2
|------|
|z3__|z4

That would enable the terrain to be manipulated by the players later on(Planned.) each tile is proposed to be 1m squared, and each tile will hold 16 individual squares.(for 'more precise location mapping'[when someone logs off, they log on in roughly the same position])
_______
|_|_|_|_|
|_|_|_|_|
|_|_|_|_| This is whats seen in '1 square'(maybe?)
|_|_|_|_|

is there anything i should be reading up on about this? i plan to have the environment 100% terraformable. and yes, its going to be multiplayer.

Blake. - I'm unsure on whether or not i put this in the right section, feel free to move it if I'm in the wrong.

Heres a picture to help clarify what i mean?
http://img223.imageshack.us/img223/6890 ... 538ab7.jpg
killthesand
Posts: 42
Joined: Sat Sep 29, 2007 3:33 am
Contact:

Post by killthesand »

It sounds like you want to generate a terrain mesh using data from a database rather than from a height map. I don't see any reason why you couldn't do that so long as you're up to the challenge of writing the custom scene node to process the data.

Why do you need to use a mysql database? Is the only reason for using a database so that you can quickly edit the data? If so, why not use the regular terrain scene node and look into an imaging library, like CImg? You could have your Z values stored in a 2d array. When it's time to modify the values, save the array as a single 8-bit channel targa image, drop the old terrain, and create a new one with the new height map.

Either way, you may have some issues to work out when updating the terrain. If you're doing collision detection against it and it moves, objects could potentially fall through it. If you're using small terrain tiles, when one of them moves, you need to update its neighbors to prevent gaps. I don't really know the big picture of what you're trying to build, but I can already imagine some difficulties you may encounter.
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

Yes I would seriously recommend considering the bulk-data image option versus the SQL one, it would get insanely slow insanely fast. It's really not too much trouble to modify an image and recreate it, you can store the image itself inside an SQL database as BLOB data so you can chop it up into seperate pieces and modify individual sectors of the terrain.

I also recommend using SQLite as that runs-inprocess, meaning you don't have to transfer data back and from the seperate MySQL server. Its also alot more lenient on the licensing.

Cheers
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
Post Reply