Announcement

Collapse
No announcement yet.

Save/Load your game in End-Users My Documents folder

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    You don't need it. The dll doesn't need to get modified for more variables. The dll handles only FileIO. It saves the whole object, and recovers it later.

    Comment


      #17
      May I use your code you posted here, to create a tutorial (including your modified code and your dll) which teaches how to save any object and load it? Ofc with credit given to you.

      Comment


        #18
        Originally posted by cube2222 View Post
        May I use your code you posted here, to create a tutorial (including your modified code and your dll) which teaches how to save any object and load it? Ofc with credit given to you.
        Sure thing cube2222. You can use the code and DLL and feel free to modify the source code to include any new features.

        Post the tutorial link too.

        Comment


          #19
          Here's the link http://forums.epicgames.com/threads/...8#post31600838

          Comment


            #20
            i got some warning when i compile it?

            :Warning class HSGame.SaveGameBase can't bind to C:\UDK\UDK-2012-10\Binaries\Win64\UserCode\SaveGame.dll

            please help me fix this problem ?
            Thanks before

            Comment


              #21
              Originally posted by ProfZ View Post
              i got some warning when i compile it?

              :Warning class HSGame.SaveGameBase can't bind to C:\UDK\UDK-2012-10\Binaries\Win64\UserCode\SaveGame.dll

              please help me fix this problem ?
              Thanks before
              UDK supports only 32-bit DLL's. Move SaveGame.dll to \Win32\UserCode\ folder

              Comment


                #22
                Originally posted by ryanjon2040 View Post
                UDK supports only 32-bit DLL's. Move SaveGame.dll to \Win32\UserCode\ folder
                i've done it
                but it's still warning?

                Comment


                  #23
                  Thanks Man, Awesome work.
                  This will be very usefull in my Single Player Gametype

                  Comment


                    #24
                    Amazing tutorial thanks man !
                    but i have a question , can we save the save file in other address directory except UserCode folder?

                    for example i wanna save my save file in a usb flash directory . is that possible in UDK?

                    Comment


                      #25
                      This is really nice and all but why is it not possible to let it over save a old save game? Instead of creating infinite increment saves.

                      Comment


                        #26
                        Originally posted by Davision View Post
                        This is really nice and all but why is it not possible to let it over save a old save game? Instead of creating infinite increment saves.
                        This code should provide what you want:
                        (All I did was comment out the incrementing functions)
                        Code:
                        using System;
                        using System.Collections.Generic;
                        using System.Linq;
                        using System.Text;
                        using RGiesecke.DllExport;
                        using System.Runtime.InteropServices;
                        using System.IO;
                        
                        namespace SaveGame
                        {
                            internal static class SaveGame
                            {
                                [DllExport("SaveGameToMyDocuments", CallingConvention = CallingConvention.StdCall)]
                                [return: MarshalAs(UnmanagedType.LPWStr)]
                                public static string SaveGameToMyDocuments([MarshalAs(UnmanagedType.LPWStr)]string FolderName, [MarshalAs(UnmanagedType.LPWStr)]string FileName, [MarshalAs(UnmanagedType.LPWStr)]string FileExtension)
                                {
                                    string FolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + FolderName;
                                    Directory.CreateDirectory(FolderPath);
                                  //  int increment = 0;
                                    string SaveFile = "";
                        
                                    SaveFile = FolderPath + "\\" + FileName + FileExtension;
                        
                                    /*
                                    do
                                    {
                                        increment++;
                                        SaveFile = FolderPath + "\\" + FileName + "_" + increment + FileExtension;
                                    } while (File.Exists(SaveFile));
                                     * */
                        
                                    return SaveFile;
                                }
                        
                        
                                [DllExport("LoadGameFromMyDocuments", CallingConvention = CallingConvention.StdCall)]
                                [return: MarshalAs(UnmanagedType.LPWStr)]
                                public static string LoadGameFromMyDocuments([MarshalAs(UnmanagedType.LPWStr)]string FolderName, [MarshalAs(UnmanagedType.LPWStr)]string FileName, [MarshalAs(UnmanagedType.LPWStr)]string FileExtension, [MarshalAs(UnmanagedType.LPWStr)]string FileNumber)
                                {
                                    string FolderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\" + FolderName;
                                    string LoadFile = FolderPath + "\\" + FileName + FileExtension;
                                    return LoadFile;
                                }
                            }
                        }
                        
                        /************************************************************************/
                        /* Other Common Locations
                         * MyDocuments:         Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
                         * AppData:             Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
                         * DeskTop:             Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory)
                         * LocalAppData:        Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
                         * ProgramFiles:        Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
                         * ProgramFiles (x86):  Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)
                         * Windows:             Environment.GetFolderPath(Environment.SpecialFolder.Windows)
                         * 
                         * There are more locations available.
                        /************************************************************************/
                        Compiled can be downloaded here: http://www.sendspace.com/file/si0nr7

                        Thanks to ryanjon2040 (op) as I contacted him a while ago about this same issue and he helped me fix a few missing file errors when compiling so that I could do this as well.

                        Comment


                          #27
                          @ Terlae
                          That did it, thanks a lot!

                          Comment


                            #28
                            Has anyone tried it yet to do such saving in a User folder on mac?
                            To me it seems impossible to save properly on mac with a UDK and there it is even a bigger problem when not saving inside the user folder. Because having it save inside the .app would replace the save game on patching the game. DLLs are useless on Mac and I guess the OSX .dylib files can't be made use of with the UDK.

                            Comment


                              #29
                              Hello,
                              I tried to compile the DLL, but I've got an error:
                              Code:
                              ------ Build started: Project: SaveGame, Configuration: Release x86 ------
                                SaveGame -> C:\SaveGame_RyanJon2040\SaveGame_C#\SaveGame_C#\SaveGame\SaveGame\bin\Release\x86\SaveGame.dll
                                ILDasm: calling 'C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\ildasm.exe' with /quoteallnames /unicode /nobar "/out:C:\Documents and Settings\Windows XP\Local Settings\Temp\tmp4\SaveGame.il" "C:\SaveGame_RyanJon2040\SaveGame_C#\SaveGame_C#\SaveGame\SaveGame\bin\Release\x86\SaveGame.dll"
                                ILDasm: ildasm 'C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\ildasm.exe' returned gracefully.
                              C:\SaveGame_RyanJon2040\SaveGame_C#\SaveGame_C#\SaveGame\SaveGame\DllExport\RGiesecke.DllExport.targets(8,5): error : 
                              ========== Build: 0 succeeded or up-to-date, 1 failed, 0 skipped ==========

                              Comment


                                #30
                                BUMP! Somebody help me?
                                Or Maybe, It would be great if ( ryanjon2040 ) the author of this project would help.

                                Comment

                                Working...
                                X