Fog of War ( AUM ) problem

Posted By: Espér

Fog of War ( AUM ) problem - 12/13/08 20:39

hi..
I copied the Fog of War code from the AUM..


Now i got a new problem...

how am i able to ask for the floor entities???
the AUM Code askes for the player:
Code:
if(vec_dist(boden.x, my.x) <= 350)
		{
			while(my.alpha >= 5)
			{my.alpha -= 3;wait(1);}
			ptr_remove(my);
		}


But i create entities, where no fow should be over, and at 50 pixels each side.
The floor ents are stored inside an array ( 4000 stacks ). How to let the script ask for all 4000 places of the array paralell to the gameplay???

Variable code:
Code:
var i = 0;

var mouse_move[3];

var bodentiles[4000];
var bodentiles_start = 0;
while (i < 4001) 
{
   bodentiles[i] = 0;
   i += 1;
}


the ent_create part:
Code:
			// Boden_normal ( immer gesetzt, alles andre iss drüber )
			bodentiles[bodentiles_start] = ent_create("Ground.mdl",vector(temp.x,temp.y,2),object_boden);
			bodentiles_start += 1;


you see.. every floor ent is stored in a specified place of the array...

The Fog of War Bitmap has a size of 8x8... so i need on a 150x150 Field map ( each field has 64x64 pixels ),...
180000 Fog of War entities.. only for fow...
Posted By: croman

Re: Fog of War ( AUM ) problem - 12/13/08 20:44

try commenting out line by line to locate in which line is the problem that causes the crash
Posted By: Espér

Re: Fog of War ( AUM ) problem - 12/13/08 20:54

i added printf("number"); Codes after every line..

Popup with "6" inside appeart at last.. Popup 7,8,9 ( everything inside the while loop ) causes the error.. but why???
Posted By: croman

Re: Fog of War ( AUM ) problem - 12/13/08 21:13

maybe it has something with cursors.x - maybe it's an empty pointer. check it.
btw - do you get an error or complete crash of application?
Posted By: sadsack

Re: Fog of War ( AUM ) problem - 12/13/08 21:59

Are you sure that is lite-c?
Posted By: Espér

Re: Fog of War ( AUM ) problem - 12/14/08 02:22

uhm.. yes... it´s lite-c

and no.. the pointer isn´t empty, because it´s created as first entity with a wait of 20 following.
Posted By: Espér

Re: Fog of War ( AUM ) problem - 12/14/08 03:04

code works now.. a bit...

Rewrote the startpost..plz take a look on it..
Posted By: testDummy

Re: Fog of War ( AUM ) problem - 12/14/08 04:25

Code:
var bodentiles[4000];

array indices 0-3999?
Code:
while (i < 4001) 
{
   bodentiles[i] = 0;
   i += 1;
}

array bounds exceeded?
Quoting xXReapeRXx.
Quote:
180000 Fog of War entities.. only for fow...

1. Maybe only space d / area a is visible at time t, thus, perhaps, only max n entities are required to cover visible d / a.
2. A separate function / loop / action might not be required for each coverage entity, where only one loop might do.
3. Potentially separate from visible coverage entities, cell visible states might only require boolean slots (vs var long = memory savings?).
Posted By: Espér

Re: Fog of War ( AUM ) problem - 12/14/08 13:48

didn´t understand anything of what you said ( german )....
Posted By: Espér

Re: Fog of War ( AUM ) problem - 12/18/08 17:42

i push this.. because i need help here as soon as possible
Posted By: EvilSOB

Re: Fog of War ( AUM ) problem - 12/18/08 20:45

Try this...

Code:
var mouse_move[3];

var bodentiles[4000];
var bodentiles_start = 0;
i=0;                       //<<<<<ONLY CHANGES
while (i < 4000)           //<<<<<ONLY CHANGES
{
   bodentiles[i] = 0;
   i += 1;
}
or try
Code:
var mouse_move[3];
var bodentiles[4000];
var bodentiles_start = 0;
var xx;  for(xx=0; xx<4000; xx++)  bodentiles[xx] = 0;

Posted By: Espér

Re: Fog of War ( AUM ) problem - 12/20/08 13:55

the problem is, that i can´t do this:

Code:
function object_fow()
{
	// Aktionen für den Kriegsnebel
	my.tilt = 90;
	my.alpha = 100;
	set(my,TRANSLUCENT);
	set(my,PASSABLE);
	while (1)
	{
		i=0;
		if(i < 4000){i += 1;}else if(i == 4000 || i > 4000){i = 0;}
		if(vec_dist(bodentiles[i].x, my.x) <= 350)
		{
			while(my.alpha >= 5)
			{my.alpha -= 3;wait(1);}
			ptr_remove(my);
		}
		wait(5);
	}
}

Posted By: testDummy

Re: Fog of War ( AUM ) problem - 12/20/08 19:04

Code:
// bad sample only

var i = 0;

ENTITY* bodentiles[4000]; // check syntax (Lite-C)
ENTITY* e1 = NULL;
VECTOR* fow_v1 = {x=0;y=0;z=0;}  // update this position with player / camera
function fowf_clear() {
	for(i=0; i<4000; i++) {
		if (bodentiles[i] != NULL) {
			e1 = bodentiles[i];
			ptr_remove(e1);
			bodentiles[i] = NULL;
		}
	}
}
function fowf_create() {
	for (i=0; i<4000; i++) {
		if (bodentiles[i] == NULL) {
			e1 = ent_create(<s?>, v?, f?);
			bodentiles[i] = e1;
		} else {
			e1 = bodentiles[i];
		}
		set(e1, TRANSLUCENT);
		set(e1, PASSABLE);
		e1.tilt = 90;
		e1.alpha = 100;
	}
}
function fowf_fadeOut(ENTITY* _e) {
	if (_e == NULL) { return(0); }
	_e.skill22 = 222;
	while(1) {
		if (_e == NULL) { break; }
		if (_e.alpha < 5) { break; }
		_e.alpha -=7 * time_step;
		wait(1);
	}
	if (_e != NULL) { ptr_remove(_e); }
}

function fowf_go() {
	var n1; n1=0;
	while(1) {
		n1 %= 4000;
		e1 = bodentiles[n1];
		n1 += 1;
		if (e1 != NULL) {
			if (vec_dist(e1.x, fow_v1) <= 350) {
				if (e1.skill22 != 222) {
					fowf_fadeOut(e1);
				}
			}
		}
		wait(1);
	}
}

Posted By: Anonymous2009

Re: Fog of War ( AUM ) problem - 04/21/09 12:07

Which AUM issue is that from?
© 2024 lite-C Forums