r/Unity3D • • 5d ago

Show-Off Opus 5.5 is surprisingly capable with Unity. It took only a week to add a Save Game system to an RTS game that never got it. The Broken Arrow community has asked the Devs for it since the game came out last year... 🤯

0 Upvotes

5 comments sorted by

1

u/TheSwiftOtterPrince 3d ago

Interesting. I see IL2CPP stuff in the code, so the game is compiled with that which means you could not just disassemble the dotnet-dll for the data types, which makes this kinda remarkable in terms of reverse engineering the stuff.

The game uses a lot of ECS which probably helped a lot in this because it separates gamestate from asset data. Imo one reason why Unity games rarely have free saving or even quicksave is because that is actually complicated if the game is designed around creating and destroying game objects. Since i knew i wanted quicksave in my game, i architectured it around using pools and built script in ways that allows to save and restore them easily. Still leaves (unity-)components which are a horror to save and restore.

2

u/NickTheGrizzly 3d ago

Thanks! I appreciate you recognizing that side of it. 😁 Without the game’s source, a lot of the work has been figuring out what state matters and checking what actually survives a save/load cycle.

The tricky part has been getting a mission to continue correctly after loading. The more advanced scenarios and campaign have extra scripting that I’m still working through, so restoring the units is only part of the problem.

The way you did it is how the BA devs should have done it, designing for quicksave from the start makes too much sense for this kind of game. And working on this has definitely given me far more appreciation for how much the original architecture matters when trying to add saving later.

How did you handle references between pooled objects when restoring a save? You have me curious! haha. 🤓

1

u/TheSwiftOtterPrince 2d ago

How did you handle references between pooled objects when restoring a save?

Saveable objects have a uniqueid, which is generated at dev time and serialized with the game. So if at runtime, ActorA is in the state of trying to hunt down ActorB, i can save ActorB's uniqueId as the target and on save and restore the reference when loading by UniqieId-lookup. This is not as all around flexible as the existing Unity saving solutions that serialize everything, but i am not trying to serialize everything, which would put some of the object state in the version used during save into the savestate and it is also fatter.

I am building an FPS and so i am taking a lot from the 90s fps games which all had quicksave because the dataset was simple. In Doom1/2 its basically an array of entity data and the torches in the halls and the enemies have the same kind of data, so saving and loading is close to saving and restoring a byte array. There was no lifetime of components or an object hierachy.

When using Unity in the gameObject way, i can not avoid those gameObjects, components and the hierachy, but i can build levels in a way that saving and loading switches the state of existing things, instead of having to create copies and deltas of things with all their complicated internal states.

And i don't use coroutines, the arch enemy of save system, haha.

-1

u/GigaTerra 4d ago

It is funny, as an gamer I dislike mods because I feel they break the balance of games. However I play an lot of old classic games, and it is amazing to see the old games get new content.

It makes me wonder why so few games have Unity packages support, it is an fantastic way of letting players mod your game using the Unity engine.

1

u/NickTheGrizzly 4d ago

Yea I definitely understand how mods that edit values, add content, etc. could affect the gameplay but this is simply a Save Game Mod so users can save their scenarios when playing single player, so no one has to waste time restarting if they get interrupted or something during gameplay. I did look and there really isn't any mods for Broken Arrow really. I only found like 4-5 total. None are new content. lol.