Results 1 to 24 of 24

Thread: Solving the Loadgame AI Bug - A suggested approach

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    EBII Council Senior Member Kull's Avatar
    Join Date
    Jan 2003
    Location
    El Paso, TX
    Posts
    13,502

    Default Solving the Loadgame AI Bug - A suggested approach

    I think we can all agree that the bug is real, it's serious, and CA has no intention of addressing it until the Expansion (if then). All-in-all, a pretty bad business - but there is one piece of good news: Until such time as the game is saved and reloaded, it isn't "broken". So our solution would seem to involve finding a way to reload a game without going through the existing save-load process.

    What follows is beyond my technical expertise to implement, but here's why I think it's possible. Back in the day I developed scenarios for Civ2, and had occasion to work with a C++ whiz. One of the laments in the Civ2 mod community involved the limited nature of the event language, which severely restricted the kinds of scripting we could employ. But what this guy came up with was nothing short of brilliant - a way to edit the game in active memory! The process was extremely complicated (and thus little used), but his tools allowed for almost any event to occur in the game.

    Now it seems to me that if it's possible to identify where a game resides in working computer memory - and then go in and perform real-time alterations to it - why couldn't you map the location of RTW in working RAM, copy the as-is parameters, and then overwrite a later loaded game with this data - thus avoiding the official save-game process altogether? Hopefully there are some serious "code-monkeys" here who can weigh in on the topic.
    Last edited by Kull; 04-02-2005 at 19:49. Reason: typos
    "Numidia Delenda Est!"

  2. #2
    EBII Council Senior Member Kull's Avatar
    Join Date
    Jan 2003
    Location
    El Paso, TX
    Posts
    13,502

    Default Re: Solving the Loadgame AI Bug - A suggested approach

    This may be easier than I thought. Based on discussions in other threads, windows "Hibernate" mode does exactly what I've suggested - i.e. saves and reloads a copy of the "as-is" active memory. So if we can find a way to easily trigger this........

    ...and there is! The link below will take you to a little freeware program called "wizmo", which you can configure to run from the desktop, thereby triggering "hibernate" mode any time you desire:

    http://grc.com/wizmo/wizmo.htm

    ....and I ran a series of tests which pretty well confirm that going in and out of hibernate does not trigger the "loadgame ai" bug. But that still leaves one not-so-little problem, do we REALLY want RTW to be running on our computers, all the time? Uhhh.....no thanks! So, now what we need is to find a way to create the "hibernate" file and access it ONLY when we want (i.e you open up a windows session, start a game of RTW, create the hibernate file when you're ready to stop playing, and then load that file whenever you want to resume the game).

    The search continues.....
    Last edited by Kull; 04-02-2005 at 21:13. Reason: added wizmo link and additional solution parameters
    "Numidia Delenda Est!"

  3. #3
    The Lion Prince Member Sundjata Keita's Avatar
    Join Date
    Oct 2004
    Location
    England
    Posts
    505

    Default Re: Solving the Loadgame AI Bug - A suggested approach

    This is way over my head but if someone can pull it off I will not only be impressed but dissapointed that some of the great modders here have not thought of it already Good luck to anyone who trys.

  4. #4
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Default Re: Solving the Loadgame AI Bug - A suggested approach

    Sounds good, and doable if one knows what he's doing. I don't, that's for sure.

    Just how resource-consuming is the operation? [SPECULATION] Could it be used, for example, in the battle mode without (serious) slowdowns? If it could be used then, couldn't someone make a proggy that'll use the "hibernate file" and based on that it'd construct new orders to AI according to the situation in battle. We could have a proper AI with this.[/SPECULATION]

    At least the siege bug could be addressed with this, dunno about battle AI.

  5. #5
    Simulation Monkey Member The_Mark's Avatar
    Join Date
    Dec 2004
    Location
    Helsinki, Finland
    Posts
    2,613

    Default Re: Solving the Loadgame AI Bug - A suggested approach

    some of the great modders here have not thought of it already
    I (well, I'm not a great modder, but) actually suggested something like that, but for the battle AI and without meddling with RAM.

  6. #6
    EBII Council Senior Member Kull's Avatar
    Join Date
    Jan 2003
    Location
    El Paso, TX
    Posts
    13,502

    Default Re: Solving the Loadgame AI Bug - A suggested approach

    OK, I've spent pretty much the whole day googling, and am only slightly smarter for the effort. But it does appear the "RAM Save Game" option can be implemented in 4 different ways:

    1) Basic Windows Hibernation: As discussed above, this can be implemented easily - and it works - but the downside is you can NEVER shut down RTR. Just doesn't seem to be a realistic solution.

    2) Application Hibernation: Imagine being able to hibernate only the RTR Application? That sounded like a great idea, but others have considered the issue and consider it to be extremely difficult (perhaps even impossible) to implement in the Windows environment. See this link for details (the techno-speak is truly impressive, if borderline unintelligible for the average non-geek):
    http://blogs.msdn.com/oldnewthing/ar...20/116749.aspx

    3) Specialized RTR RAM Copy/Load Application: My original idea, but someone would have to code this from scratch. May be doable, but the magnitude and quantity of the unknowns are.....unknown.

    4) Modified Windows Hibernation: Every time you hibernate, Windows creates a file called "hiberfil.sys" in the root directory of the C: drive. When you restart windows, it automatically launches this file. So far so good. But we need additional custom capability:
    a) The ability to boot up from a hibernation file at any time (the absolute, bar none, super critical, MUST HAVE!)
    b) Create the hibernation file without shutting down (nice to have)
    c) Create multiple hibernation copies of the hibernation file and boot up the one you choose (nice to have)

    Item 4a is the current focus of my research, and so far it's been "no joy". Here's why it's important. Windows only launches from the hibernation file if that was the method used to close down Windows. I can't seem to find any way to launch from the hibernation file if Windows experienced any other form of shutdown. Which means we can't launch RTR "hibernation saves" at our discretion. Which is the whole point!

    So, if anyone can find a way to do this, PLEASE pass it along!

    **********************************************

    And shortly after making this post, I may have found the answer - it's called "Hibernate Once, Resume Many", or HORM for short. Here's a link which provides more details:

    http://blogs.msdn.com/astebner/archi...01/273462.aspx

    and the research continues.......

    **********************************************

    My enthusiasm may have been premature. HORM is pretty complicated, and doesn't seem to specifically address our need. So the net is cast a little wider......
    Last edited by Kull; 04-03-2005 at 05:08. Reason: toning down the HORM-joy
    "Numidia Delenda Est!"

  7. #7

    Default Re: Solving the Loadgame AI Bug - A suggested approach

    A lot of thanks for your detailed answer

  8. #8
    EBII Council Senior Member Kull's Avatar
    Join Date
    Jan 2003
    Location
    El Paso, TX
    Posts
    13,502

    Default No dice with "Virtual PC"

    In the hope of discovering another method for running RTW "permanently", I ran a series of tests using "Virtual PC" (as discussed above, this software lets you create a virtual computer, complete with it's own O/S, all resident on your existing PC). Unfortunately the results were very discouraging. I loaded up Virtual PC and found it extremely easy to use and configure. With WinXP installed, patched, and running, RTW loaded up nicely. But when I tried to run the game, it insisted that DirectX 9.0 was not installed. I verifed the presence of 9.0b, and even went so far as to download and install 9.0c, all to no avail - RTW still refused to run. So I uninstalled the game and reinstalled - this time allowing RTW to install the 9.0b drivers, but again, no joy.

    At this point I did some googling and found a blog run by the MS Virtual PC Program Manager. He commented that Virtual PC emulates a "lowly S3 Trio with 8mb VRAM" (not encouraging), but he'd also recently tested a number of games. I decided to try one we had in common (Alpha Centauri, minimum DirectX 5.0), and it worked fine. So then I installed MTW (min DirectX 8.0), and it refused to start, saying it was "unable to initialize Direct 3D". So it appears that Virtual PC can't handle the graphics requirements imposed by the Total War series - although that's just a guess. The only certainty is that Virtual PC is not a viable work-around for the Loadgame/AI bug.

    VPC Tested Games: http://blogs.msdn.com/virtual_pc_guy...gory/8225.aspx
    Last edited by Kull; 04-24-2005 at 01:29.
    "Numidia Delenda Est!"

  9. #9

    Default Re: Solving the Loadgame AI Bug - A suggested approach

    I have finally found the time to test _and_ report on my approach to overcoming the loadgame "feature".

    Shortly, it consists of having Windows XP installed on a FAT32 partition and a Linux on another one. Theoretically, one could then hibernate Windows with RTW running and then use the hibernation files, stored under Linux, as a kind of savegame files.

    Unfortunanetely, this doesn't work.

    I have copied hiberfil.sys and the page file under Linux, and then put other files from another game for Windows to use. Windows, however, recognized somehow that files have been altered ("Hibernation file corrupt. Restarting the system").

    So I will have to test the approach by Kull, when I find the time to re-install the system.
    "Only when the human spirit is allowed to invent and create, only when individuals are given a personal stake in deciding economic policies and benefitting from their success -- only then can societies remain economically alive, dynamic, progressive, and free. Trust the people."
    Ronald Reagan

  10. #10

    Default Re: Solving the Loadgame AI Bug - A suggested approach

    If you have two disk drives, another way to dual boot is by using the BIOS to switch between boot devices provided the option is available. Also, the second drive can be used to backup the first drive which gives you protection against data loss due to drive failure and other causes as well.

    _________Designed to match Original STW gameplay.


    Beta 8 + Beta 8.1 patch + New Maps + Sound add-on + Castles 2

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Single Sign On provided by vBSSO