1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  3. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  4. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  5. Dismiss Notice
  6. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

Wormholes code

Discussion in 'Civ4 - MOO2Civ' started by TC01, Jul 24, 2009.

  1. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    This is a thread for dealing with the Wormholes component of MOO2Civ. If you don't know, I designed the Wormholes modcomp for Star Trek, then released a Final Frontier compatible version, and then worked on including it in MOO2Civ with JEELEN. I recently updated it to v1.4/v1.2. So this thread is for two things:

    a. Ideas about Wormholes. If you have an idea about how Wormholes should work, if more wormholes should be added, if more features should be added, etc., post it here.
    b. Bugs/issues related to Wormholes. If you find a bug, please post it here and I'll correct it and issue a patch of my own (that JEELEN can then include in his next patch).

    A changelog for v1.4/v1.2 (for ST/FF versions respectively) is below:

    When I release v1.5/v1.3 and so on, I'll attach a zipped file below with it so JEELEN can add it to MOO2Civ.
     
  2. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    15,809
    Location:
    In orbit
    Thanks a lot!:goodjob: (The FF Flatmapscript was kindly provided by deanej, so I don't really know if and what he changed for it to be usable on FF or FF modmods.) I'll try and include this in the next patch to be released.
     
  3. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    I've gotten wormholes to be successfully placed on the Spiral Galaxy mapscript.

    Unfortunately, there are two small bugs:

    1. Red Wormholes are never placed. Even with 200,000 tries for each feature and the feature numbers slightly lowered (so there's only ever 1 wormhole type on a map).
    2. The function I wrote to make sure Wormholes were placed away from each other didn't work (the game hanged during map loading), so you might occasionally get two wormholes clumped together.

    Anyway, attached is the mapscript if you want to use it. It's the version from the Star Trek mod, of course, not the released version by cephalo- I don't know if this will make much of (or any) difference.
     
  4. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    15,809
    Location:
    In orbit
    I'll be sure to use it!:D

    It's weird about the no red wormholes (I'm not sure about the difference with blue wormholes?), but I wouldn't worry that much about the second 'bug', as in MoO wormholes can also exist not that far apart on the galaxtic map. Anyway, I'll check it out ASAP, thanks.:goodjob:
     
  5. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    I've fixed both problems.

    The first was an embarrasing mis-read of the XML worldsize as "World" instead of "Worldsize" (So the game was looking for WORLD_DUEL, not WORLDSIZE_DUEL, for instance).

    The second was more complicated and God-Emperor helped me fix it. Now, wormholes have to be a quarter or so across the map from each other- usually, the game drops them in seperate arms of the spiral galaxy.

    So attached is the fixed mapscript.


    On another note, you might want to change the pedia text for wormholes to be less Star Trek-ish. It has a ST explanation of what wormholes are in concept page.
     
  6. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Also in the newest version of the Wormholes mod I made an AI change which makes the AI consider if a plot is near a wormhole before choosing to build a starbase there.

    This is to help the fact that the AI knows nothing about Wormholes and won't know how to use them. So now it knows that building starbases near them (for defense) is important.

    Attached is the change modded into MOO2Civ's CvAI.py, if you want to use it.
     
  7. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    15,809
    Location:
    In orbit
    Sorry, sure I can use it. (Forgot to subscribe to this thread plus I got distracted by an uninstall/install problem w/BtS...)

    How do you mean? I've seen AI and barbs enter Wormholes (I believe even with a Colony Ship).
     
  8. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Really? In ST Galaxy, in my mod, or in MOO2Civ with wormholes added?

    To my knowledge, the AI shouldn't actually know what a wormhole is and what it can do- the AI doesn't know what python code does (whereas we can read the pedia and find out, or we can open up the python files and have a look around). Of course, it may be that once the AI uses a wormhole once, it can do it again?

    Of course, it could simply be that the AI's movement path has been calculated to cross the wormhole, and so it does, but ends up getting moved.


    Anyway, no matter what, building starbases near wormholes is a good defensive strategy.
     
  9. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    15,809
    Location:
    In orbit
    Yes, certainly. I have seen the wormholes in action during an MP game with apenpaap, so on his Star Trek wormhole-mapscript and in single-player game on the ST Galaxy map. Haven't been able to implement wormholes w/MOO2Civ yet as it's currently uninstalled on my PC...
     
  10. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Oh well. Maybe I was wrong...

    In any event, the AI change would still be useful, especially since normally the AI only considers bonus placement before deciding where to build a starbase (for example, they would only build a starbase before my change if there were two or more resources within two plot radius around it, according to the code.)
     
  11. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    15,809
    Location:
    In orbit
    I've indeed never seen the AI build a Starbase at any other location than resources; if you have enough cash, it's quite useful to have one near a Star System. (Though over time I've actually followed the AI example and build them usually only to get resources now.)
     
  12. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    15,809
    Location:
    In orbit
    BTW, would it be possible to simply use the Wormholes (Final Frontier) modcomp you just uploaded or am I missing something here?:confused:
     
  13. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Have you (or Minor Annoyance) made any changes to your python files? Specifically CvEventManager.py and CvAI.py?

    If that's a "no", then the answer's "yes", since all the XML is handled via module.

    Some mods have, like Star Trek, which is why I released the seperate FF version in the first place.

    Anyway, I first began posting stuff here before I decided to make a FF compatible version.
     
  14. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    15,809
    Location:
    In orbit
    Ok, thanks for your reply. (I was asking as I have currently no access to BtS...)
     
  15. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    15,809
    Location:
    In orbit
    TC01, I've been trying to python edit, but each time I want to save the edit I'm not allowed; Notepad ++ is telling me to check if the .py is opened somewhere else. Any suggestion?
     
  16. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Strange, never seen that before.

    I'd do it myself, except I don't know if any other changes have been made to the python since patch 4j was released (like the bug I fixed here).

    If there wasn't anything else changed, I can merge that change and the Wormholes code into MOO2Civ Patch 4j's python files and then just post them here.
     
  17. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    15,809
    Location:
    In orbit
    So far no python changes since the last patch; so if you could, I'd appreciate it (haven't done anything in python so far and my first try just faltered).
     
  18. TC01

    TC01 Chieftain

    Joined:
    Jun 28, 2009
    Messages:
    2,216
    Location:
    Irregularly Online
    Topic updated with the code actually merged into the MOO2Civ files, and both mapscripts (if you need them).

    Ignore all the other zips... I'll be removing them shortly.
     
  19. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    15,809
    Location:
    In orbit
    Cool! Ill make sure and include your work with the next patch to be released this week. Many thanks! :goodjob:
     
  20. Agent327

    Agent327 Observer

    Joined:
    Oct 28, 2006
    Messages:
    15,809
    Location:
    In orbit
    Darn... I just tried loading both mapscripts: the Wormholes.py shows the same problem I got when using the Module-installmethod - no star systems show up. The SpiralGalaxyWormholes.py freezes upon loading... :mad:
     

Share This Page