Jump to content
• Advertisement  # Behemyth

Member

9

233 Neutral

## About Behemyth

• Rank
Newbie
1. That is a pretty spiffy idea! Thanks to all who contributed.
2. To clear things up, the random shape that is placed on screen is not always solid. It sometimes has holes in it and I would need to have a way to fill those holes. Also, It would have to recognize what is a shape and only apply filling to that shape.
3. What would be a great way to test a random grid based shape to see if it contains a space that needs to be filled in? The spaces can range from a single block to ten blocks. Also the line of blocks has a chance to not form a shape but just form a line. Behemyth
4. Wait a second, I'm a fool. The index integer is not an actual index... =P
5. Using the console, being the noob I am, i've created an array that is 24 by 80 filling the entire console screen excluding the line on the bottom for information. The perimeter of this grid is composed of X's, otherwise thought of as a block. A random starting point and ending point is created that are not next to each other or fall on the same collumn or row. These points are also on the perimeter blocks. The purpose of the following code is create the first block inside the area. This is part of the code for a procedural "ice maze" so when you move in one direction you can't move again until you hit a block. The funny thing is, when I run this code, the random block for traveling east is one line underneath the intended line. Also, the parts for travelling north and west don't evan work. If you could help me I'd be much obliged! void procedure (char create[] ) { int i=0; int random_value=0; int index_x_p=index_x_s; //current point int index_y_p=index_y_s; int index_x_t=index_x_s; //counting point int index_y_t=index_y_s; if(index_x_p==0){ //if going east for(i=0; index_x_t+1 != 'X';i++){ //finds the distance to the block. index_x_t=index_x_t+1; } random_value=(rand()%i)+1; //creates a random value based of the distance index_x_p=index_x_p+random_value; // the current point changes create[index_y_p][index_x_p+1]='X';// a block is placed on the opposite side of the point int index_x_t=index_x_p; //resets test to current point int index_y_t=index_y_p; } else if(index_x_p==79){ //if going west for(i=0; index_x_t-1 != 'X';i++){ index_x_t=index_x_t-1; } random_value=(rand()%i)+1; index_x_p=index_x_p-random_value; create[index_y_p][index_x_p-1]='X'; int index_x_t=index_x_p; int index_y_t=index_y_p; } else if(index_y_p==0){ //if going south for(i=0; index_y_t+1 != 'X';i++){ index_y_t=index_y_t+1; } random_value=(rand()%i)+1; index_y_p=index_y_p+random_value; create[index_y_p+1][index_x_p]='X'; int index_x_t=index_x_p; int index_y_t=index_y_p; } else if(index_y_p==23){ //if going north for(i=0; index_y_t-1 != 'X';i++){ index_y_t=index_y_t-1; } random_value=(rand()%i)+1; index_y_p=index_y_p-random_value; create[index_y_p-1][index_x_p]='X'; int index_x_t=index_x_p; int index_y_t=index_y_p; } } Behemyth
6. When considering to make a voxel terrain, I wondered if all the objects outside of the terrain had to be created out of voxels also. Is this true?
• 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!