Problem adding sectors

Need help testing contributed art or code or having trouble getting your newest additions into game compatible format? Confused by changes to data formats? Reading through source and wondering what the developers were thinking when they wrote something? Need "how-to" style guidance for messing with VS internals? This is probably the right forum.
Post Reply
Paladin
Explorer
Explorer
Posts: 8
Joined: Fri Oct 05, 2007 2:31 am

Problem adding sectors

Post by Paladin »

I'm trying to make a mod for PR that includes more of the WC universe then just gemini, but I can't work out a few glitches.
What I want is to custom-make every system in the 3 sectors surrounding gemini, so I started by adding a folder called Sol in the Sectors folder (Sectors\Sol\) and created about 1/4 of the systems. The biggest problem that occurs is every system in sol has at least one space station that I didn't put in the code.
esgaroth
Confed Special Operative
Confed Special Operative
Posts: 317
Joined: Mon Jan 19, 2004 12:48 pm
Location: Konstanz, Germany

Post by esgaroth »

The biggest problem that occurs is every system in sol has at least one space station that I didn't put in the code.
In the faction_ships.py, there is a line like the following
generic_bases = ("mining_base","mining_base","mining_base","mining_base",)
As far as i know, these station types there are automatically spread across your universe. Maybe it is worth trying to delete them.
Paladin
Explorer
Explorer
Posts: 8
Joined: Fri Oct 05, 2007 2:31 am

Post by Paladin »

Deleting that line fixed the problem, but caused a much worse one - it deleted the inside of every base I landed on.

Do you know if\where this line is referenced elsewhere?
Dilloh
Elite Hunter
Elite Hunter
Posts: 1149
Joined: Mon Aug 14, 2006 3:56 pm
Location: Black Forest, Germany

Post by Dilloh »

If you got the "no room error", then you probably didn't delete the interiors, but caused the python file to malfunction, e.g. by deleting a vital comma or bracket. I'd suggest to post stderr.txt, along with your altered file.
esgaroth
Confed Special Operative
Confed Special Operative
Posts: 317
Joined: Mon Jan 19, 2004 12:48 pm
Location: Konstanz, Germany

Post by esgaroth »

stderr is a good advice. Looks like my favourite python error (almost every python error gives this result....).
You may also try not to delete the whole line but to change to
generic_bases = ()
maybe that works better.
Paladin
Explorer
Explorer
Posts: 8
Joined: Fri Oct 05, 2007 2:31 am

Post by Paladin »

I tried "generic_bases = ()"

near as I can tell, the game acts the same that way as it does unchanged
I'll try posting stderr
Is there a specific place on this forum I should post it?
loki1950
The Shepherd
Posts: 5841
Joined: Fri May 13, 2005 8:37 pm
Location: Ottawa
Contact:

Post by loki1950 »

@Paladin just use the attachment function when you post you may have to zip it but py file are allowed attachments.

Enjoy the Choice :)
my box::HP Envy i5-6400 @2Q70GHzx4 8 Gb ram/1 Tb(Win10 64)/3 Tb Mint 19.2/GTX745 4Gb acer S243HL K222HQL
Q8200/Asus P5QDLX/8 Gb ram/WD 2Tb 2-500 G HD/GF GT640 2Gb Mint 17.3 64 bit Win 10 32 bit acer and Lenovo ideapad 320-15ARB Win 10/Mint 19.2
Paladin
Explorer
Explorer
Posts: 8
Joined: Fri Oct 05, 2007 2:31 am

Post by Paladin »

Alrighty, I've uploaded the files
You do not have the required permissions to view the files attached to this post.
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

Okay thanks.

I think the offending line is on line 110 of generate_dyn_universe.py

It has code to generate bases in each system.
Add an if statement to remove all bases.

The error is coming because it is taking a random number between 0 and 0.

if len(faction_ships.bases[fsfac])==0:
for i in range(numbases):
...

(make sure you indent it right... Python is very picky about indentation, and PhpBB removes spaces)

========

Actually, if you want to be really lazy, make it not add any bases to any systems by disabling the AddBasesToSystem function by returning immediately:

Code: Select all

def AddBasesToSystem (faction,sys):
    return
    if (sys in doNotAddBasesTo):
        return
    ...


EDIT: Make sure you recreate your saved game file. Delete New_Game in the root directory if you have to. This only affects generation of the dynamic universe data.
esgaroth
Confed Special Operative
Confed Special Operative
Posts: 317
Joined: Mon Jan 19, 2004 12:48 pm
Location: Konstanz, Germany

Post by esgaroth »

Actually,
is it possible to spread specific bases to specific realms ? At the moment, iirc all types of bases that are specified as generic bases are spread across all realms. Is it possible to restrict some bases to some realms, and spread there some others ?
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

Right now you can do it based on faction easily.
In fact if you look in faction_ships.py, all the factions are set to generic_bases, but you can replace the generic_bases on each line with a list of bases.

To do it based on a system name would be more work, but it is possible since you know which system you are in, and you can run VS.getGalaxyProperty to get info from the universe XML file if you need to.
esgaroth
Confed Special Operative
Confed Special Operative
Posts: 317
Joined: Mon Jan 19, 2004 12:48 pm
Location: Konstanz, Germany

Post by esgaroth »

So at the moment, it looks like
generic_bases = ("perry","perry",
"new_constantinople","new_constantinople","new_constantinople","new_constantinople",
"mining_base","mining_base","mining_base","mining_base","mining_base","mining_base","mining_base","mining_base","mining_base","mining_base",
"refinery","refinery","refinery","refinery","refinery","refinery",)
bases = (generic_bases,
generic_bases, #kilrathi
generic_bases, #nephilim
generic_bases, #merchant
generic_bases, #retro
generic_bases, #pirates
generic_bases, #hunter
generic_bases, #militia
generic_bases, #unknown
generic_bases,#landreich
generic_bases,#border_worlds
generic_bases, #firekkan
)
could i make something like

generic_basesA=("perry", "perry")
generic_basesB=("new_constantinople")
bases = (generic_bases,
generic_basesA, #kilrathi
generic_basesA, #nephilim
generic_basesB, #merchant
generic_basesA, #retro
generic_basesB, #pirates
)

etc ?
ace123
Lead Network Developer
Lead Network Developer
Posts: 2560
Joined: Sun Jan 12, 2003 9:13 am
Location: Palo Alto CA
Contact:

Post by ace123 »

yes.. but you have an error (not a syntax error but it will cause an annoying run-time error instead).

Beware that a tuple (list) of one element is ("value",) and not ("value")... note the ending comma. If you do not put the comma at the end it will evaluate the parentheses.

Having an extra comma at the end does not hurt, however, so do it in all the lists.
For example:

generic_basesA=("perry", "perry",)
generic_basesB=("new_constantinople",)

you can also specify them directly inline but that might also be more work if that list is used in multiple places.
esgaroth
Confed Special Operative
Confed Special Operative
Posts: 317
Joined: Mon Jan 19, 2004 12:48 pm
Location: Konstanz, Germany

Post by esgaroth »

you can also specify them directly inline.
you mean something like

("perry", "perry",), #nephilim

?
And one more question.
Up to now, it looks like
bases = (generic_bases,
generic_bases, #kilrathi
generic_bases, #nephilim
generic_bases, #merchant
generic_bases, #retro
in bases=(
there is generic_bases, and then the individual factions.
why is generic_bases there in the first line, without any faction following? If i define more than one bases list, do i have to add them also, like

bases=(generic_basesA,
genetic_basesB,
generic_basesA, #kilrathi
etc ?
Post Reply