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.

DLL Talk / [Unity] Memory allocation

Author
Message
Bongadoo
18
Years of Service
User Offline
Joined: 4th May 2006
Location:
Posted: 28th Nov 2006 11:40
For my current engine design I am using Unity to store map information. At the moment I have all the map information stored in LUA arrays in a single LUA file, ie..

map1={4,5,8,10,1,4}
map2={3,7,2,1,8,12}

My question is; when the map size grows very large and there will be a lot of arrays, how is this information stored? When 'load lua' is called, does this load all the LUA file information/variables into memory, or is it just pointed to somehow?
Bongadoo
18
Years of Service
User Offline
Joined: 4th May 2006
Location:
Posted: 28th Nov 2006 17:39 Edited at: 28th Nov 2006 17:42
I have answered my own question, which unfortunately seems to be that Unity eats a lot of memory. I've just quickly made a simple test program, so if anyone else wants to test this please just use the code below:

This program creates the initial LUA file:


This program loads the LUA file when the spacebar is pressed:


It seems that the memory used in the application is 10 times the file size for a (100000,100) array. This made a LUA file of 30mb, and system memory dropped 300mb on loading. Looks like I'll be using seperate files then

***** WARNING: Don't use huge no_arrays() size, as I have no idea what will happen if you don't have enough memory. Also, you will need to make sure no lua.txt file exists every time you run the creation program *****
GatorHex
19
Years of Service
User Offline
Joined: 5th Apr 2005
Location: Gunchester, UK
Posted: 1st Jan 2007 08:34
I do the lua file like this



I send data to a lua file like this



I read data from a file like this..


You can check out a little lua sample I wrote here
http://www.freewebs.com/sang33ta/LuaExample.rar

OK here is a little upgrade you can make to the Amazon.lua we will re-program the AI without needing DBP to recompile the software!!!

add these three lines...

spotPlayerDistance = 20
if dist > attackDistance and dist < spotPlayerDistance then
if timer > (oldTimer + attackTimer) and dist < attackDistance then

..now the monster only comes after you if you get too close to her.

Your full Amazon.lua file should looks as below...



http://www.KumKie.com http://bulldog.servegame.com
cassius
20
Years of Service
User Offline
Joined: 31st Oct 2003
Location:
Posted: 17th Jan 2007 22:19
@Bongadoo,

I would use seperate LUA files for levels. I have been working on doing that in my own engine. Although I have not even come close to a 10000 line LUA file or had a 100 items in one entry, I am sure at some point there will be a memory tradeoff. By seperating the level files you would gain the flexibity of managing how the game was put together if you decided to move a level's position in the game.

Good Luck!

Cassius

Login to post a reply

Server time is: 2024-09-28 14:40:13
Your offset time is: 2024-09-28 14:40:13