XUniverseWizard - Random universe generator

The place to discuss scripting and game modifications for X²: The Threat.

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

Orca42
Posts: 27
Joined: Sat, 8. Nov 08, 00:57

XUniverseWizard - Random universe generator

Post by Orca42 » Sat, 15. Nov 08, 14:06

Hi,

although X2 is quite old, I have spent the last weeks on developing a universe generator engine for it. The aim is to create universes from scratch that do fit well into the gameplay. Sector layout, races, stations etc. should be well balanced. I'm using some of the files from XeHonk's editor, many thanks for that.

I just released an alpha version of the generator as an Open Source project, hosted on sourceforge. To use it, you need Java 6.

To download, follow this link:
http://sourceforge.net/projects/xuniversewizard/
Just download xuniversewizard-0.1-bin.zip. (the other archive contains the source code)
If you just want to have a quick overview, simply run the "build_default.bat". The program will create an X2 compatible galaxy map "output-x2galaxy.xml", that you can either open with XeHonk's editor or load in the in-game editor.

Currently, the universes created will be playable only with some restrictions. For instance, there are no ships in the sectors, no equipment docks, no shipyards and some other stuff is missing too, see below for more details.

Features already implemented:
  • Various settings for the generator engine, contained in an XML build file, like universe size, race balancing, pirate sectors, number of asteroids etc. More information how to alter the generator settings can be found here: http://xuniversewizard.wiki.sourceforge ... figuration
  • Creates Sectors of all races, including Xenon, Khaak and Unknown as well as gates to connect them
  • Creates stations in each sector (except Xenon, Khaak, Unknown). The stations will be created in a way that overall gameplay will be balenced!
  • Creates asteroids, planets and suns and sets sector background images
Planned features for future versions:
  • Creating shipyards and equip docks
  • Creating free ships in the sectors
  • Generating content for Xenon, Khaak and Unknown sectors
  • Nebulae, sector names, soundtracks and various other details
  • Support for X3: Reunion
There are some minor issues in the alpha version, for more details see the release notes ioncluded in the download archive.

Since this was designed as an Open Source project, everybody should feel invited to participate! You will need coding abilities in Java and/or XSLT. Just send me a message if you are interested. :)

The source code is available for download on the project homepage. You may also access the SVN. The main topic that I would like to have someone supporting me is the design for X3 or even X3 TC. Since my hardware is quite old, I most certainly am not able to do the translation of the engine for the newer games.

Feedback much appreciated!
So long, and thanks for all the fish.

User avatar
Zeron-mk7
Posts: 571
Joined: Sat, 23. Feb 08, 12:38
x3

Post by Zeron-mk7 » Wed, 19. Nov 08, 08:01

I have question, ok generating costum map, but what with 00749.BOD file, without 00749.BOD file new sectors dont show in game, every time you generating costum map you also need for this costum map 00749.BOD file to see in game new sectors.

Orca42
Posts: 27
Joined: Sat, 8. Nov 08, 00:57

Post by Orca42 » Thu, 20. Nov 08, 13:48

Currently I'm using a bod file that shows all sectors in a very simple way.
For future versions of the generator, there might be a feature that the sector map will be created along with the galaxy.xml.
So long, and thanks for all the fish.

Orca42
Posts: 27
Joined: Sat, 8. Nov 08, 00:57

Post by Orca42 » Mon, 1. Dec 08, 19:31

New release: XUniverseWizard 0.2

https://sourceforge.net/projects/xuniversewizard/

The generated universes will now have enough features to be playable in a serious way. Shipyards will be created and offer a various, but balanced range of stations for the player to buy. The gate network was heavily improved, fragmented universes should only occur in rare cases.

List of changes:
  • Improved gate network
  • Creates shipyards, equipment docks and piers
  • Creates free ships in sectors
  • Full support for Xenon and Khaak sectors, including Xenon shipyards
  • Suns will not be blocked by planets
  • Added more TS ships to trading stations
So long, and thanks for all the fish.

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Tue, 2. Dec 08, 03:10

This is an interesting script/mod! Love the idea behind it.

What drove you to do this? YOu know much about perlin noise?

Code: Select all

Suns will not be blocked by planets.
What does that mean?
Hello there!! (Jumping up and down)

Orca42
Posts: 27
Joined: Sat, 8. Nov 08, 00:57

Post by Orca42 » Tue, 2. Dec 08, 11:07

Well, I know about perlin noise, but I did not use that for the generator. Mainly it was just that creating a full, well-balanced universe by hand would take several weeks and is still most of the time rather stupid work, so I decided to spend some more time on writing an automated generator that produces billions of different universes...

In version 0.1, there was a chance that suns and planets were created in the same direction, seen from the center of the sector. So you could have a planet sitting "in front" of a sun (actually, X2 will display the sun anyway, but it still lokks bad).

There is also a small but rather important thing missing in v0.2, as there is no Goner Temple with jumpdrives and insurances to buy.
So long, and thanks for all the fish.

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Wed, 3. Dec 08, 11:39

Orca42 wrote:Well, I know about perlin noise, but I did not use that for the generator. Mainly it was just that creating a full, well-balanced universe by hand would take several weeks and is still most of the time rather stupid work, so I decided to spend some more time on writing an automated generator that produces billions of different universes...

In version 0.1, there was a chance that suns and planets were created in the same direction, seen from the center of the sector. So you could have a planet sitting "in front" of a sun (actually, X2 will display the sun anyway, but it still lokks bad).

There is also a small but rather important thing missing in v0.2, as there is no Goner Temple with jumpdrives and insurances to buy.
Jumpdrives? Who needs em.

I went behind a planet. It was dark and lonely. It had a lot of "atmosphere" until I could see that the sun shows through the planet. That's lame! I wouldn't care if there were a few sectors where the sun is blocked - it might make it feel different than others with the sun.

And I think it's someting cool that you're doing this. I agree that the generating a universe is a lot easier than doing it by hand. The problem is you'll take more time making the gererator than it would have taken had you done it by hand. On the "other hand", you'll save time for others :)

Orca42
Posts: 27
Joined: Sat, 8. Nov 08, 00:57

Post by Orca42 » Fri, 12. Dec 08, 22:11

New release: XUniverseWizard 0.2.1

https://sourceforge.net/projects/xuniversewizard/

List of changes:
  • sectors will have names and soundtracks
  • different types of planets and suns will be created, matching the sector's style
  • added Goner Temple and TerraCorp HQ
So long, and thanks for all the fish.

Orca42
Posts: 27
Joined: Sat, 8. Nov 08, 00:57

Post by Orca42 » Tue, 13. Jan 09, 21:26

XUniverseWizard 0.3

https://sourceforge.net/projects/xuniversewizard/

List of changes:
  • Nebulae in sectors
  • Suns and nebulae have proper colours
  • Generates an in-game map file (xxx00749.txt)
  • Generates printable map files (.svg, Scalable Vector Graphics, German and English)
  • Improved pirate sector economy; more industry and better food production
  • Creates some Nividium asteroids
  • Gates to Unknown and Khaak sectors as well as some pirate bases will be shrouded by nebulae and large asteroids
  • Stations will keep more distance to gates
  • Every race will own at least one sector, even in small universes
  • Automatic checks whether Xenon/Khaak/Unknown sectors split the universe
  • Additional gates between neighbouring sectors decrease detours
  • Generic sector names, allowing universes with maximum number of sectors
  • Guaranteed minimal distance between multi-star sectors
  • New build file options
  • Command line option to generate sector statistics (.csv table)
  • Bugfix: Bad sector connections caused the game to freeze
  • Bugfix: Equipment docks contained wrong merchandise
  • Bugfix: Some weapon forges had wrong race preferences
You can view and print the .svg galaxy map using Firefox or any other browser (except IE...). There are two files, the one with a 44 in it is in English language.

The in-game galaxy map is still a flat version, although the generator supports some 3D variations. I could not figure out yet how to set object rotations properly.
So long, and thanks for all the fish.

Jonson27
Posts: 170
Joined: Thu, 3. Jun 04, 14:08
x2

Post by Jonson27 » Fri, 23. Jan 09, 11:37

Wow. You been busy much? :)

The stations have supply ships yet? Any trading going on? I'm not trying to be pushy, just curious. You know what you're doing, and it's fun to watch what happens.
Hello there!! (Jumping up and down)

Orca42
Posts: 27
Joined: Sat, 8. Nov 08, 00:57

Post by Orca42 » Sat, 24. Jan 09, 13:17

Of course do all stations have supply ships and trading works fine.
So long, and thanks for all the fish.

User avatar
3iff
Posts: 1085
Joined: Thu, 23. Oct 03, 09:52
x2

Post by 3iff » Fri, 13. Mar 09, 15:10

Hi,

Trying this and it looks good.

One request. How do I create a new galaxy without nebulas? My PC isn't up to running well with them in (stripped them out of my custom galaxy). I've read the guide but there's no switch to exclude nebula creation.

Can you help?

Thanks.
...locating mandolin strings in the middle of Austin.

User avatar
3iff
Posts: 1085
Joined: Thu, 23. Oct 03, 09:52
x2

Post by 3iff » Wed, 18. Mar 09, 09:07

Spent the weekend trying a new random galaxy...fantastic! A few teething troubles getting it to work and some manual editing to incorporate some custom ships but it's really great exploring a new galaxy.

I'm going to have to experiment a bit now I can get it to work. Actually, the nebulas aren't too bad, except for the hull eating ones which I hate. I'll have to edit those out manually.

Thanks.
...locating mandolin strings in the middle of Austin.

User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi » Wed, 18. Mar 09, 11:59

@3iff:

I haven't tested this thing, but I had a look at the xml-files. It seems if you edit the file xml/Nebulae.xml and comment or delete all lines with the 'effects="hulldamage"' tag, you won't get any of these.

I too don't know of any swith to exclude nebulae creation. But at least you could try my suggestion - I'm pretty sure it works, because Orca skipped the asteroid field nebulae this way.
--------------------------------

[ external image ]

User avatar
3iff
Posts: 1085
Joined: Thu, 23. Oct 03, 09:52
x2

Post by 3iff » Wed, 18. Mar 09, 13:22

Thanks, I'll give that a try...I've generated a mini-map (9 by 7) successfully...with a combination of this program and Xehonks editor, I have a nividium asteroid of 86 (yes, 86)...

Just for testing purposes of course.

I had a quick look at the other files but didn't get far as I've only been on it a few days.
...locating mandolin strings in the middle of Austin.

User avatar
3iff
Posts: 1085
Joined: Thu, 23. Oct 03, 09:52
x2

Post by 3iff » Wed, 18. Mar 09, 16:20

Chris Gi.

Tried editing the nebulae.xml file removing (or commenting) the hull eating lines but the program fails with errors. Don't think it's due to editing mistakes on my part.

Seems like I'll have to live with the program as it is and manually edit out anything I don't want. I'm not able to modify the java code...but I can manage with the stuff it generates.

Thanks for the suggestion anyway.
...locating mandolin strings in the middle of Austin.

User avatar
Chris Gi
Posts: 960
Joined: Wed, 20. Sep 06, 09:57
x3tc

Post by Chris Gi » Thu, 19. Mar 09, 15:53

I also tried this, but I too get error messages. Too bad this doesn't work. :(
--------------------------------

[ external image ]

User avatar
3iff
Posts: 1085
Joined: Thu, 23. Oct 03, 09:52
x2

Post by 3iff » Thu, 19. Mar 09, 16:05

Yeah, strange...as least it confirms it wasn't an error on my part.

It's not really difficult to scan through the galaxy and chop out things I don't like. It's not as if I'm creating dozens of new maps.

Thanks for your efforts!
...locating mandolin strings in the middle of Austin.

Orca42
Posts: 27
Joined: Sat, 8. Nov 08, 00:57

Post by Orca42 » Fri, 20. Mar 09, 17:19

Hi,

unless you mess with the java code, there is no way to disable nebula creation. (EDIT: A solution may be to alter the x2universe.xslt file; just look for the template element on "nebula" and disable/delete those three lines)
Deleting nebulae with hull damaging effects should disable these, that should work fine. However, the generator will just create other nebulae instead - the number of nebulae in a sector is determined independently from the contents of nebulae.xml. If you delete too many or even all nebulae, the generator might dead-lock.

I might spend some time on the generator over the next days, so I will probably add more switches (including some for nebulae) to the build file since that is the most urgent concern, I guess.

btw, what specific error messages did you get?
So long, and thanks for all the fish.

User avatar
3iff
Posts: 1085
Joined: Thu, 23. Oct 03, 09:52
x2

Post by 3iff » Wed, 25. Mar 09, 12:06

I edited xml/nebula.xml to edit the hull eating nebulas with blank lines...like this

<nebula id="47" colour="turquoise" size="1" backgroundColour="!crimson, !red" />
<!-- id 48: extremely large yellow line, skip -->
<!-- id 49: extremely large yellow line, skip -->

where 48 and 49 are hull eaters. Then generate...


Build custom universe
=====================


XUW - X Universe Wizard
Version 0.3
10:53:17,820: Initiating universe...
10:53:18,398: Building sectors...
10:53:18,398: Creating universe of size 10x6 containing 30 sectors
10:53:18,461: Creating gates...
10:53:18,523: Setting up sector inventories...
10:53:18,523: Creating asteroids...
10:53:18,586: Creating stations...
10:53:18,789: Creating docks...
10:53:18,851: Creating sector backgrounds...
10:53:18,867: Creating suns...
10:53:19,757: Creating planets...
10:53:19,773: Creating ships...
10:53:19,773: Creating special objects...
10:53:19,789: Creating nebulae...
10:53:19,804: Error during build:
java.lang.NullPointerException
at xutools.universe.creators.astronomy.NebulaCreator.determineNebulae(Ne
bulaCreator.java:436)
at xuniversewizard.core.XUW.generateUniverse(XUW.java:228)
at xuniversewizard.core.XUW.main(XUW.java:381)
10:53:19,804: Your universe could not be build due to errors!
10:53:19,804: Universe random number seed: -5250429191680400048

Press any key to continue . . .

----------------------------------------

As I only generate a small galaxy (10 * 6 or so) it's no hardship to manually edit the sectors to chop out hull eaters.

If you're adding things, I'd like a feature to change number of stations per sector. I find that small galaxies have insufficient local stations and often there's absolutely no demand for ore/silicon other than stations I build. For such a galaxy, having say 15 stations per sector would make the galaxy more interesting that the average of about 10 stations per sector.

Otherwise, this is a great program. It's more interesting to really explore a new galaxy (having played the original a few dozen times!). I've also added my own custom ships to the code (as per your instructions) and it all works wonderfully. Thanks.
...locating mandolin strings in the middle of Austin.

Post Reply

Return to “X²: The Threat - Scripts and Modding”