ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperCube > Help with CopperCube
forum topic indicator Better Save Load System Consept
person icon
The Jiggster
Guest
Quote
2025-05-12 18:40:50

So im working in a open world type game (might crash windows)

i think i may have created a better save load system

It works like this (it only works for wanting to save colected idems, killed enemys, ect)

Each Enemy is given a digit in a string of binary the of enemys long (10) alive enemys are 0 dead enemys are 1

0000000000

say we kill enemy 4 the var changes by adding 1x10 to the 3 power (3rd because the enemy's digit position -1)

0000001000

and so on until we want to save

1101011001

when we load we do this

At First Drawing > Load Var :Enemy's > Do Something later : 5
>Set / Change a Var: Enemy's > Divide By 1x10 to the power of x.
>Do Something Later :5> If Var has value do something: if Enemy is greater than 0.9 > delete scene node enemy 10
> Set /Change Var : Enemy Add 1x10 to the power of x

Else: > Set /Change Var : Enemy Add 1x10 to the power of x

Repeat from the beginind without the load var and change the first do something later to 10 the next to 20 and so on

(x = first digits position in string right to left - 1)

Could someone test this?

person icon
guest_chaceysgam
Guest
Quote
2025-05-13 14:37:31

this is good but the problem is that if you have a lot of enemy's then you have to check every digit for it but you can make it but coppercube will lag a bit

person icon
guest_Guest
Guest
Quote
2025-05-14 05:02:36

@Zoo, so you are back. Glad to have you here.

person icon
okeoke
Registered User
Quote
2025-05-14 12:34:22

That's crap.

You will never be able to debug that if something goes wrong.

Serialize to json and save to file. Read file back, deserialize use to restore state. That way you can also store more information, position, hitpoints and so on, not just boolean values.

If you don't want people to understand encode it after serialization, store salt in variable set by default action, no one will ever find it.

person icon
guest_Robbo
Guest
Quote
2025-06-07 15:14:56

Serialize to json is a nice solution or slightly easier you can use standard ccbWriteFileContent API :

I use tonnes of arrays actually and you can easily save them to data or binary file format:

var data1 = invMe.toString();
ccbWriteFileContent('data/save/invMe.bin', data1);

When loading back (ccbReadFileContent) and using numbers in your code you will have to convert back into number format though as everything is string or text format by default.


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |