The Ur-Quan Masters Home Page Welcome, Guest. Please login or register.
Did you miss your activation email?
October 13, 2024, 09:48:44 pm
Home Help Search Login Register
News: Celebrating 30 years of Star Control 2 - The Ur-Quan Masters

+  The Ur-Quan Masters Discussion Forum
|-+  The Ur-Quan Masters Re-Release
| |-+  Technical Issues (Moderator: Death 999)
| | |-+  Starmap Editing - plandata.c
« previous next »
Pages: [1] Print
Author Topic: Starmap Editing - plandata.c  (Read 5761 times)
MasterNinja
Frungy champion
**
Offline Offline

Posts: 80



View Profile
Starmap Editing - plandata.c
« on: January 09, 2008, 05:11:06 pm »

For 2 days I've been tinkering with the Source Code and will *perhaps* make a single-player mod, something like the one Nicholai does (if he still works on it).

For now I'm playing around with the starmap and began to write a small tool to help me with editing the starmap. A search in this forums has revealed that it's "dangerous" to move "special stars", those which have items, homeworlds, aliens or something like that in them, because changing the coordinate also change the seed and therefore may result in a system which does not fit to the assumptions made by the code generating e.g. a homeworld or an item.

But now let's see... I think there are some special locations which are completely safe to move... I have not yet tried that because I first wanted opinion of people who know the code better. So, I think safe are:

Melnorme traders  --  because they are not dependent on any planet but just hang around in their ship, this would not be a problem, I think.

Rainbow worlds -- these are always the first planet in a system and because the game never generates systems WITHOUT planets, they could be moved anywhere and would always find a first planet to turn into a Rainbow World.

Sol -- since this system is completely hardcoded and does not depend on coordinates as seeds (even has it's own seed in it, changing this does slightly changes the system (only minerals on planets and the position of some planets in their orbit), but causes no problems - I've tested that). But of course you will have to change the other two appearances of Sol's coordinated in the Source Code! (just search for "1752")

Can you think of other Stars which would be safe to move? Or do you think I am wrong with one of my ideas?


The idea I have for "unsafe" star systems to move: First I let them at their old place, but want to move them later... Then in the game I will look for another system which meets the preferences for the special world that I want to move... and then I move the special world to this world's coordinates while I put this world to some other place... Do you think this would work?


I've also problems understanding the QuasiSpace portals in plandata.c, could somebody help me?
Code:
// QuasiSpace locations
#define VORTEX_SCALE 20
{{(-12* VORTEX_SCALE) + 5000, (-21 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{( 1 * VORTEX_SCALE) + 5000, (-20 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{(-16 * VORTEX_SCALE) + 5000, (-18 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{( 8 * VORTEX_SCALE) + 5000, (-17 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{( 3 * VORTEX_SCALE) + 5000, (-13 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{(-21 * VORTEX_SCALE) + 5000, (-4 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{(-4 * VORTEX_SCALE) + 5000, (-4 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{(-12 * VORTEX_SCALE) + 5000, (-2 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{(-26 * VORTEX_SCALE) + 5000, (2 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{(-17 * VORTEX_SCALE) + 5000, (7 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{(10 * VORTEX_SCALE) + 5000, (7 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{(15 * VORTEX_SCALE) + 5000, (14 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{(22 * VORTEX_SCALE) + 5000, (16 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{(-6 * VORTEX_SCALE) + 5000, (19 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
{{(10 * VORTEX_SCALE) + 5000, (20 * VORTEX_SCALE) + 5000},
MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},

{{6134, 5900}, MAKE_STAR (DWARF_STAR, YELLOW_BODY, -1), 0, 0, 132},
Logged
Novus
Enlightened
*****
Offline Offline

Gender: Male
Posts: 1938


Fot or not?


View Profile
Re: Starmap Editing - plandata.c
« Reply #1 on: January 09, 2008, 05:46:52 pm »

For now I'm playing around with the starmap and began to write a small tool to help me with editing the starmap. A search in this forums has revealed that it's "dangerous" to move "special stars", those which have items, homeworlds, aliens or something like that in them, because changing the coordinate also change the seed and therefore may result in a system which does not fit to the assumptions made by the code generating e.g. a homeworld or an item.
Can't you change the generator to use the original co-ordinates for seeding (for the problematic cases, or all of them)? That way, you could move systems around HyperSpace without changing their contents and causing problems. The relevant section of src/sc2code/planets/solarsys.c seems to be:

Code:
old_seed = TFB_SeedRandom (MAKE_DWORD (CurStarDescPtr->star_pt.x,
CurStarDescPtr->star_pt.y));

Quote
I've also problems understanding the QuasiSpace portals in plandata.c, could somebody help me?
Not sure what's the problem. They're just a bunch of stars like in HyperSpace; all except the last are portals to HyperSpace, and the last one is Falayalaralfali. The data structure is the same as for HyperSpace (except that "white dwarfs" map to portals and "yellow dwarfs" are Falayalaralfali). Don't tell me the co-ordinates are throwing you off (they're perfectly normal arithmetic expressions).
Logged

RTFM = Read the fine manual.
RTTFAQ = Read the Ur-Quan Masters Technical FAQ.
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Starmap Editing - plandata.c
« Reply #2 on: January 09, 2008, 06:21:03 pm »

Each specially generated solar system has its own file sc2code/plantets/gen*.c. They can there override the default behavior for solar system, world, ships, minerals, bio and energy generation. Often they first call the general generation routine by calling GenerateRandomIP() and then make changes to the result.

I think that your conclusion about the stars which would be safe to move anywhere is correct. Note that you could still move others if you make sure that the new location has certain properties, or if you change the code which depends on these properties.

It looks like quite a lot of the special locations wil be safe to move. Often they just change the first planet. And if they use moons, but set 'NumPlanets' on individual planets in GENERAL_PLANETS, then the moon generation should be ok too.
The Spathi homeworld for instance looks ok to move.

As for the QuasiSpace question, let's look at one of the entries:
{{(-12* VORTEX_SCALE) + 5000, (-21 * VORTEX_SCALE) + 5000},
         MAKE_STAR (DWARF_STAR, WHITE_BODY, -1), 0, 0, 132},
These are fields just like in starmap_array in plandata.c.
The "{(-12* VORTEX_SCALE) + 5000, (-21 * VORTEX_SCALE) + 5000}" part specifies the location of the portal in QuasiSpace. "{5000, 5000}" would be the centre of the map, and "{0, 0}" would be the bottom left. Here the portal is placed "12 * VORTEX_SCALE" units to the left, and "21 * VORTEXT_SCALE" units to the bottom, from the centre of the map. The reason for this VORTEX_SCALE constant seems to be to be able to move all the portals apart just by modifying this one constant.
The "MAKE_STAR (DWARF_STAR, WHITE_BODY, -1)" determines what kind of "star" this would be, but for portals the only thing that this determines is the picture that is used for the portal. It seems that these are taken from a different list of pictures than for normal stars, as the normal portals don't look like white dwarf stars, nor does the Arilou homeworld look like a yellow dwarf star.
The first "0" specifies if special solar system generation code is used; as these "solar systems" are never really entered, these values should just be left to 0.
The last two values specify the prefix and postfix names. Things like "Beta" and "Corvi". These are indices in string tables in starcon.txt from the content. The 0 specifies an empty prefix, and 132 stands for "UNKNOWN".
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
MasterNinja
Frungy champion
**
Offline Offline

Posts: 80



View Profile
Re: Starmap Editing - plandata.c
« Reply #3 on: January 09, 2008, 10:32:41 pm »

Thank you for the posts, ok, I undestood the QuasiSpace Portals...

but where do I find the specifications, where you come out in HyperSpace if you enter a QuasiSpace portal? is this also generated per "seed" from the location of the portal in QuasiSpace?
Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Starmap Editing - plandata.c
« Reply #4 on: January 09, 2008, 11:27:20 pm »

hyper.c, function unhyper_transition(), the portal_pt array.
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Nicholai
Zebranky food
*
Offline Offline

Gender: Male
Posts: 32



View Profile
Re: Starmap Editing - plandata.c
« Reply #5 on: January 23, 2008, 08:17:44 am »

Hey,

I'm excited to see more people messing with this stuff!

I don't know much about the true nature of the code, but I know a great deal (at this point) about how to get a desired effect with a given star system.   Like Meep-Eep was saying; the sc2code/plantets/gen*.c files contain relevant data for overriding the randomly generated star systems. 

Some of them, such as gensol.c, actually dictate the NUMBER of planets in the system, in addtion to their characteristics....  While MOST of the gen* files simply modify the existing characteristics of, say, the second planet in the solar system (whatever that planet may have been randomly generated as).

I've found that the easiest thing to do is just set the new star coordinate, build the game, play it, and if the modified planet (say it's the fifth planet) does not exist (say that the randomly generated system only has three planets) -- then you can just move the star by one coordinate (X or Y) and try again, until the seed presents you with a satisfactory star system.

You can also cheat by using the relevant code in gensol.c to specifically generate a set number of planets IN your star system if you really have your heart set on a SPECIFIC coordinate and star color / size, and need your item/event to be on the fourth moon of the ninth planet (which unlikely to be randomly created at a given spot)

At this point, I've moved every single race, homeworld, item, etc. and created a whole bunch of new ones in addition.......  Anything is possible!
Logged

~ Nicholai
Angelfish
Enlightened
*****
Offline Offline

Posts: 568



View Profile
Re: Starmap Editing - plandata.c
« Reply #6 on: July 23, 2009, 07:36:50 pm »

Don't mind me, just kicking this topic now Wink

If anyone wants to create a mod/clone that is mostly canon, and doesn't want to have to play through SC2/UQM to get the correct data for the planets and star systems, what would be the best way to go about it?

For the hyperspace coordinates it's quite easy as those values are available from the coding, but for the actual number of planets for each starsystem and their types etc it's quite complicated..

I was personally thinking of 2 options:
1) Using the original UQM code and algorhytms  that generated those star systems and using/emulating them in the mod/clone to generate these systems again in the new game. Possible problems could involve not being able to emulate the random number generator correctly.
2) Changing the UQM code to write the star system and planet data to one or multiple easily importable files (for example XML), which can then be used in other mods/clones.

What do you guys think about this? Or are there better options? Smiley
« Last Edit: July 23, 2009, 07:45:44 pm by Angelfish » Logged
meep-eep
Forum Admin
Enlightened
*****
Offline Offline

Posts: 2847



View Profile
Re: Starmap Editing - plandata.c
« Reply #7 on: July 23, 2009, 08:24:49 pm »

Re 1: The RNG implementation can be found in the source code (src/sc2code/libs/math/random*). What's more work is figuring out what exactly is called from where. But it is possible, and Sage has done this for his web-based interactive starmap. See also doc/devel/generate, where I've documented a lot of this myself.
Re 2: The code to do this is already present in UQM. See doc/devel/debug and src/sc2code/uqmdebug.*.
Logged

“When Juffo-Wup is complete
when at last there is no Void, no Non
when the Creators return
then we can finally rest.”
Angelfish
Enlightened
*****
Offline Offline

Posts: 568



View Profile
Re: Starmap Editing - plandata.c
« Reply #8 on: July 23, 2009, 10:27:51 pm »

Thanks for your quick response Meep-eep! I'll check out option 2, because it seems to be the easiest one Smiley.
Logged
Angelfish
Enlightened
*****
Offline Offline

Posts: 568



View Profile
Re: Starmap Editing - plandata.c
« Reply #9 on: July 23, 2009, 10:57:46 pm »

As for option 2: Looks like someone has already done just that Cheesy
http://forum.uqm.stack.nl/index.php?topic=3447.msg58744#msg58744
Logged
logarithm
Zebranky food
*
Offline Offline

Gender: Male
Posts: 32



View Profile
Re: Starmap Editing - plandata.c
« Reply #10 on: November 01, 2015, 12:42:02 pm »

As for option 2: Looks like someone has already done just that Cheesy
http://forum.uqm.stack.nl/index.php?topic=3447.msg58744#msg58744
Hi, anyone tried to import this data back into the game? Smiley I'm interested in having a code which would do the import (in context new effort).
Probably, gonna have to write it myself anyway... ))
Logged
CelticMinstrel
Enlightened
*****
Offline Offline

Posts: 522



View Profile
Re: Starmap Editing - plandata.c
« Reply #11 on: November 02, 2015, 07:25:26 pm »

It wouldn't be possible to import the data back into the game without major changes to the code. The game normally generates this data on the fly when starting.
Logged
Pages: [1] Print 
« previous next »
Jump to:  


Login with username, password and session length

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!