Fully Saved Levels in UDK

In their general stylish fashion, Epic has given to the UDK community the directions to fully save levels in UDK…about a year after we needed them. Forget my months of agonizing work trying to figure out a decent save system and go to this article instead. You will be rewarded with a whole bunch of code that’s pretty much plug-and-play.

What this allows you to do is save everything: the map you were playing on, pawn positions and orientations, and the stats of pretty much every dynamic object in the level. This data is serialized (written) to a file in JSON format, which is not particularly safe. But you can modify the code to use much safer binary files, .bin, instead. With this in mind you should still use my system to save global player data (which, as part of the game backend and not the level, will likely not be serialized). You can also use my system to learn the basics of save games since it’s much simpler and easier to understand.

So what can this be used for? Yeah, it’s kind of a stupid question…but just in case you’re lacking inspiration, you could use this for a checkpoint system. The player reaches a checkpoint, the level is saved, the player quits. When the player reloads the game he spawns in the exact place he left off, and any previously dead enemies stay dead. Nifty.

Advertisements

7 thoughts on “Fully Saved Levels in UDK

  1. I downloaded their JSon save system, tried it out on their maps that I downloaded, and it would not recognize the in-code console command that should load the level found in their player controller class. I’ve been frustrated for days trying to get this to work, and I’ve given up, as there is no further information on this that I can find. I can save the game successfully, and actually find the file in one of the win udk system folders, but their game does NOT load the file. Extremely disappointing to find that it didn’t quite turn out to be a “Plug-and-play” sort of code. 😦

    I am also using the latest version of UDK 2012 March.

    If you or anyone can explain why this is happening, or ever do figure it out, please post a reply, it would be greatly appreciated…

    • I’ve only tried it on Nov 2011 so I can’t say for sure what’s going on, but it does work. Have you set their player controller and gametype as the default in the config files, as well as set their gametype as the PIE in the world properties of the map you start with? And if so, have you checked the log file for errors?

      • I didn’t set the defualts in the config files, figured there was no need as it is set in the defualt properties of the GameInfo class. However, I did what you said, and there were no errors in the log files, but it still doesn’t load. Here is an image of my problem:

        http://tinypic.com/view.php?pic=2rz2rcy&s=5

        I’m not sure why the command isn’t being recognized 😦
        Any ideas..? Maybe there is something else I should be changing??

    • Ah…try doing it via UDKGame instead of the editor PIE. The problem I think is that it’s trying to load UDKPIESaveGameStateMap (since you’re playing in editor), but that’s a transient map built by the editor for PIE…if that makes sense.

      • ok, yeah that makes sense….but how do we implement the UDKGame so that it has all the properties of the SaveGameState to Save and Load? I am trying to get it to work, but it seems to be doing nothing…Not sure how to go about this..Hheh

    • Well, you’re gonna need some sort of “base” menu map of your custom gametype (think UDKFrontendMap), and make sure in the config files you set the default gametype to your custom gametype, and the default map to this base map. From this map you can go about loading/saving all the separate levels you want to.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s