iLevels -infinite terrain

Posted By: KiwiBoy

iLevels -infinite terrain - 04/26/09 19:46

Well I decided to migrate to lite-C and have been having fun with trying to convert a few AUM articals with varying amounts of success.
Nothing too bothersome but then, I thought ilevels is what I need so having found how to make it work in a fashion (I'm limited in my movment algorythms at the moment but it shouldnt be too difficult to work thru)I tried to convert it but it wasnt so willing to makae the transition smile I coulnt get past trace_below(); as I still have yet to catch up with all migration syntax and conversions.
Any way, after thinking about it some, I thought it would still be a usefull excersise so am writting to ask if you could look at upgrading that particular one some time in the near future please.

As for the C_script one, its all I need at the moment to try to get the world moving under player instead of the other way around, for obvious reasons.
Like my friends, its your scripting/programming style that I find understandable and easy to put into practice so am looking to complete a small game using AUM examples as much as possible with my team mates.
Our project is tentatively named 'Danger Duck' and involves a 'Ducks Strike Back' type of single level, casual game.

So the next question is, how do I credit code properly?
Does every change need to be commented in, who made it originally, who successively modified it?
It is something not discussed but needs to be.

Thanks....
Posted By: George

Re: iLevels -infinite terrain - 04/27/09 04:09

Post the code that causes problems here and I'll look at it.
All the code from Aum is created by me and there's no need to give me credit. If you really want to do it, you could add something like: "Additional programming: George Dan Pirvu".
Posted By: KiwiBoy

Re: iLevels -infinite terrain - 04/27/09 04:41

Thanks George, thats reall cool and I will certainly do that too.

Here is the last edit I did before I put it aside and turned to A6 version.

Code:
//////////////////////////////////////////////////////////////////////////////
#include <acknex.h>
#include <default.c>


//////////////////////////////////////////////////////////////////////////////

//STRING* start_wmb = "start.wmb";

//////////////////////////////////////////////////////////////////////////////

//SOUND* beep_sound = "beep.wav";

//////////////////////////////////////////////////////////////////////////////
function trace_below();

//////////////////////////////////////////////////////////////////////////////

ENTITY* tile1;
ENTITY* tile2;
ENTITY* tile3;
ENTITY* tile4;
ENTITY* tile5;
ENTITY* tile6;
ENTITY* tile7;
ENTITY* tile8;
ENTITY* tile9;

//////////////////////////////////////////////////////////////////////////////

action car()
{
//	while (player == NULL) {wait (1);}
	var car_speed; 
	while ((tile1 == NULL) || (tile1 == NULL) || (tile3 == NULL) || (tile4 == NULL) || (tile5 == NULL) 
		|| (tile6 == NULL) || (tile7 == NULL) || (tile8 == NULL) || (tile9 == NULL)) {wait (1);}
	player = me;
	while (1)
	{
		if (car_speed != 0) // can't rotate the car if it isn't moving
		{
			my.pan -= 0.2 * (key_a-key_d) * car_speed * time_step;
		}
		car_speed = 3 * (key_w-key_s) * time_step + maxv (1 - time_step * 0.2, 0) * car_speed; // use the arrow keys, press and hold shift to double the speed
		c_move(my,car_speed,nullvector,IGNORE_PASSABLE  | GLIDE);
		vec_set(camera.x,my.x);//couldnt get it to merge with the player object so this helped at the time
		if (key_t == 0) // normal 3rd person camera view
		{
			camera.x = player.x - 300 * cos(player.pan); 
			camera.y = player.y - 300 * sin(player.pan); 
			camera.z = player.z + 100; 
			camera.pan += 0.2 * ang (player.pan - camera.pan);
			camera.tilt = -10;
		}
		else // press and hold "T" to get a top view
		{
			camera.x = player.x;
			camera.y = player.y;	
			camera.z = 8000;
			camera.pan = player.pan;
			camera.tilt = -90;
		}
		if (total_frames % 31) // trace twice a second, starting with the 1st frame
		{
			trace_below(); // trace the name of the texture below the car
		}

		wait (1);
	}
}

action sky_sphere()
{
//	my.nofog = on; // remove the comment to display the skybox even if the fog is on
	set(my,PASSABLE); // don't stop the entities that use ignore_passable with ent_move
	while (player == NULL) {wait (1);} // wait for the player (the car) to be created
	while (1)
	{	
		// move the sky together with the player to give the illusion of a huge level
		my.x = player.x;
		my.y = player.y;		
		wait (1);
	}
}

action tile_1() // just name these level tiles
{
	tile1 = me; 
}

action tile_2()
{
	tile2 = me;
}

action tile_3()
{
	tile3 = me;
}

action tile_4()
{
	tile4 = me;
}

action tile_5()
{
	tile5 = me;
}

action tile_6()
{
	tile6 = me;
}

action tile_7()
{
	tile7 = me;
}

action tile_8()
{
	tile8 = me;
}

action tile_9()
{
	tile9 = me;
}

function trace_below()
{
	c_trace(my.x,vector(my.x,my.y,my.z-10000),IGNORE_ME|IGNORE_PASSABLE|SCAN_TEXTURE);//didnt know if it needs more..

	if (str_cmpi ("one", tex_name)) // if the texture below the car is named "one" in wad
	{ 
		tile2.x = tile1.x;
		tile2.y = tile1.y - 2048;
		tile3.x = tile1.x - 2048;
		tile3.y = tile1.y - 2048;
		tile4.x = tile1.x + 2048;
		tile4.y = tile1.y;
		tile5.x = tile1.x + 2048;
		tile5.y = tile1.y - 2048;
		tile6.x = tile1.x - 2048;
		tile6.y = tile1.y;
		tile7.x = tile1.x + 2048;
		tile7.y = tile1.y + 2048;
		tile8.x = tile1.x;
		tile8.y = tile1.y + 2048;
		tile9.x = tile1.x - 2048;
		tile9.y = tile1.y + 2048;		
	} 
	if (str_cmpi ("two", tex_name)) // if the texture below the car is named "two" in wad
	{ 
		tile1.x = tile2.x;
		tile1.y = tile2.y + 2048;
		tile3.x = tile2.x;
		tile3.y = tile2.y - 2048;
		tile4.x = tile2.x + 2048;
		tile4.y = tile2.y + 2048;
		tile5.x = tile2.x + 2048;
		tile5.y = tile2.y;
		tile6.x = tile2.x + 2048;
		tile6.y = tile2.y - 2048;
		tile7.x = tile2.x - 2048;
		tile7.y = tile2.y + 2048;
		tile8.x = tile2.x - 2048;
		tile8.y = tile2.y;
		tile9.x = tile2.x - 2048;
		tile9.y = tile2.y - 2048;
	} 
	if (str_cmpi ("three", tex_name)) // if the texture below the car is named "three" in wad
	{ 
		tile1.x = tile3.x - 2048;
		tile1.y = tile3.y + 2048;
		tile2.x = tile3.x;
		tile2.y = tile3.y + 2048;
		tile4.x = tile3.x - 2048;
		tile4.y = tile3.y;
		tile5.x = tile3.x + 2048;
		tile5.y = tile3.y + 2048;
		tile6.x = tile3.x + 2048;
		tile6.y = tile3.y;
		tile7.x = tile3.x - 2048;
		tile7.y = tile3.y - 2048;
		tile8.x = tile3.x;
		tile8.y = tile3.y - 2048;
		tile9.x = tile3.x + 2048;
		tile9.y = tile3.y - 2048;
	} 
	if (str_cmpi ("four", tex_name)) // if the texture below the car is named "four" in wad
	{ 
		tile1.x = tile4.x - 2048;
		tile1.y = tile4.y;
		tile2.x = tile4.x - 2048;
		tile2.y = tile4.y - 2048;
		tile3.x = tile4.x - 2048;
		tile3.y = tile4.y + 2048;
		tile5.x = tile4.x;
		tile5.y = tile4.y - 2048;
		tile6.x = tile4.x;
		tile6.y = tile4.y + 2048;
		tile7.x = tile4.x + 2048;
		tile7.y = tile4.y;
		tile8.x = tile4.x + 2048;
		tile8.y = tile4.y - 2048;
		tile9.x = tile4.x + 2048;
		tile9.y = tile4.y + 2048;
	} 
	if (str_cmpi ("five", tex_name)) // if the texture below the car is named "five" in wad
	{ 
		tile1.x = tile5.x - 2048;
		tile1.y = tile5.y + 2048;
		tile2.x = tile5.x - 2048;
		tile2.y = tile5.y;
		tile3.x = tile5.x - 2048;
		tile3.y = tile5.y - 2048;
		tile4.x = tile5.x;
		tile4.y = tile5.y + 2048;
		tile6.x = tile5.x;
		tile6.y = tile5.y - 2048;
		tile7.x = tile5.x + 2048;
		tile7.y = tile5.y + 2048;
		tile8.x = tile5.x + 2048;
		tile8.y = tile5.y;
		tile9.x = tile5.x + 2048;
		tile9.y = tile5.y - 2048;
	} 
	if (str_cmpi ("six", tex_name)) // if the texture below the car is named "six" in wad
	{ 
		tile1.x = tile6.x - 2048;
		tile1.y = tile6.y - 2048;
		tile2.x = tile6.x - 2048;
		tile2.y = tile6.y + 2048;
		tile3.x = tile6.x - 2048;
		tile3.y = tile6.y;
		tile4.x = tile6.x;
		tile4.y = tile6.y - 2048;
		tile5.x = tile6.x;
		tile5.y = tile6.y + 2048;
		tile7.x = tile6.x + 2048;
		tile7.y = tile6.y - 2048;
		tile8.x = tile6.x + 2048;
		tile8.y = tile6.y + 2048;
		tile9.x = tile6.x + 2048;
		tile9.y = tile6.y;
	} 
	if (str_cmpi ("seven", tex_name)) // if the texture below the car is named "seven" in wad
	{ 
		tile1.x = tile7.x - 2048;
		tile1.y = tile7.y + 2048;
		tile2.x = tile7.x;
		tile2.y = tile7.y + 2048;
		tile3.x = tile7.x + 2048;
		tile3.y = tile7.y + 2048;
		tile4.x = tile7.x - 2048;
		tile4.y = tile7.y;
		tile5.x = tile7.x - 2048;
		tile5.y = tile7.y - 2048;
		tile6.x = tile7.x + 2048;
		tile6.y = tile7.y;
		tile8.x = tile7.x;
		tile8.y = tile7.y - 2048;
		tile9.x = tile7.x + 2048;
		tile9.y = tile7.y - 2048;
	} 
	if (str_cmpi ("eight", tex_name)) // if the texture below the car is named "eight" in wad
	{ 
		tile1.x = tile8.x + 2048;
		tile1.y = tile8.y + 2048;
		tile2.x = tile8.x + 2048;
		tile2.y = tile8.y;
		tile3.x = tile8.x + 2048;
		tile3.y = tile8.y - 2048;
		tile4.x = tile8.x - 2048;
		tile4.y = tile8.y + 2048;
		tile5.x = tile8.x - 2048;
		tile5.y = tile8.y;
		tile6.x = tile8.x - 2048;
		tile6.y = tile8.y - 2048;
		tile7.x = tile8.x;
		tile7.y = tile8.y + 2048;
		tile9.x = tile8.x;
		tile9.y = tile8.y - 2048;
	} 
	if (str_cmpi ("nine", tex_name)) // if the texture below the car is named "nine" in wad
	{ 
		tile1.x = tile9.x + 2048;
		tile1.y = tile9.y - 2048;
		tile2.x = tile9.x;
		tile2.y = tile9.y - 2048;
		tile3.x = tile9.x - 2048;
		tile3.y = tile9.y - 2048;
		tile4.x = tile9.x + 2048;
		tile4.y = tile9.y;
		tile5.x = tile9.x - 2048;
		tile5.y = tile9.y + 2048;
		tile6.x = tile9.x - 2048;
		tile6.y = tile9.y;
		tile7.x = tile9.x + 2048;
		tile7.y = tile9.y + 2048;
		tile8.x = tile9.x;
		tile8.y = tile9.y + 2048;
	} 
}

void main()
{
	var video_screen = 2;
	video_switch(6,32,2);//used in conjunction with video_window
	//	video_window(nullvector,nullvector,112,"Care to take a chance with me?");
	video_window(vector(200,200,0),vector(800,400,0),48,"Deadly Ducks - The Avenger!");
	
	level_load("start.wmb");
	wait(3);
	camera.clip_far = 15000;//clipfar. If you've made too big level and it lags, reduce it
	camera.clip_near = 0;//since camera can go very close to walls, we set it to 0
	camera.arc = 70;//makes it look more unique ;)
	move_friction = 0;//gliding requires this one
	ent_create("rallycar.mdl",vector(0,0,50),car);//and finaly, create the player entity
	ent_createlayer("scifi1b+6.tga", SKY | CUBE | VISIBLE, 0);
	fps_max = 60;
		fog_color = (fog_color == 0); // set fog_color to 0 (no fog) or 1
	camera.fog_start = 500; // the fog starts at 500 quants
	camera.fog_end = 2500; // and ends at 2500 quants
}

© 2024 lite-C Forums