I want the random world that generates to make a save code to reload it.I want it to also save the players inventory (after i am done with it), the player health, and any builds or blocks destroyed.
basically, I want the entire game to save as a code to copy and paste so someone can play their world when they want to.
Problem is that the world generates randomly.This might make the process harder.
(NOTE: PLEASE MAKE AN EXAMPLE, IT WOULD BE EASIER FOR ME!!!)
2 Likes
Should probably update this example, but it should work well enough.
I really don’t have the time to make a better example, but just know that whatever system you use NEEDS lists, otherwise you’ll be doing something incredibly ineffective.
You can also look at my game Alpaca Raceway or Color Complex to see those save features.
How it works
Basically, a message is sent from every object to 1 object. They send 3 messages:
You can send more than just these 3 values if you wanted. Another common one is rotation.
- X Position
- Y Position
- Object Type
Those values are then added to a list where they are now stored.
Then, those values are extracted from the list and used to spawn a specific block via the Object Type, and at the X and Y position.
Once again, it’s not perfect and I would make it much better if I redid the system, but I don’t have the time.
2 Likes
Thanks for helping!I am very sorry to say that it doesn’t work with my random world generator.But this could work to create a building system that then could be saved, so thanks!
1 Like
It does work with randomly generated worlds.
The X, Y, and Object Type are sent to a list. It does not matter if the objects are randomly placed.
The example uses hand-placed objects, but it works just as well for randomly generated worlds.
Hmmm…Ok I will assume that it saves all blocks in the level?
Because if so, this is flipping GENIUS!
Yeah, it saves all blocks in the level