The Ur-Quan Masters Discussion Forum

The Ur-Quan Masters Re-Release => General UQM Discussion => Topic started by: Wingnut on June 10, 2003, 04:38:11 pm



Title: Random Planets & Resourse
Post by: Wingnut on June 10, 2003, 04:38:11 pm
Hello!  I'm a new on forum, 9 years in SC2, just love planet&galaxy exploration, and got a question:
As far as I can understand (I don't know C or C++ :-[ ), star chart is set in plandata.c, and acording to Fred Ford, number of planets/moons and minerals location on each generated on the seed of star destination. So they are, in fact, fixed.
The question is, how can I randomize them? Must I change star chart a liitle? Yes, I seached the forum, and still doesn't understand that. Dear ALL, answer to me please.


Title: Re: Random Planets & Resourse
Post by: meep-eep on June 10, 2003, 06:30:45 pm
To change the planets, moons, and minerals, you can probably just modify the initial seed (just adding 1 to them for instance would give completely different results). If you want to decouple them all from the same seed, and make them more random, you would need to store your choices for your seeds (or all choices themselves) in the savegame itself. Which would be a problem if you don't know C.
An added problem, even if you'd just change the seed, would be that for the special locations, existing planets are just modified. This will go wrong if by chance there aren't as many planets (so for instance changing planet 3 when there is only one planet).
Note that this is all theoretical, based on what I know of the source. I haven't actually tried it.



Title: Re: Random Planets & Resourse
Post by: youBastrd on June 10, 2003, 06:32:54 pm
Howdy, I'm new to this forum as well.  Welcome to us both :)

I've been working on a side project, Star System Editor, for a good while now.  It's written in Java.  The goal is to be able to edit star systems, manipulating things like stars, planets, and moons, and export in an easily read format.  It'll likely be open source soon, so if you don't like the output format or want to add another type of cestial object to edit, you should be able to without problem.  Hopefully, you'll be able to place things like ships, starbases, comets, and dust clouds; and be able to edit each of their attributes.  

Project Homepage
http://publish.uwo.ca/~pjforest/timewarp.html

Discussion thread
http://dynamic.gamespy.com/~timewarp/ikonboard/ikonboard.cgi?s=3ee5bbd5427cffff;act=ST;f=13;t=14


Title: Re: Random Planets & Resourse
Post by: Wingnut on June 10, 2003, 07:16:08 pm
Meep-eep, thanks for answer. i looked at the code and figured it out too (about modif. Random.c). I looked more at various GEN???.c files that generate all plot-critical events. Looks like GenerateIP() in charge for generating planet (more likely) or sustem. If Planet, then changing Random.c can only results in misplaced energy devices in different location on the same planet (no worries!). Am I right?


Title: Re: Random Planets & Resourse
Post by: Wingnut on June 10, 2003, 07:22:30 pm
Oops, sorry, found out myself. It REALLY generate Systems, so I understand now. What I don't understand is HOW TFB_Random can give needed results for placing Energy Devices on right planet? I try to look at the code more, but explanations are heartily welcome!


Title: Re: Random Planets & Resourse
Post by: Death 999 on June 10, 2003, 08:13:51 pm
One solution is to leave systems containing modifications alone, and change the others.


Title: Re: Random Planets & Resourse
Post by: meep-eep on June 10, 2003, 08:49:00 pm
Wingnut: The placement of energy devices isn't done by use of TFB_Random. It's a two-stage process: first, (pseudo-)randomly, but with a fixed seed, the planets are generated. This is done in sc2code/planets/solarsys.c. Then, (at the appropriate time) specific locations are changed to suit the storyline. This is done in the sc2code/planets/gen* files.
Death_999: I think that will work. It looks like the seed used in generating the planets is initialised from the star coordinates. Those seeds could be changed for the systems with no alien presense.


Title: Re: Random Planets & Resourse
Post by: Wingnut on June 11, 2003, 10:29:15 am
Death_999: That was the first thought after reading Fred explanation about generating, and I'm afraid will be the only solution. But to change star locations will result in starmap.c (copyright check) not working. If coordinates will be changed by X+1 (0,1 on chart), is that enough for completely new universe or not? What do you think?
My friend promised me to lend some books on C, so I gonna dig into code once more (still doesn't understand how seed & pseudo-random generation work).


Title: Re: Random Planets & Resourse
Post by: Wingnut on June 11, 2003, 08:18:23 pm
Now making head & tale from generation chain. Think that if I undestand way of calculation number of planets & moons, it is possible to alter random.c  and ajust critical planets locations to change universe, yet not get in situation you refer to, Meep-eep (about device in system not apearring 'cause there aren't enough planets :o).
And looks like yes, changing X and Y just by 1 can drasticaly change system content.
Will be digging 4 next holidays, BIG THANKS to Meep-eep and Death_999 for support  :)))


Title: Re: Random Planets & Resourse
Post by: Wingnut on June 11, 2003, 08:24:29 pm
Oh, almost forgot! Death_999, are you still writing technical FAQ on UQM? i 'll  definetly be glad to use it, 'cause now i have only faint ideas of "how to compile, add content and run all that stuff on W98".


Title: Re: Random Planets & Resourse
Post by: Death 999 on June 11, 2003, 08:54:45 pm
Well, I had some quasi-avoidable delays. Tonight is probably my starting point. Very likely it will be done tomorrow evening (around 2 am GMT the day after tomorrow).


Title: Re: Random Planets & Resourse
Post by: guesst on June 12, 2003, 06:16:46 am
You know. This makes me wonder. What would be the effect of mearly adding a randomize() line using something like the system's timer to the start of UQM? How much would change every time and would minerals move around everytime you reloaded the game?


Title: Re: Random Planets & Resourse
Post by: meep-eep on June 12, 2003, 07:12:57 pm
That's actually done in some places (for instance for battle). However for different parts of the game different seeds are used. Changing them all to use a non-static seed would cause inconsistencies in the game, probably with crashes as a result.


Title: Re: Random Planets & Resourse
Post by: Wingnut on June 18, 2003, 12:57:06 pm
Yes! Finally got UQM builded under VC6++(haven't compiled anything ever).  Changed some star coordinates (Sirius and A Mira) and got completely new systems! Also change B mira to green and got a new system as well (interesting...). I have written a program to autochange coordinates, but its on 1C (internal lang), and I don't know any external lang well enough. My friend suggest to learn Perl a liitle, have to think about it. A programm must also ensure that accending order on Y on coord. will remain (else you get error in UQM).
Anyway, thanks again everyone for support, especially Meep-eep.