Nexus Crash when creating terrains

Posted By: Espér

Nexus Crash when creating terrains - 01/15/12 15:25

Hi there.. i´m struck in a problem..

I want to create 10x10 terrains.
Each terrain should have 250x250 cells with a cellsize of 10.

This is the code to is:
Click to reveal..

Code:
#include <acknex.h>
#include <d3d9.h>
#include <windows.h>

#include "syst_default.c"





var levelbreite, levelhoehe;
var camera_zoom = 1200;

STRING* str_result_filename = "";

BMAP*   bm_levelmap;

COLOR*  pixelcolor = {red=1; green=1; blue=1;}

ENTITY* mapsky;
ENTITY* mapterrains[101];



//==========================================================================================================================
//==========================================================================================================================
//
//                                    INCLUDES
//
//==========================================================================================================================
//==========================================================================================================================
#include "global_structs.c"


//==========================================================================================================================
//==========================================================================================================================
//
//                                    LOADING TERRAINS
//
//==========================================================================================================================
//==========================================================================================================================
void create_terrains(var x_num, var y_num)
{
	var ix, iy, icount, ivertcount, icenterx, icentery, camset;
	camset = 0;
	icount = 1;
	icenterx = (x_num/2);
	icentery = (y_num/2);
	BMAP* terraintest = bmap_createblack(1024,1024,24);
	bmap_fill(terraintest, vector(random(255), random(255), random(255)), 100);
	
	//terrains laden
	for(iy=0; iy<x_num; iy++)
	{
		for(ix=0; ix<y_num; ix++)
		{
			if(sys_memory > 500000)
			{error("Mehr als 500MB sind besetzt!");}
			
			if(ix>icenterx && iy>icentery && camset == 0)
			{
				vec_set(camera.x, vector((ix-1)*2500, (iy-1)*2500, camera_zoom));
				camset = 1;
			}
			mapterrains[icount] = ent_createterrain(terraintest, vector(ix*2500,iy*2500,100), 250, 250, 10);
			icount ++;
			wait(1);
		}
	}
	
	//vertexe setzen
	for(icount=1; icount<26; icount++)
	{
		for(iy=0; iy<x_num; iy++)
		{
			for(ix=0; ix<y_num; ix++)
			{
				
			}
		}
	}
}



//==========================================================================================================================
//==========================================================================================================================
//
//                                    DUMMY MAIN
//
//==========================================================================================================================
//==========================================================================================================================
void main()
{
	nexus = 500;
	video_mode = 12;
	d3d_antialias = 9;
	level_load(NULL);
	sun_light = 0;
	wait(2);
	mapsky = ent_createlayer("sky_2+6.tga", SKY | CUBE | SHOW, 0);
	
	vec_set(camera.x,  vector(0,0,1200));
	vec_set(camera.pan, vector(0,-45,0));
	
	create_terrains(10, 10);
}




It works well with.. let´s say 5x5 terrains.. but with 10x10 terrains, i always get a "nexus too small".
I asked a friend if that´s possible.. but he said that something is strange, cause 250*10*100 = 250000*56byte, wich are a few MB, and not my nexus size of 500MB ._.


What could be wrong?
Posted By: sivan

Re: Nexus Crash when creating terrains - 01/16/12 14:00

hi

"nexus" is read only, thus "nexus = 500;" does not work.

put into 'preferences'->'command line options' "-nx 200" or "-nx 500" (but going over 300 is not recommended), and use Test Run (only this takes into account command line options).

or make a dummy .wmb where you can set nexus, and compile your project from WED.

it solved my similar problems.
Posted By: EvilSOB

Re: Nexus Crash when creating terrains - 01/16/12 15:20

The code doesnt really show much.

But try starting it up with 5x5 full-sized terrains.
If its running, look at the F11 debug panel and see if anything
is using HUGE amounts of memory...

I suspect it may be a TEXTURE memory usage issue.
Too many skins per terrain or something like that...

(yes I know textures arent stored in nexus, but just play along)
Posted By: Espér

Re: Nexus Crash when creating terrains - 01/16/12 21:24

'-nx 200' just makes everything extremely slow.. and Acknex Engine crashes with a Script Crash, Runtime error and after all a "Acknex is not answering"-Shutdown

i tried 5x5.. works..
The terain uses a 128x128 Texture
Code:
BMAP* terraintest = bmap_createblack(128,128,24);


I don´t think that uses much memory ^^
Posted By: EvilSOB

Re: Nexus Crash when creating terrains - 01/17/12 17:12

hmmm... OK. Not much memory at all...

But did you look at the debug panel anyway? Did anything look 'odd'?

And how about re-createing the HMP file, "just in case" it is corrupted somehow.

Otherwise Im out of ideas...
Posted By: Espér

Re: Nexus Crash when creating terrains - 01/17/12 20:20

i don´t use HMP.. i create the terrain at runtime..
© 2024 lite-C Forums