Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Memblocks vs arrays

Author
Message
Masqutti
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 1st Feb 2010 14:35 Edited at: 1st Feb 2010 14:38
Hi!

I'm making a system for environment in my gameworld to have thousands and thousands of object positions and statuses saved in an array.

This far it has worked pretty well while doing "mediumsize" matrix and placing up to 300,000 different positions/statuses for objects in there. It's for rolling the objects within the camera so it gives an illusion of streaming environment.


I just thought that as this is going to be a huge gameworld, may there be problems with usage of array. I've thought about including array that's like dim objects(tilex,tilez,objectamount) as objectype, and the objectype consists of various variables.

The memoryload wouldn't be too much even if the whole array would be loaded at 1 time(tho the loading time would be pretty long, the memory consumption aint that bad)


I don't know is this the best way to do it, what about memblocks or something? I haven't used em at all yet, but is there a benefit of saving all the data into a memblock, and reading single variables from it? would that be considerably faster?

hmmmh.. that didn't compile
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 1st Feb 2010 15:07
Single directional travel or full 360 degree?

Masqutti
14
Years of Service
User Offline
Joined: 8th Jan 2010
Location: insanity
Posted: 2nd Feb 2010 00:27 Edited at: 2nd Feb 2010 00:29
Hi!

It's 360 degrees, at the moment the array holds positions of objects etc. and i have another array to "store" objects that are not visible so they may return in use... lets say I have 1000 planes loaded to act as grass, but i'm having 80,000 different array-units to tell the grass objects to position emselves, so it's 80,000 streaming grass objects with just 1000 planes. It works. And actually the performance is quite ok atm. But... always seeking for better

So the matrix aint streaming but the way array&function handles objects it's kinda streaming for them..

edit: I'm also conserned about the fact this system eats lots of CPU but minimal amount of GPU.. I dunno if there's a way to balance that out... cpu is evidently needed somewhere else ofc.. in the future.. but that's another thing

hmmmh.. that didn't compile
Neuro Fuzzy
17
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 4th Feb 2010 07:11
O.o

80,000 specific objects? As in - each with their own unique position and rotation? definitely bad if you want to add anything else.

You should look into procedural placement of objects, so instead of having a gigantic array (80,000 array units probably takes up a LOT of ram), you would just have a procedure to place grass objects at different locations. A procedure can be written to repeatedly place grass objects at the same position each time, without actually having to store it's position in a gigantic array.

Anyways, I don't see a need to switch over to memblocks... though I don't know about speed comparisons between the two. Memblocks are generally more flexible, but if that flexibility is needed, I prefer straight-up memory access via IanM's plugins.

Basically... a player probably wouldn't care if a million grass objects are uniquely located, so why should your program?


Login to post a reply

Server time is: 2024-11-24 20:54:58
Your offset time is: 2024-11-24 20:54:58