[TOOL] X4 Universe Generator

The place to discuss scripting and game modifications for X4: Foundations.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

celludriel
Posts: 163
Joined: Thu, 12. Sep 13, 11:29
x4

[TOOL] X4 Universe Generator

Post by celludriel » Sun, 16. Dec 18, 13:34

Hey guys,

I made this tool to help me create a portion of the X3 universe. It is capable of generating any universe you design in JSON format, including the full x3 universe if you so would desire, in x4 compatible format.
I deem it now in a stable condition and released the latest version. I tried to be clear in the instructions but a basic knowledge about what java is and how java works is recommended. There are lots of tutorials on the web explaining what java is.

Github Repository

an example json input file you can find here: warexperiment.json . Take note in the clusters it uses in the backdrop: "empty_space" , this is a custom backdrop of mine. Replace them all with cluster_01 and you'll have a working example.

If there are any questions let me know. I'll prob iterate a few things in the tool over the next weeks/months but this release is a stable working one.

Instructions
==========
- Install the latest java 1.8 JDK (Java 1.8 JDK)
- Make sure java is working by opening command line and typing java --version
- download the latest jar from the releases and put it in a folder of your choosing
- create an input json use warexperiment.json as an example
- navigate to the folder with the jar inside and copy your json file into it
- java -cp universe-generator-1.4.1.jar be.celludriel.universegenerator.main.UniverseGeneratorMain "yourfile.json"
- an output folder is now created in your folder containing the mod for the galaxy

get json schema
==============
I've added an option to generate the json schema, just run: java -jar universe-generator-1.4.1.jar yourfile.json generateSchema

It will output the entire json schema to the console

Version History
==============
2021-04-16 Release 1.4.1 universe-generator-1.4.1.zip
- Clusters with letters caused the datavaults to fail
- Gamestarts where the Cluster had a capital letter failed to load the game

2021-04-16 Release 1.4.0 universe-generator-1.4.0.zip
- X4 4.0 compatible with several fixes

2018-12-26 Release 1.2.1 universe-generator-1.2.1.jar
- Fixed major bug in Y calculation of clusters
- Removed deprecated property starterZoneName
- Ship factions in jobs are now always in an array

2018-12-20 Release 1.2.0 universe-generator-1.2.0.jar
- Paranid gamestart description
- Fix for Argon gamestart not having a weapon
- Full X3 galaxy example as stresstest
- Fix for Antigone Guild Missions not triggering (note you have to make an Antigone equipmentdock in Antigone FactionHq space, or it will not work)
- When a player switches zones now the zone name will be shown
- Datavaults will spawn in the universe you create , you need a minimum of 28 clusters !!!

2018-12-17 Release 1.1.0 universe-generator-1.1.0.jar
- Bugifx research not being applied
- You can generate a schema now by adding generateSchema as second parameter
- You can now opt to have double travel mode speed in the galaxy
- First iteration on placable objects in the galaxy currently only claimable ships

2018-12-16 Release 1.0.0 universe-generator-1.0.0.jar
Last edited by celludriel on Fri, 16. Apr 21, 21:43, edited 12 times in total.

SpaceCadet11864
Posts: 364
Joined: Tue, 4. Dec 18, 02:14
x4

Re: [TOOL] X4 Universe Generator

Post by SpaceCadet11864 » Sun, 16. Dec 18, 17:33

very cool, thanks for sharing :)

celludriel
Posts: 163
Joined: Thu, 12. Sep 13, 11:29
x4

Re: [TOOL] X4 Universe Generator

Post by celludriel » Sun, 16. Dec 18, 22:16

I've added an option to generate the json schema. It's not released yet and on the develop branch. It will release together with version 1.1 that will add the ability to randomly add abandoned ships in the universe on creation

celludriel
Posts: 163
Joined: Thu, 12. Sep 13, 11:29
x4

Re: [TOOL] X4 Universe Generator

Post by celludriel » Mon, 17. Dec 18, 13:00

Released version 1.1.0

A bugfix and some new features changelog in main post

celludriel
Posts: 163
Joined: Thu, 12. Sep 13, 11:29
x4

Re: [TOOL] X4 Universe Generator

Post by celludriel » Thu, 20. Dec 18, 21:00

I've released version 1.2.0 with fixes to the output galaxy. Also there will need to be a min of 28 clusters now to have a valid galaxy there are 28 datavaults that need to spawn across at least 28 clusters

balogt
Posts: 773
Joined: Thu, 18. Dec 03, 09:00
x3

Re: [TOOL] X4 Universe Generator

Post by balogt » Fri, 21. Dec 18, 01:41

any chance someone can give a brief step by step on how to use this tool. I doenlaoded the java 191 and 192 tools but when I click on the unverse generator and open with the java program nothing happens. I assume there is a magic way to use this tool but never have before. any help would be appreciated.
Martin

balogt
Posts: 773
Joined: Thu, 18. Dec 03, 09:00
x3

Re: [TOOL] X4 Universe Generator

Post by balogt » Fri, 21. Dec 18, 02:08

hum I actually think I got it, thanks to ages old dos skills

balogt
Posts: 773
Joined: Thu, 18. Dec 03, 09:00
x3

Re: [TOOL] X4 Universe Generator

Post by balogt » Fri, 21. Dec 18, 02:58

so I noticed I have an x3 style universe, but the background starfields are all black. I assume they didn't load as there are new file names that this utility didn't laod in. anyone else see this as well?

mellimell
Posts: 31
Joined: Wed, 30. Mar 16, 18:28
x4

Re: [TOOL] X4 Universe Generator

Post by mellimell » Fri, 21. Dec 18, 09:52

This sounds interesting...will the universe generator also be applicable to existing games?

celludriel
Posts: 163
Joined: Thu, 12. Sep 13, 11:29
x4

Re: [TOOL] X4 Universe Generator

Post by celludriel » Fri, 21. Dec 18, 18:32

balogt wrote:
Fri, 21. Dec 18, 02:58
so I noticed I have an x3 style universe, but the background starfields are all black. I assume they didn't load as there are new file names that this utility didn't laod in. anyone else see this as well?
If you look at the json I use

"backdrop": "empty_space",

in the clusters, this is actually a custom backdrop I made. Try switching this to for example cluster_01, this is one of the backdrops from the vanilla game. You should see some space then. Let me know if it doesn't
mellimell wrote:
Fri, 21. Dec 18, 09:52
This sounds interesting...will the universe generator also be applicable to existing games?
Unfourtunatly not, the galaxy is tied to the savegame, so once you start a game and save it that particular galaxy will be stored into the savegame. So you can't alter it , unless you savegame hack

marco07
Posts: 1
Joined: Thu, 8. Nov 12, 07:17
x4

Re: [TOOL] X4 Universe Generator

Post by marco07 » Sat, 22. Dec 18, 01:30

I'm not very bright when it comes to this type of thing. How difficult would it be for someone with no JAVA experience to add 1-3 neutral systems between each main faction e.g. Second Contact II & True Sight. Bright Promise & Trinity Sanctum.

celludriel
Posts: 163
Joined: Thu, 12. Sep 13, 11:29
x4

Re: [TOOL] X4 Universe Generator

Post by celludriel » Sat, 22. Dec 18, 02:21

marco07 wrote:
Sat, 22. Dec 18, 01:30
I'm not very bright when it comes to this type of thing. How difficult would it be for someone with no JAVA experience to add 1-3 neutral systems between each main faction e.g. Second Contact II & True Sight. Bright Promise & Trinity Sanctum.
Not that hard you could patch them into the existing files. However you will need to start a new game. Also this will have nothing to do with java whatsoever, but with understanding XML and Xpath. I can't explain everything in a single post but read up on the following

https://github.com/enenra/x4modding/wik ... e-Creation

this guide isn't perfect and the author does assume you already know some stuff and didn't leave any full examples. However it helped me understanding how everything works. So to recap , skills needed

- Xml
- Xpath
- Understanding how a galaxy works in X4

balogt
Posts: 773
Joined: Thu, 18. Dec 03, 09:00
x3

Re: [TOOL] X4 Universe Generator

Post by balogt » Sat, 22. Dec 18, 12:38

Any chance you have a list of available cluster_01 types so I can vary up my galaxy before re doingthe json file. I assume there are more like cluster_02 etc etc. or simply where can I look to itemize them.
thanks

celludriel
Posts: 163
Joined: Thu, 12. Sep 13, 11:29
x4

Re: [TOOL] X4 Universe Generator

Post by celludriel » Sat, 22. Dec 18, 14:33

balogt wrote:
Sat, 22. Dec 18, 12:38
Any chance you have a list of available cluster_01 types so I can vary up my galaxy before re doingthe json file. I assume there are more like cluster_02 etc etc. or simply where can I look to itemize them.
thanks
You can find all of them in assets\environments\cluster after you unpack the game somewere. If you look at my x3galaxy mod you can also learn how to make your own. My empty_space one is in that distribution. Let me know if you need more info

tigar
Posts: 14
Joined: Mon, 9. Jan 12, 11:43
x4

Re: [TOOL] X4 Universe Generator

Post by tigar » Sat, 22. Dec 18, 14:45

the skybox(stars and suns) seem to be missing from the example one you gave it might be the 1.5 update or something else but ya it leads to some interesting looks

https://steamuserimages-a.akamaihd.net/ ... 858A2748D/


{Images posted directly to the forums should not be greater than 640x480 or 100kb, oversize image now linked - Terre}

celludriel
Posts: 163
Joined: Thu, 12. Sep 13, 11:29
x4

Re: [TOOL] X4 Universe Generator

Post by celludriel » Sat, 22. Dec 18, 16:52

tigar wrote:
Sat, 22. Dec 18, 14:45
the skybox(stars and suns) seem to be missing from the example one you gave it might be the 1.5 update or something else but ya it leads to some interesting looks
That is because I didn't include the assets for empty_space in the generator, the example is actually for my x3 galaxy TC

viewtopic.php?f=181&t=408787#p4808134

I've updated the OP with a warning about this behavior

balogt
Posts: 773
Joined: Thu, 18. Dec 03, 09:00
x3

Re: [TOOL] X4 Universe Generator

Post by balogt » Sun, 23. Dec 18, 02:43

Got them all placed in. Lastly how would i add more asteroids beyond what the cluster pack has by default. This can busy up alot of the sectors. Btw looks good thus far. When im done ill share it out.

celludriel
Posts: 163
Joined: Thu, 12. Sep 13, 11:29
x4

Re: [TOOL] X4 Universe Generator

Post by celludriel » Sun, 23. Dec 18, 09:19

balogt wrote:
Sun, 23. Dec 18, 02:43
Got them all placed in. Lastly how would i add more asteroids beyond what the cluster pack has by default. This can busy up alot of the sectors. Btw looks good thus far. When im done ill share it out.
The clusters have a belts property you can use as this:

Code: Select all

  "clusters": [
    {
      "id": "01",
      "name": "Argon Prime",
      "description": "Argon Prime",
      "music": "music_cluster_02",
      "sunlight": "1",
      "economy": "0.75",
      "security": "0.75",
      "x": 0,
      "y": 0,
      "backdrop": "empty_space",
      "factionHq": "ARGON",
      "factionStart": {
        "faction": "ARGON",
        "name": "The Argon Saga",
        "playerName": "Vel Driar",
        "description": "The Argon Federation is a proud place to call home: the center of culture, science and learning in the universe. This pride is born of a long and storied history; of a bold and daring risk to lure the greatest threat the universe has known away from Earth and a sacrifice to save a home they would never return to. The Argon people were forced to began anew in a place unfamiliar to them and have thrived since. Do you have what it takes to continue this saga?"
      },
      "connections": [
        {
          "targetClusterId": "03",
          "connectionType": "SE"
        },
        {
          "targetClusterId": "05",
          "connectionType": "S"
        }
      ],
      "stations": [
        {"type": "SHIPYARD", "race":  "ARGON", "owner": "ARGON", "faction": "ARGON"},
        {"type": "WHARF", "race":  "ARGON", "owner": "ARGON", "faction": "ARGON"},
        {"type": "DEFENCE", "race":  "ARGON", "owner": "ARGON", "faction": "ARGON"}
      ],
      "belts": [
              {"type": "ORE", "x":  "-100000", "y": "100000", "rotation": "250"},
      ]
    },
This will disable random belt placement for this specific cluster. You have the following belts available

ORE, ICE, HYDROGEN,HELIUM, METHANE, NVIDIUM;

killerog
Posts: 3464
Joined: Fri, 28. Oct 05, 16:31
x4

Re: [TOOL] X4 Universe Generator

Post by killerog » Sun, 23. Dec 18, 14:49

Thought I would post a quick sneak peak of the tool me and celludriel are working on. This will generate the JSON that is used by his tool. Its very early in its development so its a bit rough around the edges still.

Image
Image

balogt
Posts: 773
Joined: Thu, 18. Dec 03, 09:00
x3

Re: [TOOL] X4 Universe Generator

Post by balogt » Sun, 23. Dec 18, 23:59

I remember when you just started getting into the modding circle killerog, you have come along way Sir. thanks for the asteroid code as well.

Post Reply

Return to “X4: Foundations - Scripts and Modding”