Wormholes code

TC01

Deity
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:

-Added two Wormholes features (blue wormhole, red wormhole)
-Added python code that transports units that move onto one wormhole to the other wormhole of the same type
-Added tutorial popup when you first discover a wormhole of either type
-Added a version of the FinalFrontierFlat mapscript called Wormholes.py that places wormholes (red wormhole placed only on standard, large, or huge maps)
-Added a landmark label via python to each wormhole
-Prevented wormholes from being placed on Duel Maps
-Added a version of the SpiralGalaxy mapscript that places wormholes just like the Wormholes mapscript called WormholesSpiralGalaxy.py
-Made AI consider wormhole position before deciding where to build a starbase
-Added Barzan Wormhole- pale purple- to Huge Maps
-Made labeling of wormholes a custom map option
-Added a map option allowing you to alter the order of wormholes
-Fixed Wormholes.py wormhole placement bug

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.
 
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.
 
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.
 
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:
 
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.
 
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.
 
Sorry, sure I can use it. (Forgot to subscribe to this thread plus I got distracted by an uninstall/install problem w/BtS...)

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.

How do you mean? I've seen AI and barbs enter Wormholes (I believe even with a Colony Ship).
 
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).

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.
 
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...
 
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...

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.)
 
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.)
 
BTW, would it be possible to simply use the Wormholes (Final Frontier) modcomp you just uploaded or am I missing something here?:confused:
 
BTW, would it be possible to simply use the Wormholes (Final Frontier) modcomp you just uploaded or am I missing something here?:confused:

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.
 
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?
 
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.
 
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).
 
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.
 
Cool! Ill make sure and include your work with the next patch to be released this week. Many thanks! :goodjob:
 
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:
 
Top Bottom