Jump to content
  • Advertisement
Sign in to follow this  
winsrp

XNA 4.0 voxel map rendering, using noise techniques

This topic is 2482 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

First of all, HI all,

Second of all, I know and I'm fully aware I'm a newb on game creation.

I have programmed desktop applications for quite a while now (more than 7 years) and I wanted to make something in the gaming department.

I have tons of ideas, but I know that in programming you need to start by building a very strong foundation otherwise the whole thing would be crap.

Now I don't like c# much, even I can read it, program it, use it and all that, but I like vb.net better (personal preference), so I made my project for xna 4 which has a ground in c#, but then I made my game class in vb importing the same libraries and everything works like a charm thanks to the bless of the .net framework. I don't really care to do all the nasty conversions from c# to vb.net, actually they help me to understand the code better, instead of just copy paste.

I've made like 7 tutorials already of XNA 4.0, with lots of great techniques, and I decided that seems like time to start shaping my own game.

Having said that, I decided that my world would be made out of cubes, which will make destruction, movement and generation of new cubes by the player a rather simple operation, as they wont have weird shapes.

And as such the first thing i wanted is terrain + camera.

I've made a cube array of 32x32x32 (x,y,z), using y as height and made my camera to go around. Now with a couple simple rules, you can set, the first 4 y layers to be ground, and above it, to be air.. also made some optimization's, to have the renderer only display the vertices of the cubes that can be seen on the top layer, hiding all the vertices that are below other cubes. I still need to optimize it further so only the vertices that are on screen are displayed but that will be done in the following days.

Now the first thing that occurred to me was using a height map, which seems simple enough to start playing with the camera a little (I still, don't have gravity not hit-boxes, so the camera is only to see what is the result. Now the result is nice, and i have already tried it at a 1024x256x1024 scale, and it looks even better, but seems like missing lots of details, so 2 problems arise from this

#1 the mountains are way too smoothed.
#2 I am limiting the bounds of the map to the amount of x and z that I put on my array, currently 1024x1024, and you can see from side to side, not to mention walk from side to side in less than a minute.

For problem #1 I investigated on lots of techniques, currently read more than a hundred articles (not exaggerating here, currently have more than 150 tagged pages on this topic), and I would like to know how can you create something like this

http://www.gamedev.n...type-world-gen/

in XNA 4.0 as i have found lots of code, but have not yet fully understood the meaning of all the terms, and the combination of techniques to get this result, plus I would like to remove the floating islands that I have seen in some examples.

For problem #2, well, I first need to figure out how to get #1 done, and then how can I ask for a single [x,z] coordinate to get the array of next set of [y] cubes in any given direction, that will match the previews section.

Thanks all,

Winsrp.

Share this post


Link to post
Share on other sites
Advertisement
hmm... no love for the new guy,

I know that when your post gets to the second page, you better post an update to it, otherwise its dead.

I have managed to kind of get over problem #1, and definitively over problem #2, now the only problem i seem to have is the gradient to display more ground on the bottom and move air on top, which i have already tried like a 100 combinations and I cant get it to work..

Here are 5 sections in a cross array.

[attachment=6830:Test1.png]

Share this post


Link to post
Share on other sites
ok so I managed to start using the libnoise, (as I was using something else), but I still haven't figured out how to make a gradient kind of map to load more ground on the lower half than the upper half.

Any ideas? as Libnoise seems to be rather popular, then I would think I might get a little more help here.

Share this post


Link to post
Share on other sites
still not getting over the gradient map terrain, but i did some funny stuff, and stumble upon another interesting issue I'm shooting red balls at my terrain, when the ball hits the terrain then that block gets removed from the map. Really simple collision detection here. but it does something weird.

I've set up a test terrain of only 8 blocks on a 2x2x2 array to set out.

when i shoot the block somethings on screen it removes 2 blocks but checking on the buffers lists and all, it says it only removed one block, and the vertex and index buffer all say it only removed 1 block, still on screen 2 blocks are removed....

on the update method i check for collision and and then i clear the list that contains my vertices and indexes and refill it with the list.toarray that contains the new list of the remaining blocks, everything seems fine from the debuging stand point but not all blocks are displayed, even further more, at some point the missing blocks start to show up again... very weird.

Share this post


Link to post
Share on other sites
Update: Never mind it was me being stupid, and not updating the indexes. So when you remove a block you need to recalculate the indexes as vertexes are not in the same order as they were before.

This is a section with no vertex optimization.

[attachment=6886:working section.png]

Share this post


Link to post
Share on other sites
does anyone know how to make some fast collition detection? I can check for sections and then blocks on each section, which allows me to shoot around 250 parallel bullets but if a single one touches the ground.. the game kind of stalls.

here a screen of several sections together and some holes from my bullets.

[attachment=6892:working group.png]

Share this post


Link to post
Share on other sites
and i have another question, hopefully ill get some hints on this one..

If i want to use perlin noise with different frequencies, but on the same map making it smooth, how can I make them fit together without looking like pasted in and cut.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!