Author Topic: Savegame patch  (Read 19607 times)

jrepan

  • Guest
Savegame patch
« on: 20 October 2007, 14:43:40 »
Savegame is now in Glest Advanced Engine
--------------------------------------------

0.2 version of savegame patch is ready.
You can download it from here:
Code: [Select]
[url=http://jrepan.pri.ee/glest/glest-savegame-0.2.tar.gz]http://jrepan.pri.ee/glest/glest-savegame-0.2.tar.gz[/url]It is in alfa or beta stage: It saves only basic things and I haven't tested it very much.

TODO:
    fix bug: explored areas loading don't work
     finish command saving(at the moment, it saves only command with some types(attack, repair, move, harvest))
     unitgroups
     time
     stats
     and some minor improvements(add comments to source, ...)

Changelog:
 
    fixed bug: sometimes segfaults when saving
     New textentry look is almost finished.
     GraphicSavebox is renamed to GraphicTextEntryBox
     Now checks if could open file when saving
     Updated to svn revision 17(should work on 2.0.1, too)
     Updated English translation
I need some help with new textentry look. Can someone make a new background to this? Currently it is button background. File to change is: data/core/menu/textures/textentry.tga

How to install(on Linux):
1. Download and extract glest source.
2. Change newlines(not necessary if you use svn version)
Code: [Select]
dos2unix `find . -type f`3. Download data and extract it. Move glest_game/* to mk/linux
4. Extract savegame patch in dir where you extracted glest source
5. Compile again
Code: [Select]
cd mk/linux && sh autogen.sh && ./configure && jam
    « Last Edit: 7 April 2016, 15:17:33 by filux »

    jrepan

    • Guest
    -
    « Reply #1 on: 10 February 2008, 13:14:59 »
    Version 0.3 is ready. It works now with Glest 3. It is still beta or alfa and you can't save network game yet.
    Development has been very slow. It may became faster after next week.

    How to install:
      Linux binary:
        1. Download
    Code: [Select]
    [url=http://jrepan.pri.ee/glest/glest-savegame-0.3-linux.tar.gz]http://jrepan.pri.ee/glest/glest-savegame-0.3-linux.tar.gz[/url]or if you use 64bit Linux
    Code: [Select]
    [url=http://jrepan.pri.ee/glest/glest-savegame-0.3-linux64.tar.gz]http://jrepan.pri.ee/glest/glest-savegame-0.3-linux64.tar.gz[/url]2. Replace glest, data/lang/english.lng, data/core/menu/menu.xml in your existing install
    3. Copy textentry.tga to data/core/menu/textures/
    4. Make directory savegames
    [/list]
    Source:
      1. Download Glest source from svn.
      2. Download
    Code: [Select]
    [url=http://jrepan.pri.ee/glest/glest-savegame-0.3-patch.tar.gz]http://jrepan.pri.ee/glest/glest-savegame-0.3-patch.tar.gz[/url]
        3. Extract savegame patch in dir where you downloaded glest source
        4. Compile again
    Code: [Select]
    cd mk/linux && sh autogen.sh && ./configure && jam
        5. Copy glest and glest.ini from mk/linux to data/glest_game
    TODO:
      explored areas
      finish command saving(at the moment, it saves only command with some types(attack, repair, move, harvest))
      unitgroups
      time
      stats
      network game
      and some minor improvements(add comments to source, ...)

    Changelog:
      Updated to Glest 3
      Moved game loading to game.cpp
    « Last Edit: 7 April 2016, 15:21:24 by filux »

    erandur

    • Guest
    (No subject)
    « Reply #2 on: 16 February 2008, 21:14:12 »
    :D

    PS: It does sound good tho.
    « Last Edit: 1 January 1970, 00:00:00 by erandur »

    Duke

    • Guest
    (No subject)
    « Reply #3 on: 17 February 2008, 12:53:24 »
    Hmm, that source patch should work for windows too I think. But you'd have to compile your own version.
    I don't know how that is done, but I think you need a special (nonfree?) programm to do it.
    « Last Edit: 1 January 1970, 00:00:00 by Duke »

    jrepan

    • Guest
    (No subject)
    « Reply #4 on: 17 February 2008, 16:49:36 »
    Duke is almost right, but It shouldn't need nonfree program. I just don't have Windows so I can't compile it for Windows

    Maybe I will try cross compiler someday.
    « Last Edit: 1 January 1970, 00:00:00 by jrepan »

    hailstone

    • GAE Team
    • Battle Machine
    • ********
    • Posts: 1,568
      • View Profile
    (No subject)
    « Reply #5 on: 17 February 2008, 22:09:20 »
    Bos Wars has some information on cross compiling.
    « Last Edit: 1 January 1970, 00:00:00 by hailstone »
    Glest Advanced Engine - Admin/Programmer
    https://sourceforge.net/projects/glestae/

    daniel.santos

    • Guest
    -
    « Reply #6 on: 21 February 2008, 07:09:06 »
    well whaddaya know, I just figured out a no-cost win32 compile solution.  It's not "free" in the sense of what I consider "free" (as in "freedom"), but you don't have to pay m$ a month's salary.

    Code: [Select]
    [url=http://www.glest.org/glest_board/viewtopic.php?t=3271]http://www.glest.org/glest_board/viewtopic.php?t=3271[/url]
    « Last Edit: 7 April 2016, 15:22:33 by filux »

    tux-gamer

    • Guest
    -
    « Reply #7 on: 22 February 2008, 18:15:34 »
    Quote from: jrepan
    Version 0.3 is ready. It works now with Glest 3. It is still beta or alfa and you can't save network game yet.
    Development has been very slow. It may became faster after next week.

    How to install:
      Linux binary:
        1. Download
    Code: [Select]
    [url=http://jrepan.pri.ee/glest/glest-savegame-0.3-linux.tar.gz]http://jrepan.pri.ee/glest/glest-savegame-0.3-linux.tar.gz[/url]2. Replace glest, data/lang/english.lng, data/core/menu/menu.xml in your existing install
    3. Copy textentry.tga to data/core/menu/textures/
    4. Make directory savegames
    [/list]
    Source:
      1. Download Glest source from svn.
      2. Download
    Code: [Select]
    [url=http://jrepan.pri.ee/glest/glest-savegame-0.3-patch.tar.gz]http://jrepan.pri.ee/glest/glest-savegame-0.3-patch.tar.gz[/url]
        3. Extract savegame patch in dir where you downloaded glest source
        4. Compile again
    Code: [Select]
    cd mk/linux && sh autogen.sh && ./configure && jam
        5. Copy glest and glest.ini from mk/linux to data/glest_game
    TODO:
      explored areas
      finish command saving(at the moment, it saves only command with some types(attack, repair, move, harvest))
      unitgroups
      time
      stats
      network game
      and some minor improvements(add comments to source, ...)

    Changelog:
      Updated to Glest 3
      Moved game loading to game.cpp
    Thanks, it work with glest-source-3.1.0
    Keep the good work and i will looking forward for the next version.
    FYI, I Using Mandriva One 2007.1 Spring.
    « Last Edit: 7 April 2016, 15:23:30 by filux »

    jrepan

    • Guest
    (No subject)
    « Reply #8 on: 22 February 2008, 21:27:07 »
    Quote from: "tux-gamer"
    Thanks, it work with glest-source-3.1.0
    It is good to hear.
    Quote
    Keep the good work and i will looking forward for the next version.

    New release probably comes when I get all commands working. Now I have more time to develop it so it shouldn't take very much time.
    « Last Edit: 1 January 1970, 00:00:00 by jrepan »

    tildatoo

    • Guest
    (No subject)
    « Reply #9 on: 23 February 2008, 20:28:28 »
    Hi folks:  

    I've tried installing the binary using the instructions above.  I put the needed files into my Glest 3.10 on a x86-64 system running Ubuntu linux.  Glest itself seems to work fine, but I see no way to get it to save a game.  I'm new to Glest and can't seem to even find menus.  How do I activate a save and load a saved game?  Is it possible that my 64-bit system is messing this up?

    A save capability for Glest is really a great idea.  For me it's a must:  I can't afford to spend really long stretches of time finishing a game and Glest crashes on my machine not infrequently.  Without save, I lose everything.

    Thanks in advance!
    « Last Edit: 1 January 1970, 00:00:00 by tildatoo »

    tux-gamer

    • Guest
    (No subject)
    « Reply #10 on: 24 February 2008, 14:38:42 »
    Quote from: "tildatoo"
    Hi folks:  

    I've tried installing the binary using the instructions above.  I put the needed files into my Glest 3.10 on a x86-64 system running Ubuntu linux.  Glest itself seems to work fine, but I see no way to get it to save a game.  I'm new to Glest and can't seem to even find menus.  How do I activate a save and load a saved game?  Is it possible that my 64-bit system is messing this up?

    A save capability for Glest is really a great idea.  For me it's a must:  I can't afford to spend really long stretches of time finishing a game and Glest crashes on my machine not infrequently.  Without save, I lose everything.

    Thanks in advance!

    To Save the Game, press Z button.
    To Load the Game, press Load button in Main Menu

    Yup, with Save capability, i can save the game, when i have to go to do something important in the middle playing the game.
    I hope this Mod  will complete soon.

    psL i'am sory if my english is bad.
    « Last Edit: 1 January 1970, 00:00:00 by tux-gamer »

    tildatoo

    • Guest
    (No subject)
    « Reply #11 on: 24 February 2008, 20:15:12 »
    Hi tux-gamer:  I tried to save the game by pressing the 'z' key, shift-z, alt-z, ctrl-z etc during a game.  There's no effect.

    I installed using the pre-compiled binary, following the instructions carefully.  The instructions say you should replace the glest file, but I saw no glest file in the binary with which to replace the game's standard glest file.  So, maybe that's the problem.  Or perhaps there's a problem because I'm running the 64-bit version of the game and perhaps the precompiled binary is 32-bit?  If the latter is the case, I wonder why the game works at all.

    Thanks!

    tildatoo
    « Last Edit: 1 January 1970, 00:00:00 by tildatoo »

    tux-gamer

    • Guest
    (No subject)
    « Reply #12 on: 25 February 2008, 12:57:09 »
    Quote from: "tildatoo"
    Hi tux-gamer:  I tried to save the game by pressing the 'z' key, shift-z, alt-z, ctrl-z etc during a game.  There's no effect.

    I installed using the pre-compiled binary, following the instructions carefully.  The instructions say you should replace the glest file, but I saw no glest file in the binary with which to replace the game's standard glest file.  So, maybe that's the problem.  Or perhaps there's a problem because I'm running the 64-bit version of the game and perhaps the precompiled binary is 32-bit?  If the latter is the case, I wonder why the game works at all.

    Thanks!

    tildatoo

    You must replace glest binary with glest binary from glest-savegame-0.3-linux.tar.gz
    Or You can try to do this way:
    1.put glest-savegame-0.3-linux.tar.gz  , glest-source-3.1.0.tar.bz2 and glest_data_3.1.0.zip in your Home Directory

    2.unpack glest-savegame-0.3-linux.tar.gz
    Code: [Select]
    [tux-gamer@mandriva ~]$ tar xzvf glest-savegame-0.3-linux.tar.gz
    glest-savegame/
    glest-savegame/menu.xml
    glest-savegame/glest
    glest-savegame/textentry.tga
    glest-savegame/english.lng

    3.Change directory:
    Code: [Select]
    [tux-gamer@mandriva ~]$ cd  glest-savegame
    [tux-gamer@mandriva glest-savegame]$

    4.unzip the data files:
    Code: [Select]
    [tux-gamer@mandriva glest-savegame]$ unzip ../glest_data_3.1.0.zip
    [tux-gamer@mandriva glest-savegame]$ mv glest_game/*  .
    [tux-gamer@mandriva glest-savegame]$ rm -rf glest_game

    5.Replace:
    Code: [Select]
    [tux-gamer@mandriva glest-savegame]$ mv -f english.lng  data/lang/english.lng
    [tux-gamer@mandriva glest-savegame]$ mv -f menu.xml data/core/menu/menu.xml
    [tux-gamer@mandriva glest-savegame]$ mv textentry.tga data/core/menu/textures/textentry.tga

    6.Copy glest.ini from glest-source-3.1.0.tar.bz2
    Code: [Select]
    [tux-gamer@mandriva glest-savegame]$ tar xjvf ../glest-source-3.1.0.tar.bz2
    [tux-gamer@mandriva glest-savegame]$ mv  glest-source-3.1.0/glest.ini  .
    [tux-gamer@mandriva glest-savegame]$ rm -rf  glest-source-3.1.0

    7.Play the game:
    Code: [Select]
    [tux-gamer@mandriva glest-savegame]$ ./glest



    I hope this will help you.
    and to Load the game, you must click load game button in Main menu
    And to Save the game, press z button.

    ps: i'am sory if my english is bad.
    « Last Edit: 1 January 1970, 00:00:00 by tux-gamer »

    jrepan

    • Guest
    (No subject)
    « Reply #13 on: 25 February 2008, 13:30:11 »
    It is 32bit binary. I will make 64bit binary soon
    « Last Edit: 1 January 1970, 00:00:00 by jrepan »

    jrepan

    • Guest
    -
    « Reply #14 on: 25 February 2008, 16:16:32 »
    64bit Linux binary is ready:
    Code: [Select]
    [url=http://jrepan.pri.ee/glest/glest-savegame-0.3-linux64.tar.gz]http://jrepan.pri.ee/glest/glest-savega ... x64.tar.gz[/url]
    « Last Edit: 7 April 2016, 15:25:13 by filux »

    tildatoo

    • Guest
    -
    « Reply #15 on: 25 February 2008, 18:47:35 »
    Hi folks:  This has been tremendously helpful!  Thanks for putting all this time and effort into adding this functionality and helping non-programming savvy people like me install it.  Kudos! :-)

    Tildatoo
    « Last Edit: 7 April 2016, 15:25:39 by filux »

    jrepan

    • Guest
    -
    « Reply #16 on: 7 March 2008, 19:29:05 »
    Version 0.4 is ready.
    Download:
    Source:
    Code: [Select]
    [url=http://jrepan.pri.ee/glest/glest-savegame-0.4-patch.tar.gz]http://jrepan.pri.ee/glest/glest-savegame-0.4-patch.tar.gz[/url]32bit Linux binary:
    Code: [Select]
    [url=http://jrepan.pri.ee/glest/glest-savegame-0.4-linux.tar.gz]http://jrepan.pri.ee/glest/glest-savegame-0.4-linux.tar.gz[/url]64bit Linux binary:
    Code: [Select]
    [url=http://jrepan.pri.ee/glest/glest-savegame-0.4-linux64.tar.gz]http://jrepan.pri.ee/glest/glest-savegame-0.4-linux64.tar.gz[/url]
    Most important changes:
    * If save game dialog is opened, don't send key downs to elsewhere
    * Updated English translation
    * Saves again nextUnitId
    * Updated to svn r139 (Glest 3.1.2)
    * Now saves CommandType
    « Last Edit: 7 April 2016, 15:26:56 by filux »

    daniel.santos

    • Guest
    (No subject)
    « Reply #17 on: 7 March 2008, 20:39:57 »
    oooh :)
    « Last Edit: 1 January 1970, 00:00:00 by daniel.santos »

    tux-gamer

    • Guest
    -
    « Reply #18 on: 8 March 2008, 10:38:38 »
    Quote from: jrepan
    Version 0.4 is ready.
    Download:
    Source:
    Code: [Select]
    [url=http://jrepan.pri.ee/glest/glest-savegame-0.4-patch.tar.gz]http://jrepan.pri.ee/glest/glest-savega ... tch.tar.gz[/url] 32bit Linux binary:
    Code: [Select]
    [url=http://jrepan.pri.ee/glest/glest-savegame-0.4-linux.tar.gz]http://jrepan.pri.ee/glest/glest-savega ... nux.tar.gz[/url] 64bit Linux binary:
    Code: [Select]
    [url=http://jrepan.pri.ee/glest/glest-savegame-0.4-linux64.tar.gz]http://jrepan.pri.ee/glest/glest-savega ... x64.tar.gz[/url]
    Most important changes:
    * If save game dialog is opened, don't send key downs to elsewhere
    * Updated English translation
    * Saves again nextUnitId
    * Updated to svn r139 (Glest 3.1.2)
    * Now saves CommandType
    Wow, new release.
    Thanks a lot. :)  If Martiño doesn't merge this with the mainline Glest soon, I'll put it in gae :D
    « Last Edit: 7 April 2016, 15:27:51 by filux »

    SanskritFritz

    • Guest
    (No subject)
    « Reply #19 on: 10 March 2008, 10:29:42 »
    Please, put that mod into the main Glest! I have to use two instances of Glest now, one for single games with save capability, and one for network games.
    « Last Edit: 1 January 1970, 00:00:00 by SanskritFritz »

    daniel.santos

    • Guest
    (No subject)
    « Reply #20 on: 10 March 2008, 15:08:57 »
    GAE & savegame patch

    Unfortunately, the many changes I've made make the patch as is exceedingly difficult to merge, so I'm re-writing the actual game saving & loading part. I don't like to be one of those "I can do it better" types, I did actually merge all of the changes and got it to compile, but I changes to the classes and structure of the data, especially the data we we need to read & write has changed significantly.

    I've done object persistence a number of times in different projects I've worked on in the past and I personally like to let each object in an object hierarchy persist its self rather than using friend or package access (the later a Java thing) to get to it's members.  I've thrown my progress thus far into subversion, although it's anything but a complete implementation, it actually writes *part* of the saved game file. :)  Also, I decided to go with xml since we have these cute xml classes in Glest's shared libs already.  This is a sample output (not that you will care to look at them often):
    Code: [Select]
    ?xml version="1.0" encoding="UTF-8" standalone="no" ?>
    <saved-game>

      <description value="Dark Forest"/>

      <map value="maps/dark_forest.gbm"/>

      <tileset value="tilesets/forest"/>

      <tech value="techs/magitech"/>

      <players value="2"/>

      <factions>
        <faction>
          <units>
            <id value="0"/>
            <hp value="8000"/>
            <ep value="0"/>
            <loadCount value="0"/>
            <deadCount value="0"/>
            <progress value="0.12"/>
            <lastAnimProgress value="0.15"/>
            <animProgress value="0.18"/>
            <highlight value="0.00"/>
            <progress2 value="0"/>
            <kills value="0"/>
            <targetRef>
              <id value="-1"/>
              <faction value="-1"/>
            </targetRef>
            <currField value="0"/>
            <targetField value="0"/>
            <pos x="183" y="23"/>
            <lastPos x="183" y="23"/>
            <targetPos x="0" y="0"/>
            <targetVec x="0.00" y="0.00" z="0.00"/>
            <meetingPos x="182" y="22"/>
            <lastRotation value="-1.00"/>
            <targetRotation value="-1.00"/>
            <rotation value="-1.00"/>
            <type value="mage_tower"/>
            <loadType value="none"/>
            <currSkill value="stop_skill"/>
            <toBeUndertaken value="0"/>
            <alive value="1"/>
            <autoRepairEnabled value="1"/>
            <effects/>
            <effectsCreated/>
            <fire value="0"/>
            <commands/>
            <pets/>
            <master value="0"/>
            <id value="1"/>
            <hp value="1400"/>
            <ep value="0"/>
            <loadCount value="0"/>
            <deadCount value="0"/>
            <progress value="0.38"/>
            <lastAnimProgress value="0.15"/>
            <animProgress value="0.18"/>
            <highlight value="0.00"/>
    .... etc..
    I'm slowly getting there.  And thank you so much jrepan for doing this work, you've most certainly got me at least half way there.
    « Last Edit: 1 January 1970, 00:00:00 by daniel.santos »

    tux-gamer

    • Guest
    bug
    « Reply #21 on: 11 March 2008, 06:58:16 »
    @jrepan@
    I have compile v0.4 patch with glest-3.12 source code, and play it.
    but, when my archer attack golem, then i save the game, then exit the game, and load it from main menu.
    And i saw my archer still attack golem and Golem attack my archer, but no damage for both.
    and when some enemy try to attack my archer, they attack to wrong place/location and is far away to unknown place, not to my archer.

    this morning, i try play again, and save the game, then load it from main menu, but i only get segmentation fault.

    thanks again for developing this woinderful save game feature, i hope this will get much better soon.

    ps: i'am sory for my bad english
    « Last Edit: 1 January 1970, 00:00:00 by tux-gamer »

    tux-gamer

    • Guest
    (No subject)
    « Reply #22 on: 11 March 2008, 07:06:46 »
    @daniel.santos@
    horay, at last, save games implementation for GAE.
    thanks for adding save games to GAE, i will looking forwad for this one. :D
    « Last Edit: 1 January 1970, 00:00:00 by tux-gamer »

    daniel.santos

    • Guest
    -
    « Reply #23 on: 11 March 2008, 10:56:35 »
    Well, I finished, it and
    Code: [Select]
    [url=http://www.glest.org/glest_board/viewtopic.php?p=14441#14441]posted it here[/url], but I can't promise it'll work :).
    Code: [Select]
    void Game::keyDown(char key){

    Lang &lang= Lang::getInstance();
    bool speedChangesAllowed= !NetworkManager::getInstance().isNetworkGame();

    if(saveBox && saveBox->getEntry()->isActivated()) {
    switch(key) {
    case vkReturn:
    saveGame(saveBox->getEntry()->getText());
    //intentional fall-through
    case vkEscape:
    delete saveBox;
    saveBox = NULL;
    break;

    default:
    saveBox->keyDown(key);
    };
    return;
    } else {
    //send key to the chat manager
    chatManager.keyDown(key);
    }

    if(!chatManager.getEditEnabled()) {

    if(key=='N') {
    renderNetworkStatus= true;
    } else if(key=='E'){
    .... etc....
    The escape key doesn't actually work to cancel it because that gets picked up somewhere else (I can't remember where).
    « Last Edit: 7 April 2016, 15:29:02 by filux »

    tux-gamer

    • Guest
    -
    « Reply #24 on: 11 March 2008, 11:56:48 »
    @jrepan@
    Update bug info.
    1.Segementation fault only happen when you play a few minute, and save the game, then load it.

    2.Here screenshot when enemy and my archer , atacck to wrong place.

    800x600

    3.One more bug, all Guard command back to Stop command, so i must click Hold Position again after loading the saved games.

    @daniel.santos@
    Thanks alot, I'am downloading now.

    ps: ia'm sory if my english is bad. :-[
    « Last Edit: 7 April 2016, 15:29:38 by filux »

     

    anything