Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by EternallyCurious. 04/25/24 10:20
Trading Journey
by howardR. 04/24/24 20:04
M1 Oversampling
by Petra. 04/24/24 10:34
Zorro FIX plugin - Experimental
by flink. 04/21/24 07:12
Scripts not found
by juergen_wue. 04/20/24 18:51
zorro 64bit command line support
by 7th_zorro. 04/20/24 10:06
StartWeek not working as it should
by jcl. 04/20/24 08:38
folder management functions
by VoroneTZ. 04/17/24 06:52
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (AndrewAMD, SBGuy, Petra), 801 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mega_Rod, EternallyCurious, howardR, 11honza11, ccorrea
19048 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
How to decrease the nexus after using ent_remove? #424591
06/19/13 08:27
06/19/13 08:27
Joined: Feb 2013
Posts: 8
G
Geist Offline OP
Newbie
Geist  Offline OP
Newbie
G

Joined: Feb 2013
Posts: 8
Hi,
I've been looking through related topics but there was no one fitting with my issue: I tried to generate a landscape at runtime using a chunks of tile-like entities and deforming them with the vertex functions. Once I remove an entity group (but keeping the entity pointer array) and re-create it after a while (depending on camera movement) the nexus hits implausible 2277 MB. As I create a new entity chunk the nexus reaches impossible dimensions of around 14361 MB.

I unsuccesfully tried to solve the problem using functions like level_free, ent_purge, sys_free as I thought it had something to do with the entity data that remains in cache after removing.. Do you have a solution for this?

Kind regards,
Geist

Re: How to decrease the nexus after using ent_remove? [Re: Geist] #424679
06/20/13 09:36
06/20/13 09:36
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Post more information! Are you using ent_create + ent_clone (a lot)? ent_clone has many limitations (such as increasing memory), check them in the manual and the forum.
AFAIK you cannot decrease the nexus size manually.


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: How to decrease the nexus after using ent_remove? [Re: Superku] #424682
06/20/13 10:47
06/20/13 10:47
Joined: Feb 2013
Posts: 8
G
Geist Offline OP
Newbie
Geist  Offline OP
Newbie
G

Joined: Feb 2013
Posts: 8
I use a large entity array with this dimension ENTITY* ent[16][16][3][3];
As I use terrains there is no need for ent_clone before the vertex deformation. I tried both, deforming vertices on models with ent_clone and deforming them on terrains without ent_clone(which is the faster solution).
One Chunk has the size of 3 * 3 = 9 tiles. There are 9 Chunks loaded in the level, so there is a permanent amount of at least 81 terrain entities. All of these terrains are deformed with ent_setvertex.

Re: How to decrease the nexus after using ent_remove? [Re: Geist] #424715
06/20/13 16:35
06/20/13 16:35

M
Malice
Unregistered
Malice
Unregistered
M



Quote:
I use a large entity array with this dimension ENTITY* ent[16][16][3][3];


I didn't think you could use a array of entity pointers like this. But I don't know for sure. You might be better using one array of pointers ENTITY* ent[16]; and another array for what ever data is in the rest. var ent_data[16][3][3]; But I am wildly guessing here. My question is what data is inside the other 3 dimension of this pointer array ?

Re: How to decrease the nexus after using ent_remove? [Re: ] #424725
06/20/13 18:06
06/20/13 18:06
Joined: Feb 2013
Posts: 8
G
Geist Offline OP
Newbie
Geist  Offline OP
Newbie
G

Joined: Feb 2013
Posts: 8
It worked quite fine, even for larger dimensions (such as [32][32][10][10]) but since I implemented the chunk limitation (which uses ent_remove) I get these nexus memory difficulties.
The 4 array dimensions were easy to manage when controlling the chunks and tiles: [ChunkCoordinateX]CunkCoordinateY][TileCoordinateX][TileCoordinateY]
But you made me aware of this beeing not efficient at all, as there are not more than 16 chunks á 9 tiles created at any time. So I try it with an one dimensional array. Thanks!

Re: How to decrease the nexus after using ent_remove? [Re: Geist] #424729
06/20/13 18:19
06/20/13 18:19
Joined: Feb 2013
Posts: 8
G
Geist Offline OP
Newbie
Geist  Offline OP
Newbie
G

Joined: Feb 2013
Posts: 8
I changed the Entity array to an one dimensional but I still get those nexus complications. That's gonna be a long weekend of bug research..
Btw. I have a ATI graphics card, does this matter?

Re: How to decrease the nexus after using ent_remove? [Re: Geist] #424731
06/20/13 18:49
06/20/13 18:49
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
This is a recursive topic with no clear answer by the moment. The dimension amount of the array has nothing to do with the nexus problem. Anyway, I can't understand the need of the secondary division, since a terrain area is bidimensional you only need two dimensions in your array.

How do you hide and show the visible chunks? Creating and removing entity terrains? If so, I would suggest you recycling the removed one.

Re: How to decrease the nexus after using ent_remove? [Re: Geist] #424732
06/20/13 18:50
06/20/13 18:50

M
Malice
Unregistered
Malice
Unregistered
M



Quote:
The 4 array dimensions were easy to manage when controlling the chunks and tiles: [ChunkCoordinateX]CunkCoordinateY][TileCoordinateX][TileCoordinateY]


btw the first array value is not [chunkCoordinateX] but instead the pointer to the ENTITY* .

Or am I wrong ENTITY* ent[x]; ent[x] = pointer to ent.

EDIT* EDIT again because some of it was pointless
Code:
#define MAX_CHUCNKST 16
ENTITY* terrain_tiles[MAX_CHUNCKST];
var tiles = 0;

function a()
{
    if(tiles < MAX_CHUNKST)
    terrin_tile[tiles] = ent_create(....);
    tile +=1;
    array[tile-1][0] = terrain_tiles[tile-1]->x;
    array[tile-1][1] = terrain_tiles[tile-1]->y;;
    array[tile-1][2] = some more data
    array[tile-1][3] = even more data
}



I might not have a good idea how to use an array like that.. I stop posting with unhelpful confusion.


Last edited by Malice; 06/20/13 20:03.
Re: How to decrease the nexus after using ent_remove? [Re: ] #424740
06/20/13 20:13
06/20/13 20:13
Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
txesmi Offline
Serious User
txesmi  Offline
Serious User

Joined: Jun 2007
Posts: 1,337
Hiporope and its pain
@Malice
Every member of an multidimensional pointers array is a pointer of the same type.
Code:
ENTITY *array[x]; // or...
ENTITY **array = (ENTITY**)sys_malloc ( sizeof(ENTITY*) * x );
array[a] == *(array+a)

ENTITY *array[x][y][z]; // or...
ENTITY **array = (ENTITY**)sys_malloc ( sizeof(ENTITY*) * z * y * x );
array[a][b][c] == *(array+(a*y*z)+(b*z)+c)
array[a][b][c] == *(array+((a*y)+b)*z)+c)


Last edited by txesmi; 06/20/13 20:59.
Re: How to decrease the nexus after using ent_remove? [Re: ] #424741
06/20/13 20:38
06/20/13 20:38
Joined: Feb 2013
Posts: 8
G
Geist Offline OP
Newbie
Geist  Offline OP
Newbie
G

Joined: Feb 2013
Posts: 8
Originally Posted By: Malice
Quote:
The 4 array dimensions were easy to manage when controlling the chunks and tiles: [ChunkCoordinateX]CunkCoordinateY][TileCoordinateX][TileCoordinateY]

btw the first array value is not [chunkCoordinateX] but instead the pointer to the ENTITY* .
[..]

I might not have a good idea how to use an array like that.. I stop posting with unhelpful confusion.


I tend to use it like this:
Code:
WorldPackSoilEntity[InputCoorX][InputCoorY][iSoilCoorX][iSoilCoorY] = 
ent_create("soil.hmp",
vector(WorldPackSoilData[InputCoorX][InputCoorY][iSoilCoorX][iSoilCoorY][getPositionX],
WorldPackSoilData[InputCoorX][InputCoorY][iSoilCoorX][iSoilCoorY][getPositionY],
4),0);


But it seems to be unefficient / redundant memory allocation(?) so I switch to a one dimensional array.

Originally Posted By: txesmi
Anyway, I can't understand the need of the secondary division, since a terrain area is bidimensional you only need two dimensions in your array.

Since I need a few but regular connections to the "underworld" underneath the landscape I have to bundle many small terrains to a group - a group of terrains makes a chunk.
Each Tile(terrain) has a idividual height value; each terrain is deformed depending on its surrounding terrains.

How do you hide and show the visible chunks? Creating and removing entity terrains? If so, I would suggest you recycling the removed one. [/quote]
Yes, thanks, recycling sounds nice to me, therefore I wouldnt need 4 dimensional arrays(Only 1)!

Thanks for you input wink
Regards,
Geist

EDIT: The rapdily increasing nexus and video memory was caused due to the fact that I used terrains. I've ported the basics to models and it worked fine with good fps. Everytime you delete a terrain but keep the pointer and then create a new terrain in the pointer the nexus will increase for some reason..
Thank you for your help, think it's solved so far grin

Last edited by Geist; 06/20/13 23:53.
Page 1 of 2 1 2

Moderated by  HeelX, Spirit 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1