Page 1 of 1

Temporary Factions

PostPosted: Thu Mar 07, 2019 12:25 pm
by shadowmane20
Is there a python code to activate a temporary faction? Say I want to have an in-system faction or two who are in a political battle over control of the system. I could use two of the factions in the game, but it would be much simpler to add a code to a campaign to create two (or more) temporary, in-system factions who you could help, hinder, or ignore (to your detriment). I've searched through some of the missions and quests to see if anything presented itself, but I've found nothing.

Re: Temporary Factions

PostPosted: Thu Mar 07, 2019 1:11 pm
by TBeholder
Unlikely, factions are at least partially hardcoded.

Re: Temporary Factions

PostPosted: Thu Mar 07, 2019 1:22 pm
by shadowmane20
How about a separate factions.xml for them? You would have to add another factions_xml_gen.py for them, as well as a faction_ships.py as well. Could it be done by sidestepping the hardcoding?

Re: Temporary Factions

PostPosted: Fri Mar 08, 2019 3:00 pm
by TBeholder
Well, you can add a ton of custom factions, of course. With logos, ship lists and whatever else they need.
I just don't see support for manipulating this data. In the source there's LoadFactionXML, it runs only once in src/universe_generic.cpp, and that's it.

Re: Temporary Factions

PostPosted: Fri Mar 08, 2019 3:13 pm
by shadowmane20
But isn't that what a scripting language is for. To add things that aren't hard coded in the source?

Edit: Geez. This game really don't want you mucking around in the factions_ships.py file.

Re: Temporary Factions

PostPosted: Sun Mar 10, 2019 10:10 am
by shadowmane20
So how about another angle. I was thinking about this. If you use factions.xml to deal with the major and minor "powers" (Aera, Confederation, Rlaan, Shmrn, Forsaken, Uln, etc.), that establishes the relation between them. You then break down each "power" into another xml file that shows the factions within that power and how they relate to one another. You could even break that down another time or two and create subfactions of subfactions.

For instance, when you start the game, the Aera are hostile towards you. Why? Why would a typical Aeran care about a washed up ex-military pilot trading cargo? They would have their sights on bigger fish, like that military transport over there carrying war supplies. The only way they would care about you is if you tried to defend said military transport, or were mistaken for said military transport. However, an Aeran privateer (if such a beast existed) would probably have a vested interest in stopping you from smuggling that contraband into the Aeran Acendancy that he could carry himself. In other words, the Aeran military and/or government would not care if you existed unless you broke one of their laws or interfered in one of their military campaigns. But the Aeran civilian could very well have a reason to stop you from what you are doing.

You would simply create python classes that put the subfactions together with the factions in factions.xml and you would have a more robust system. You might not even have to tweak the c++ code that much to get it to work.

Re: Temporary Factions

PostPosted: Sun Mar 10, 2019 12:52 pm
by shadowmane20
TBeholder wrote:Well, you can add a ton of custom factions, of course. With logos, ship lists and whatever else they need.
I just don't see support for manipulating this data. In the source there's LoadFactionXML, it runs only once in src/universe_generic.cpp, and that's it.


Code: Select all
void Universe::Init( const char *gal )
{
    ROLES::getAllRolePriorities();
    LoadWeapons( VSFileSystem::weapon_list.c_str() );
    galaxy.reset(new GalaxyXML::Galaxy( gal ));
    static bool firsttime = false;
    if (!firsttime) {
        LoadFactionXML( "factions.xml" );
        firsttime = true;
    }
    script_system = NULL;
}


So it loads it there. What does it do with it? Where is the code for what it does with it? It says "script_system= NULL;". Does that mean there is a script that can be called to do something with this if it's not "NULL"?

Also, why does it start with this:

Code: Select all
using namespace GalaxyXML;


Should that not say milky_wayXML?

Re: Temporary Factions

PostPosted: Sun Mar 10, 2019 2:35 pm
by TBeholder

Re: Temporary Factions

PostPosted: Sun Mar 10, 2019 5:47 pm
by shadowmane20
Wow. You know where all the code is. Do you have some kind of search function going on there, or do you just work with the code that much?

Re: Temporary Factions

PostPosted: Sun Mar 10, 2019 6:56 pm
by loki1950
There is an overall structure to the whole code base after all the founders of the project all hold Phd's in computer science currently :wink: which is most likely why they have life to live instead of contributing to the project.

Enjoy the Choice :)

Re: Temporary Factions

PostPosted: Mon Mar 11, 2019 2:31 pm
by TBeholder
I just go straight for text search in the local copy of repository. It's far too big and was overwritten too much to guess a lot. Beyond the few things already personally explored, that is.
Though IDE lookup isn't bad either.

Re: Temporary Factions

PostPosted: Mon Mar 11, 2019 8:02 pm
by shadowmane20
I've got TortoiseSVN up and running. I've also got Visual Studio 2017 installed. I've started using Visual Studio to look at the Python files now. It showed me a lot of little errors (I think) in the campaign file I was working on.

The only SVN version I have been able to get running without crashing is the one jacks put up in 2015 on Sourceforge. The newest flavor crashes on me. I can make a jump from Cephid 17 to Stirling. But when I go to jump into Bernards Star, it dumps me. Also, the jumps remain active, which is annoying. I'd file a bug report, but I don't even know why it's dumping me.

Having looked at that code, it would take some work to get sub-factions the way I had them envisioned in my head when I started this thread.

Re: Temporary Factions

PostPosted: Tue Mar 12, 2019 6:25 pm
by shadowmane20
repost