Pages: [1] 2
|
|
|
Author
|
Topic: Randomizing locations (Read 3604 times)
|
RenaissanceMan
Zebranky food
Offline
Posts: 2
|
First post here.
So I was thinking... I know NOTHING about programming... but how hard would it be to take the source code and tweak it so that the starting locations of the various and items were somewhat randomized (or even pseudo-randomized) instead of fixed assets? Think about how replay value and extra interest it would add for experienced players! There would need to be a few parameters specified for story/logic reasons. That I can think of off the top of my head (SPOILERS):
- Ur-Quan and Kohr-Ah space must heavily overlap - other spheres of influence should not overlap - Sun Device must be in Mycon space - all Shattered Worlds must be in or near Mycon space - Utwig Bomb must be in Utwig space (since they describe themselves as the "Stewards of the Bomb") - Aqua Helix must be in Thraddash space (since a lot of dialogue refers to it being the cornerstone of their culture) - Sa-Matra must be in Ur-Quan/Kohr-Ah space - UNKNOWN star (natural Quasi-Space portal) must be in or near Arilou space - Supox space should be near Utwig space - Zoq-Fot-Pik space should be in or near Ur-Quan/Kohr-Ah space - starting location (Sol) must not be within anyone else’s space (game would be near impossible if you started in the center of Ilwrath or Ur-Quan space) - Rainbow Worlds should form a rough arrow (but orientation and obliquity are randomizable)
But within those parameters, there are countless possibilities for randomization, and thus for interesting new exploration. Imagine having to search for the Sun Device, or for the Sa-Matra, or for the Utwig, all over again... and again... and again!
My point is that this doesn't SEEM like it should be that hard from a programming perspective... but maybe I'm wrong. Can any programmers tell me if this is even within the realm of possibility?
|
|
|
Logged
|
|
|
|
Krulle
Enlightened
Offline
Gender:
Posts: 1117
*Hurghi*! Krulle is *spitting* again!
|
Has been proposed before, but how will you handle the text by the internal help system (Melnorme)?
re: unknown star: you could place it anywhere, and move the Arilou space with it....
|
|
|
Logged
|
|
|
|
|
RenaissanceMan
Zebranky food
Offline
Posts: 2
|
I didn't mean randomizing all the star system data (i.e. the starmap, how many/what kind of planets each star has). I was envisioning the map itself staying the same, but where things are ON the map being more randomized.
As for what Krulle said about the unknown star, yes, that's what I meant for all of the parameters I listed. Arilou space could be anywhere on the map, but wherever it is, the UNKNOWN star needs to be in or near it. Utwig space could be anywhere on the map, but wherever it is, the Bomb needs to be in it, etc.
How hard would all that be to program?
And yes, I did imagine that the dialogue tied to specific locations would be far harder (or at least more tedious) to change. Like I said, I know nothing about programming, but I would imagine you would have to define the location of each race and object as a variable, then scour the dialogue for each and every reference to a specific geographic location and replace it with a string designed to point to the correct variable. So, for example, instead of Tanaka telling you about observing a strange Mycon ceremony on Beta Brahe I, the code would say "a strange Mycon ceremony on %STRING1" or something like that, where %STRING1 is designed to point to where is assigned to the Mycon Sun Device in this iteration of the game. I don't know how hard that would be... but it would certainly be tedious.
Again, is this even in the realm of possibility? It seems like a couple of people could maybe do this over a summer or something...? Am I crazy?
|
|
|
Logged
|
|
|
|
JHGuitarFreak
Enlightened
Offline
Posts: 1374
|
I was envisioning the map itself staying the same, but where things are ON the map being more randomized.
That's more or less what I was talking about.
As for what Krulle said about the unknown star, yes, that's what I meant for all of the parameters I listed. Arilou space could be anywhere on the map, but wherever it is, the UNKNOWN star needs to be in or near it. Utwig space could be anywhere on the map, but wherever it is, the Bomb needs to be in it, etc.
How hard would all that be to program?
And yes, I did imagine that the dialogue tied to specific locations would be far harder (or at least more tedious) to change. Like I said, I know nothing about programming, but I would imagine you would have to define the location of each race and object as a variable, then scour the dialogue for each and every reference to a specific geographic location and replace it with a string designed to point to the correct variable. So, for example, instead of Tanaka telling you about observing a strange Mycon ceremony on Beta Brahe I, the code would say "a strange Mycon ceremony on %STRING1" or something like that, where %STRING1 is designed to point to where is assigned to the Mycon Sun Device in this iteration of the game. I don't know how hard that would be... but it would certainly be tedious.
Again, is this even in the realm of possibility? It seems like a couple of people could maybe do this over a summer or something...? Am I crazy?
The main problem you would run into is that you would need to make it so it would only randomize once and save that particular random seed in each save file so it could be recalled.
I don't particular know how the dialog works. From a cursory glance it looks as though it's structured in blocks of text and audio that gets called from a variable in the code.
Text file:
#(HOSTILE_SPACE_HELLO_1) thraddash-000.ogg So, what's this? SNORT! An unknown alien species? How wonderful! Someone new to fight! We, the Thraddash of Culture Nineteen -- famous Ur-Quan Combat Thralls know well the value of a good fight. Either you win and prove your superiority... SNORT! Or you lose and are vanquished. If the vanquished is lucky, it may survive to learn an important lesson from its defeat. This is the way of the Thraddash! We fight and learn and improve! All other cultural schemes are inferior. This is a proven fact. What have you to say before we begin combat?
Relevant code:
NumVisits = GET_GAME_STATE (THRADD_VISITS); switch (NumVisits++) { case 0: NPCPhrase (HOSTILE_SPACE_HELLO_1); break; case 1: NPCPhrase (HOSTILE_SPACE_HELLO_2); break; case 2: NPCPhrase (HOSTILE_SPACE_HELLO_3); break; case 3: NPCPhrase (HOSTILE_SPACE_HELLO_4); --NumVisits; break; } SET_GAME_STATE (THRADD_VISITS, NumVisits);
This means that you would have to hard code the star location dialogue and split the old dialogue up into a minimum of 3 blocks to fit the new variable in where it would be mentioned.
At least that's the way I see it. There could be a much more elegant way to do it that I'm not picking up looking at the Thraddash dialogue blocks.
|
|
|
Logged
|
The artist once again known as Kohr-Ah Death 213. Get your MegaMod HERE
|
|
|
CelticMinstrel
Enlightened
Offline
Posts: 522
|
Wasn't there someone working on exactly this last year? Or at least something similar.
|
|
|
Logged
|
|
|
|
Death 999
Global Moderator
Enlightened
Offline
Gender:
Posts: 3874
We did. You did. Yes we can. No.
|
Yes, there was.
|
|
|
Logged
|
|
|
|
TalkingPet
Zebranky food
Offline
Posts: 6
|
I did some work on this a while ago, and managed to get randomized placement of alien "fleets" and home planets without too much pain.
As others have said the real difficulty would be updating the in game text to be dynamic and match the new star system.
There's also the issue of placing things meaningfully - the pkunk should be close to the ilwrath, the ZFP should be within urquan space, etc.
I'm thinking about returning to this soon if I have time but I think updating the dialogue system might be a huge task. It would probably be a better use of time to abstract out a lot of this stuff rather than trying to get it to work within the existing system.
|
|
|
Logged
|
|
|
|
TalkingPet
Zebranky food
Offline
Posts: 6
|
for anyone interested my brief and hacky way of getting to the above was by making a function which "shuffled" the "alien presence" field of starmap_array in plandata.c. Then I called that function in InitGameStructures of globdata.c.
The meaty part is actually only a few lines of code:
// shuffles the homeworlds to random stars. void RandomizeStarIndexDefines () { // DO NOT DISTRIBUTE THESE WEIRD ONES! We leave sol at sol and melnorme at super hots //SOL_DEFINED = 1, //MELNORME0_DEFINED, //MELNORME1_DEFINED, //MELNORME2_DEFINED, //MELNORME3_DEFINED, //MELNORME4_DEFINED, //MELNORME5_DEFINED, //MELNORME6_DEFINED, //MELNORME7_DEFINED, //MELNORME8_DEFINED, // TODO: shuffle rainbows but keep some pattern // RAINBOW_DEFINED,
BYTE anywhereShuffles[] = { // basic species / spheres of influence SHOFIXTI_DEFINED, SPATHI_DEFINED, ZOQFOT_DEFINED, SYREEN_DEFINED, SLYLANDRO_DEFINED, DRUUGE_DEFINED, MYCON_DEFINED, PKUNK_DEFINED, UTWIG_DEFINED, SUPOX_DEFINED, YEHAT_DEFINED, VUX_DEFINED, ORZ_DEFINED, THRADD_DEFINED, ILWRATH_DEFINED,
// Sa Matra is used to define urquan space! SAMATRA_DEFINED,
// don't care where special events! URQUAN_WRECK_DEFINED, VUX_BEAST_DEFINED, START_COLONY_DEFINED, BURVIXESE_DEFINED, };
// erase it from the list int shuffleIndex, i; for(shuffleIndex = 0; shuffleIndex < sizeof(anywhereShuffles)/sizeof(BYTE); ++shuffleIndex) { for (i = 0; i < NUM_SOLAR_SYSTEMS; i++) { if(starmap_array[i].Index == anywhereShuffles[shuffleIndex]) starmap_array[i].Index = 0; } }
// now add it back at a random unoccupied location for(shuffleIndex = 0; shuffleIndex < sizeof(anywhereShuffles)/sizeof(BYTE); ++shuffleIndex) { int randomLoc; do { randomLoc = RAND(NUM_SOLAR_SYSTEMS); } while(starmap_array[randomLoc].Index != 0); starmap_array[randomLoc].Index = anywhereShuffles[shuffleIndex]; }
// TODO: these events need to be within specific spheres of influence // VUX space // MAIDENS_DEFINED, // UMGAH space // TALKING_PET_DEFINED, // ILWRATH space // CHMMR_DEFINED, // UTWIG space // BOMB_DEFINED, // THRADDASH space // AQUA_HELIX_DEFINED, // MYCON space // SUN_DEVICE_DEFINED, // EGG_CASE0_DEFINED, // EGG_CASE1_DEFINED, // EGG_CASE2_DEFINED, // --Not in but close!-- // MYCON_TRAP_DEFINED, // ORZ space // TAALO_PROTECTOR_DEFINED, // ANDROSYNTH_DEFINED, // URQUAN space // SHIP_VAULT_DEFINED, // Zoq scout? Zoq colony? the fuck is this? // ZOQ_SCOUT_DEFINED, // ZOQ_COLONY0_DEFINED, // ZOQ_COLONY1_DEFINED, }; There were also a few helpers and fixups for places that later relied on hardcoded stuff.
There are a bunch of problems still to be solved with an approach like this:
- dialogue correction (hard)
- placing special stars (like the ship vault, the mycon trap star, the precursor bomb etc) within the right space (easy-ish)
- making sure that related spheres of influence are close (easy-ish)
- making fleets move to the right place for special events like pkunk returning to yehat (not sure how hard).
I also never tried to actually play through so like someone mentioned above I'm not sure how much it will break on save/reload.
It's really just a proof of concept hack and not real solution. BUT I think all the above CAN be sorted out, with dialogue being the hardest nut to crack.
There is already some support in the code for insertions - for inserting your captain name, your ship name, and the alliance name.
For example in starbas.c there is the following code:
construct_response ( shared_phrase_buf, tell_me_about_fuel0, GLOBAL_SIS (ShipName), tell_me_about_fuel1, (UNICODE*)NULL); which references this struct:
typedef struct { SIS_STATE SIS_state; GAME_STATE Game_state; } GLOBDATA; It shouldn't be too hard to add some more state for the positions of all the shuffled stuff and set it up when randomizing the locations. Any dialogue that references that stuff would have to have some code added to it's comms file to use construct_phrase, but that shouldn't be too hard, just kind of tedious. It might be possible to write a better solution but that would take some more architecting whereas just doing what they do for ship/captain name could work with some brute force.
|
|
« Last Edit: September 17, 2017, 11:46:17 pm by TalkingPet »
|
Logged
|
|
|
|
Death 999
Global Moderator
Enlightened
Offline
Gender:
Posts: 3874
We did. You did. Yes we can. No.
|
So with this code you also didn't shuffle the Ur-quan?
|
|
|
Logged
|
|
|
|
TalkingPet
Zebranky food
Offline
Posts: 6
|
The urquan sphere of influence is defined by the location of the sa-matra, which I do shuffle in that code.
edit to add: I want to reiterate that what I posted is pretty hacky, it gets the star map I showed above, but is pretty far from a complete solution.
|
|
|
Logged
|
|
|
|
Death 999
Global Moderator
Enlightened
Offline
Gender:
Posts: 3874
We did. You did. Yes we can. No.
|
I'd keep the Sa-Matra near the middle, because it's… pretty central, and makes getting around a little less convenient.
|
|
|
Logged
|
|
|
|
|
TalkingPet
Zebranky food
Offline
Posts: 6
|
Just using coordinates would definitely be a little bit easier, but I think most of the dialogue falls into a few buckets:
- a specific "special star" (like the exact home star)
- just the constellation that a special star is directly in
- a constellation NEAR to a special star
- coordinates near the special star
The constellation NEAR a star is hardest but if I add a function like "give me all the star indices of stars in your sphere of influence" and then just pick one randomly that should work.
I think what I can do is build a special string table that has an entry for each of the buckets, for each of the special stars, and then insert that into dialogue.
There might also be a few edge cases where they name specific directions like "coreward" or phrase things in a fluffy way like "the third star of gemini" or something that I might just hack out the dialogue like you suggest (change it to be one of the buckets above).
|
|
|
Logged
|
|
|
|
|
Pages: [1] 2
|
|
|
|
|