Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Behemyth

Member Since 29 Feb 2012
Offline Last Active Mar 11 2014 07:34 AM

Topics I've Started

Finding an Enclosed Space on a Grid

18 May 2012 - 08:50 AM

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

Help: Grid Based Anomolies

14 April 2012 - 06:07 PM

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[][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;
}
}


Behemyth

Voxel Terrain and Objects

29 February 2012 - 08:32 PM

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?

PARTNERS