Author Topic: Modding  (Read 4191 times)

0 Members and 1 Guest are viewing this topic.

Offline Agm-114 (OP)

  • Pulsar 4x Dev
  • Registered
  • Chief Petty Officer
  • ***
  • Posts: 41
  • Thanked: 16 times
  • Discord Username: AGM-114#7218
Modding
« on: April 17, 2020, 02:30:03 PM »
Well I figure it's probably worth having a dedicated modding thread.
I'll append any mods people make to this post.
« Last Edit: April 23, 2020, 10:03:59 AM by Kyle »
 
The following users thanked this post: Warer

Offline Agm-114 (OP)

  • Pulsar 4x Dev
  • Registered
  • Chief Petty Officer
  • ***
  • Posts: 41
  • Thanked: 16 times
  • Discord Username: AGM-114#7218
Re: Modding
« Reply #1 on: April 17, 2020, 02:41:10 PM »
So kyle, from past experience modding aurora, one of the main issues is that the game's database structure will make updating mods a bit difficult.

Let's take a hypothetical mod "Agm's trade good adjustment mod"



Which changes the req to produce to civ infrastructure to 25 million to make setting up a colony a bit tougher.
The issue is that installing this mod requires a DB swap so it can't be used with existing saves and can't be updated very easily to new DB versions.   

My suggestion would be to move read only data tables like Installations, materials, name themes, ranks, trade goods, etc to a separate DB.
I'm not sure if that's viable but it'd def be super helpful.
 

Offline MasonMac

  • Registered
  • Warrant Officer, Class 1
  • *****
  • M
  • Posts: 93
  • Thanked: 31 times
Re: Modding
« Reply #2 on: April 17, 2020, 02:58:13 PM »
Why not run a script that transfers the old saves to the new db?
 

Offline Agm-114 (OP)

  • Pulsar 4x Dev
  • Registered
  • Chief Petty Officer
  • ***
  • Posts: 41
  • Thanked: 16 times
  • Discord Username: AGM-114#7218
Re: Modding
« Reply #3 on: April 17, 2020, 03:47:59 PM »
Yeah if it comes, and kyle's ok with it I'll probably release a script. However that's a bit of a hacky solution that I'd like to avoid if  possible.
 

Offline Kyle

  • Moderator
  • Captain
  • *****
  • K
  • Posts: 472
  • Thanked: 973 times
  • Quasar4x dev
Re: Modding
« Reply #4 on: April 17, 2020, 07:57:06 PM »
Two databases is a good idea but there a few read-only-but-not-really tables that muddy up the waters on the idea of multiple db's.  Pretty relevant tables too, such as TechSystem: (this may also be a reason against it happening on C# by the way)



Any new research project you create gets added here but this also contains vanilla stuff like fuel tanks.

I strongly advise not to write a script that migrates an existing game into a new db.  That's a lot of work and would be incredibly easy to mess up and would cause all kinds of very-very-nasty bugs.  I also don't recommend providing a drop-in db, because the database gets updated fairly regularly as I add more helper columns and tables.  Instead, put a database modification script in your on_program_load file.  It would be pretty simple.  Say you wanted to remove the Trans-Newtonian Tech requirement on Flag Bridge.  You could have the following in your on_program_load function:

update TechSystem set Prerequisite2 = 0 where TechSystemID = 225 and Prerequisite2 = 27434

The "Prerequisite2 = 27434" section nicely skips the update if some other mod has already messed with that field or a future database version has fiddled with it.  Doing it this way ensures that your mod is still active even after future database updates.  If, for arguments sake, the entire Prerequisite2 column got deleted (it wont) making your mod no longer compatible, then the SQL would harmlessly fail.  Bad SQL fails silently, it doesn't crash.

You would just have to give the user a caveat that your mod is permanent and if they want to revert the change they'll have to redownload the database file.  (Which is the same amount of work that would be required for the database-dropin approach anyway.)
 

Offline Agm-114 (OP)

  • Pulsar 4x Dev
  • Registered
  • Chief Petty Officer
  • ***
  • Posts: 41
  • Thanked: 16 times
  • Discord Username: AGM-114#7218
Re: Modding
« Reply #5 on: April 17, 2020, 08:12:19 PM »
Thanks kyle!

On the front of tech systems would it be possible to split it into two separate tables?
« Last Edit: April 17, 2020, 08:15:52 PM by Agm-114 »
 

Offline Kyle

  • Moderator
  • Captain
  • *****
  • K
  • Posts: 472
  • Thanked: 973 times
  • Quasar4x dev
Re: Modding
« Reply #6 on: April 17, 2020, 08:27:03 PM »
*You* can if you want.  It's pretty trivial, just rename the existing TechSystem table, then create a view with the name TechSystem that pulls from two tables unioned together.  *I'm* not going to do that though :)  My philosophy has been to touch the schema as little as possible and it's served me well.
 

Offline Agm-114 (OP)

  • Pulsar 4x Dev
  • Registered
  • Chief Petty Officer
  • ***
  • Posts: 41
  • Thanked: 16 times
  • Discord Username: AGM-114#7218
Re: Modding
« Reply #7 on: April 17, 2020, 08:28:03 PM »
Gotcha

Edit: Forms are weird I send gotcha and it takes up like half my screen lmao.
« Last Edit: April 17, 2020, 08:35:59 PM by Agm-114 »
 

Offline Warer

  • Lieutenant
  • *******
  • Posts: 174
  • Thanked: 73 times
Re: Modding
« Reply #8 on: November 19, 2020, 11:31:20 AM »
How do i mod Q4x? What tools are needed if any and things like that?
 

Offline Droll

  • Vice Admiral
  • **********
  • D
  • Posts: 1703
  • Thanked: 599 times
Re: Modding
« Reply #9 on: January 09, 2021, 08:32:34 PM »
How do i mod Q4x? What tools are needed if any and things like that?

I'd like to know this as well
 
The following users thanked this post: Warer

Offline Kyle

  • Moderator
  • Captain
  • *****
  • K
  • Posts: 472
  • Thanked: 973 times
  • Quasar4x dev
Re: Modding
« Reply #10 on: March 01, 2021, 07:51:53 AM »
There's an example mod you can look at in /mods/example/.  I recommend downloading Godot (standard version) so you can open the included godot.project file.  Godot isn't required but it's nice for syntax coloring and auto-completion.
 
The following users thanked this post: Warer

Offline atestuojaq3

  • Able Ordinary Rate
  • a
  • Posts: 1
Re: Modding
« Reply #11 on: March 25, 2021, 03:58:16 AM »
wow thnx for sharing ,
« Last Edit: March 25, 2021, 04:00:13 AM by atestuojaq3 »
 

Offline Warer

  • Lieutenant
  • *******
  • Posts: 174
  • Thanked: 73 times
Re: Modding
« Reply #12 on: July 31, 2021, 07:25:02 PM »
There's an example mod you can look at in /mods/example/.  I recommend downloading Godot (standard version) so you can open the included godot.project file.  Godot isn't required but it's nice for syntax coloring and auto-completion.
...............???????????
I have no idea what im looking at, much less what im suppoused to do xp and DB edits do nothing
 

Offline Agm-114 (OP)

  • Pulsar 4x Dev
  • Registered
  • Chief Petty Officer
  • ***
  • Posts: 41
  • Thanked: 16 times
  • Discord Username: AGM-114#7218
Re: Modding
« Reply #13 on: August 07, 2021, 12:52:37 PM »
What are you trying to do?

Most of the scripting in the example mods is just stuff to handle mode options / loading & unloading / verifications.