Gamestudio Links
Zorro Links
Newest Posts
Sam Foster Sound | Experienced Indie Game Composer for Hire
by titanicpiano14
15 minutes 50 seconds ago
Starting Zorro
by dpt
Today at 16:51
Lost Key
by jcl
Today at 13:58
Aum119 is ready
by Iglarion
Today at 13:09
Zorro on Linux
by Nanitek
Today at 11:08
AUM Magazine
Latest Screens
RPG PARTY
Triton Wing now available on Steam
AckCon'17: Lotter vs The World
Triton Wing
ZeaL
Who's Online
25 registered (JohanAu, Ch40zzC0d3r, Iglarion, dpt, gtell, Dbat, ezaffa, Dalla, firecrest, 2 invisible), 474 Guests and 4 Spiders online.
Key: Admin, Global Mod, Mod
Newest Members
vivekkumar, Hale75, victrades, htj, anufriyev
17781 Registered Users
Topic Options
Rate This Topic
#468582 - 10/11/17 04:52 Game_load, slowly increasing nexus usage
jumpman Offline
Serious User

Registered: 04/17/02
Posts: 1126
Loc: ny
Hello!

Im playing around with game_save and game_load. Everytime I save the game with:

game_save("test_save",1,SV_FUNCTIONS+SV_LEVEL);

and load the game with:

game_load("test_save",1);

My nexus usage goes up every load, and eventually I get the "nexus too small" error. What could cause nexus memory to increase every load??
_________________________
A8 Pro 8.47

Top
#468583 - 10/11/17 05:07 Re: Game_load, slowly increasing nexus usage [Re: jumpman]
jumpman Offline
Serious User

Registered: 04/17/02
Posts: 1126
Loc: ny
the SV_LEVEL is increasing my nexus usage each load. Why do you think that is?
_________________________
A8 Pro 8.47

Top
#468587 - 10/11/17 08:33 Re: Game_load, slowly increasing nexus usage [Re: jumpman]
MasterQ32 Online
Expert

Registered: 11/26/07
Posts: 2539
Loc: Germany, BW, Stuttgart
are you creating/deleting a lot of entities?
_________________________
Visit my site: www.masterq32.de

Top
#468612 - 10/11/17 18:14 Re: Game_load, slowly increasing nexus usage [Re: MasterQ32]
jumpman Offline
Serious User

Registered: 04/17/02
Posts: 1126
Loc: ny
I was creating alot of entities, throwing them up in the air, saving, and reloading. The game would load correctly, and the objects would load in the air and drop, but the nexus would slightly increase on every load.

I have then tried loading a NULL level then game_load the save file, which kind of helped, but loading the save file increased the nexus usage anyway.

After some testing, I have found 1 culprit, which was PSSM shadows. When i pssm_run(0); correctly, and waited 1 frame before reactivating them, the nexus nor the sys_memory increased. Nothing was being incremented laugh

However, my next questions pertain to what are good practices concerning where to perform game_save and game_load. Currently, I am doing game_save and load through panel buttons! Its not advised in the manual, without a wait before hand. Do you do game_save and load through startup_ loops?

SV_VARS seems to balloon my sav file from just a couple kilobytes to 20 megs! What does SV_VARS save exactly?
_________________________
A8 Pro 8.47

Top
#468614 - 10/11/17 18:21 Re: Game_load, slowly increasing nexus usage [Re: jumpman]
Kartoffel Online
Expert

Registered: 06/11/09
Posts: 2100
Loc: Bavaria, Germany
I think it's a good idea to write your own loading / saving function. That way you have more control over what's being stored and how it should be saved or loaded. This can be a bit tricky and time consuming, though smirk
_________________________
POTATO-MAN saves the day! - Random

Top
#468624 - 10/11/17 20:10 Re: Game_load, slowly increasing nexus usage [Re: Kartoffel]
jumpman Offline
Serious User

Registered: 04/17/02
Posts: 1126
Loc: ny
How do you do your saving and loading kartoffel?

In the manual it says: A single var is 4 bytes. So if i did this:

var Max_Nodes[999999];

Its 4 bytes multiplied by 999999, which gives me 3999996 bytes, which equates to 3.999996 megs. So this single array currently would take up 4 megs of space/memory.

So if I use SV_VARS, it will save every array, and I have multiples of these huge arrays. Is this the reason why my .sav file is 20 megs?

I have 60 of these huge empty arrays. If each of them is 4 megs, the total should be 244 megs. Why isnt the .sav file over 244 megs?
_________________________
A8 Pro 8.47

Top
#468661 - 10/12/17 15:55 Re: Game_load, slowly increasing nexus usage [Re: jumpman]
Kartoffel Online
Expert

Registered: 06/11/09
Posts: 2100
Loc: Bavaria, Germany
I don't know how the engine decides what to save, so I can't help you with that. If I had to write my own function I'd start by deciding what data I want to save, in what order and so on. Storing it in a file is basically just binary writing / reading. You could add some level of encryption & file integrity checking to prevent people from easily fiddling around with savegames aswell.
_________________________
POTATO-MAN saves the day! - Random

Top
#468666 - 10/12/17 16:43 Re: Game_load, slowly increasing nexus usage [Re: Kartoffel]
jumpman Offline
Serious User

Registered: 04/17/02
Posts: 1126
Loc: ny
Hi Kartoffel!

Do you write them into txt files? I was able to do that once.

Currently, I have the save and load working so far, but as you know, once you declare something working, it will crash soon after laugh If you'd like to know how I got it working so far, I can let you know if you'd like, incase you want to use the native save/load system.
_________________________
A8 Pro 8.47

Top
#468693 - 10/13/17 05:38 Re: Game_load, slowly increasing nexus usage [Re: jumpman]
Dooley Offline
User

Registered: 05/12/05
Posts: 518
Loc: Chicago, IL
I am using file_var_write and file_var_read to save, then load data from a .txt file. You will also need file_open_write, file_open_append and file_open_read to get these things working.

It is complex and tricky to set up, but I was unable to get around the problems caused by Game_save and Game_load ... well worth the trouble.
_________________________
Check out "Star Explorers" on Indiegogo:
https://www.indiegogo.com/projects/star-explorers-space/x/17324659#/

Anomalies released on Steam: http://store.steampowered.com/app/546780


Top
#468717 - 10/13/17 21:04 Re: Game_load, slowly increasing nexus usage [Re: Dooley]
jumpman Offline
Serious User

Registered: 04/17/02
Posts: 1126
Loc: ny
what problems did you run into using game_save and game_load dooley? Im assuming your txt file load system wont save the actual game state, but it will save the relevant information at certain checkpoints?
_________________________
A8 Pro 8.47

Top


Moderator:  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | resources | magazine | manual | support faq | bugs | beta features

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) 3dgamestudio.net