# Behemyth

Members

9

233 Neutral

• Rank
Newbie
1. ## Finding an Enclosed Space on a Grid

[quote name='SiCrane' timestamp='1337453317' post='4941488'] Create a blank grid with each block set to a given value, say 0. Then place your object on the grid so that each block in your object has a different value, say 1. Then flood fill the outside of your grid with a different value, say 2. Whatever is left as 0 is a hole on your object. [/quote] That is a pretty spiffy idea! Thanks to all who contributed.
2. ## Finding an Enclosed Space on a Grid

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. ## Finding an Enclosed Space on a Grid

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. ## Help: Grid Based Anomolies

Wait a second, I'm a fool. The index integer is not an actual index... =P
5. ## Help: Grid Based Anomolies

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! [CODE] void procedure (char create[][80] ) { 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; } } [/CODE] Behemyth
6. ## Voxel Terrain and Objects

Whew*, thank you very much!
7. ## Voxel Terrain and Objects

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?