.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $6.00

   







Go Back   .com.unity Forums > Digital Eel > Weird Worlds: Return to Infinite Space > Scenarios and Mods

 
 
Thread Tools Display Modes
  #1  
Old January 12th, 2007, 04:58 PM

Phlagm Phlagm is offline
Corporal
 
Join Date: Jan 2007
Location: Austin, TX
Posts: 151
Thanks: 0
Thanked 0 Times in 0 Posts
Phlagm is on a distinguished road
Default Request: some randomness

I noticed that there is some user accessable randomness in the game (such as fomax's failure to understand your request: "ITEM random life"), but I don't know if there is an option for a random integer generator.

Being able to put somethign like random minval maxval in place of any integer value would GREATLY help the quality of my mod, and the cleanliness of the code. DOes anything like this currently exist?

Here's how I would use it: There are a number of quests that I want to start out identically, but then act differently depending on your choice of actions. Currently, what I do is simply make 2 or 3 copies of the quest and flag them identically, so only one will load. If I had a random generator, I could simply send users to a random PAGE (1-3 for example) and thus get all three options in under the same quest.

I'm also looking at doing somethings that take variable amounts of time. It would be preferable to be able to set a range of times. "The following will take a few weeks, do you want to proceed?" Then I could have the YSNO with random PAGE numbers for the yes options, the times randomized and I could put about 5 quests in one page and get rid of lots of the predictability of the alternative.

Is there any option other than what I have been doing thus far? If so, how do I use it? If not, how difficult would it be to implement in a future patch?
  #2  
Old January 13th, 2007, 06:40 PM
Fingers's Avatar

Fingers Fingers is offline
Sergeant
 
Join Date: Jun 2005
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
Fingers is on a distinguished road
Default Re: Request: some randomness

Sorry, there's no random number generator accessible to the quests. It could be useful, but would require a lot of internal changes; any command that currently uses numbers would need to be parsed in some new way that'd allow you to insert a random statement instead of a number.
  #3  
Old January 14th, 2007, 01:03 PM
Psientist's Avatar

Psientist Psientist is offline
Sergeant
 
Join Date: Apr 2004
Location: Tampa Bay, Florida, USA
Posts: 327
Thanks: 5
Thanked 33 Times in 11 Posts
Psientist is on a distinguished road
Default Re: Request: some randomness

I had suggested earlier, a "random number generator" kludge. Set up a number of events with the same flag (so only one gets chosen). Set the same variables in each event, but with different numbers. For example

EVENT 1: VAR1=1, VAR2=1, VAR3=1
EVENT 2: VAR1=2, VAR2=2, VAR3=9, etc.

Randomly, only one of those events will be chosen, which can then establish "random" preset values for all your global variables.

Inconvenient, but possible.

Sorry for not using actual mod-compliant language.
  #4  
Old January 14th, 2007, 09:57 PM

Phlagm Phlagm is offline
Corporal
 
Join Date: Jan 2007
Location: Austin, TX
Posts: 151
Thanks: 0
Thanked 0 Times in 0 Posts
Phlagm is on a distinguished road
Default Re: Request: some randomness

Oh, not a bad idea at all, I'll have to try experiment with that.

Thanks

-Jeremy
  #5  
Old August 8th, 2007, 10:38 PM

sgqwonkian sgqwonkian is offline
Sergeant
 
Join Date: Aug 2007
Location: Seattle
Posts: 231
Thanks: 3
Thanked 13 Times in 10 Posts
sgqwonkian is on a distinguished road
Default Re: Request: some randomness


Psientist and Phlagm,

Any luck with the "random number generator" kludge you'd discussed? Does it work?

I tried something similar to make random items generate at the start of the game for you to trade for at Glory. The ITMS command doesn't seem to work at Glory - just the more specific ITEM command does. So I made a bunch of quests with a "havenstuff" key.

If I set the quests with an "always" flag, it would generate the first quest on the list alphabetically every time you played.

If I set the quests with an "event" flag, it'd only generate items at all about 50% of the time, and when it did there'd be one less place/esmeralda/nova/jumboshrimp etc in the universe that game. It kinda worked, but it made the universe less interesting when it did.

So now I'm left considering a third option... I could take every existing ally and event quest, and add a section near the beginning with
STAR #
FLAG existing
PLNT hope
ITEM itemname
END STAR

Pros: A different random selection of equipment would be available every game.

Cons: After playing the mod enough times a person could come to figure out "If Haven has a proton matrix, that means I'm going to be sabotaged. If Haven has a gatling laser, that means a star is going to go nova." etc.

That Con kinda bugged me, so I chose to use method #2 (events that do nothing but generate starting stuff) for my Teeming With Life mod.

But the reason I mention this is that if you're using it to generate hidden variables, this third method would work great for you.
You could have the haven quest (or brass or pirate quests) initialize the variables, and then have each (or some portion) of ally and event quests increment them by various numbers.
It'd all be invisible to those playing the mod - unlike my starting equip idea, there'd be nothing for them to reference at the start of a game and deduce what events were destined.
__________________
WW:RTIS & modding: http://transitivegaming.blogspot.com...abel/WW%3ARTIS
Other gaming stuff: http://transitivegaming.blogspot.com
  #6  
Old November 9th, 2007, 10:33 PM

mantari mantari is offline
Private
 
Join Date: May 2007
Posts: 38
Thanks: 0
Thanked 1 Time in 1 Post
mantari is on a distinguished road
Default Re: Request: some randomness

I realize that significant patches for this game are probably dead, but I'd handle the problem by (the developers) creating a few new variables. I dunno. Say...

rand5
rand10
rand50
rand100

These would be converted into a constant that would remain the same random number throughout the game.

Not the greatest for modders, but it would be likely be a whole lot easier for the devs to plug into the game engine.
  #7  
Old November 11th, 2007, 04:37 PM

mantari mantari is offline
Private
 
Join Date: May 2007
Posts: 38
Thanks: 0
Thanked 1 Time in 1 Post
mantari is on a distinguished road
Default Re: Request: some randomness

Quote:
Phlagm said:
I noticed that there is some user accessable randomness in the game (such as fomax's failure to understand your request: "ITEM random life"), but I don't know if there is an option for a random integer generator.
Oh! You gave me an idea! You'd have to account for all your various lifeforms but, the flowchat would go something like this?

ITEM random life
If you haveitem (lifeform1) then set RND=1 and REMV lifeform1
If you haveitem (lifeform2) then set RND=2 and REMV lifeform2
If you haveitem (lifeform3) then set RND=3 and REMV lifeform3

Could that be done at the start of the game?

Basically, you give the player a random lifeform, and depending on which one it is, you set a random number, and then remove that lifeform?
  #8  
Old November 13th, 2007, 05:20 PM

mantari mantari is offline
Private
 
Join Date: May 2007
Posts: 38
Thanks: 0
Thanked 1 Time in 1 Post
mantari is on a distinguished road
Default RANDOM GENERATOR PROTOTYPE

Okay. I made a prototype for a random generator. This is just a prototype. It needs tweaking. And this would likely best go into haven.ini so it is generated at the start of each game. (That would prevent existing inventory from screwing this up.)

COST: This requires that you reduce the number of lifeforms in the game, because the random generation of lifeforms is what is used to create a random number. In this example, I chose: lookfrog, eel, foureyed, lummox, serpvine, plasworm, threep, bloater, piranbee, windbag.

NOTE: The randomness is not highly random. We're telling to to randomly set 5 out of 10 bits. Sometimes, it'll set 4 out of 10 bits, because of some weirdness with ITEM RANDOM LIFE.

For our random 0-4 number, we see how many of the first 5 bits are set. Most of the time, it'll be 2 or 3, rarely 0, rarely 4.

For our random 0-7 number, we take three bits, and binary add (1+2+4) them to make a random number 0-7.

There are certain relationships between the two sets of numbers that are more probable than others.

Anyhow, just a prototype. Here is the code. Again, requires that you reduce the number of lifeforms to a specific set, before the code works properly. The chance that no individual bits or all individual bits are set are 0%. If you're working under a condition where bit0 is set, there is a 45% chance that bit1 is also set. If you're working under a condition were bit0 and bit1 are set, there is only a 37% chance that bit2 is set.

I won't dive into a possibility matrix, because this is only a prototype random generator.

Code:

FLAG event always
KEYS unstablestar2

STAR 0
UVAR randready 0
STRT msq_yellow
STRN Omni0
PLNC grassland
FLAG nearby
END STAR

CONDITION 0
TYPE explore
STR0 0
END CONDITION

CONDITION 1
TYPE uvar
STR0 randready
STR1 0
END CONDITION

CONDITION 2
TYPE haveitem
STR0 lf_lookfrog
END CONDITION

CONDITION 3
TYPE haveitem
STR0 lf_eel
END CONDITION

CONDITION 4
TYPE haveitem
STR0 lf_foureyed
END CONDITION

CONDITION 5
TYPE haveitem
STR0 lf_lummox
END CONDITION

CONDITION 6
TYPE haveitem
STR0 lf_serpvine
END CONDITION

CONDITION 7
TYPE haveitem
STR0 lf_plasworm
END CONDITION

CONDITION 8
TYPE haveitem
STR0 lf_threep
END CONDITION

CONDITION 9
TYPE haveitem
STR0 lf_bloater
END CONDITION

CONDITION 10
TYPE haveitem
STR0 lf_piranbee
END CONDITION

CONDITION 11
TYPE haveitem
STR0 lf_windbag
END CONDITION

PAGE 0
REQ0 0
ITEM random life
ITEM random life
ITEM random life
ITEM random life
ITEM random life
END PAGE

PAGE 1
REQ0 1
SVAR randA 0
SVAR randB 0
SVAR randC 0
SVAR randD 0
SVAR randE 0
SVAR randF 0
SVAR randG 0
SVAR randH 0
SVAR randI 0
SVAR randJ 0
SVAR rand5 0
SVAR rand8 0
SVAR randready 1
END PAGE

PAGE 2
REQ0 0
END PAGE

PAGE 3
REQ0 0
REQ1 2
REMV lf_lookfrog
SVAR randA 1
INCV rand5 1
END PAGE

PAGE 4
REQ0 0
REQ1 3
REMV lf_eel
SVAR randB 1
INCV rand5 1
END PAGE

PAGE 5
REQ0 0
REQ1 4
REMV lf_foureyed
SVAR randC 1
INCV rand5 1
INCV rand8 1
END PAGE

PAGE 6
REQ0 0
REQ1 5
REMV lf_lummox
SVAR randD 1
INCV rand5 1
INCV rand8 2
END PAGE

PAGE 7
REQ0 0
REQ1 6
REMV lf_serpvine
SVAR randE 1
INCV rand5 1
INCV rand8 4
END PAGE

PAGE 8
REQ0 0
REQ1 7
REMV lf_plasworm
SVAR randF 1
END PAGE

PAGE 9
REQ0 0
REQ1 8
REMV lf_threep
SVAR randG 1
END PAGE

PAGE 10
REQ0 0
REQ1 9
REMV lf_bloater
SVAR randH 1
END PAGE

PAGE 11
REQ0 0
REQ1 10
REMV lf_piranbee
SVAR randI 1
END PAGE

PAGE 12
REQ0 0
REQ1 11
REMV lf_windbag
SVAR randJ 1
END PAGE

PAGE 13
REQ0 0
TEXT RANDOM 0-4: <uvar=rand5><BR>RANDOM 0-7: <uvar=rand8><BR>BITMAP:
<uvar=randA><uvar=randB><uvar=randC><uvar=randD><u var=randE>
<uvar=randF><uvar=randG><uvar=randH><uvar=randI><u var=randJ>
END PAGE



Sample output --
RANDOM 0-4: 1
RANDOM 0-7: 4
BITMAP: 0000110111
  #9  
Old November 14th, 2007, 01:14 PM

mantari mantari is offline
Private
 
Join Date: May 2007
Posts: 38
Thanks: 0
Thanked 1 Time in 1 Post
mantari is on a distinguished road
Default Re: RANDOM GENERATOR PROTOTYPE

I moved the code into haven.ini so that it would automatically run at the start of each game. The individual items need a bit of reordering (for better readability), but it evaluates correctly.

Now, you may have 14 lifeforms. Also, instead of 5 of the 10 bits being set to 1, anywhere from 3 to 7 of the bits are set to 1. (There is a highly rare chance that only 2 bits could be set, due to the previously mentioned 'ITEM random life' bug.) Most of the time, 4-6 of the 10 'random' bits will be set. [NOTE: Now that I think about it, I see a way that I could go to 7 random bits, and have anywhere from 0 to 7 bits set, but I guess that'll have to be another version, if I attempt it.]

The code does call out some lifeforms (lf_eel, lf_foureyed) that are not in the default game, but that can be changed (from game.ini and inside of the haven.ini code):
lf_eel lf_foureyed lf_lummox lf_megamoeba lf_serpvine lf_plasworm lf_crysfish lf_drmsnake lf_threep lf_bloater lf_piranbee lf_windbag lf_lookfrog lf_ppleater

Here is the new haven.ini code that'll generate some random numbers at the start of each game:
Code:
FLAG always

STAR 0
FLAG existing
PLNT hope
ITEM wp_beamlasr
UVAR randready 0
END STAR

STAR 1
FLAG existing
PLNT hope
ITEM wp_gausscan
END STAR

STAR 2
FLAG existing
PLNT hope
ITEM wp_missfusr
END STAR

CONDITION 0
TYPE homeworld
STR0 terran
END CONDITION

CONDITION 1
TYPE uvar
STR0 randready
STR1 0
END CONDITION

CONDITION 2
TYPE haveitem
STR0 lf_lookfrog
END CONDITION

CONDITION 3
TYPE haveitem
STR0 lf_eel
END CONDITION

CONDITION 4
TYPE haveitem
STR0 lf_foureyed
END CONDITION

CONDITION 5
TYPE haveitem
STR0 lf_lummox
END CONDITION

CONDITION 6
TYPE haveitem
STR0 lf_serpvine
END CONDITION

CONDITION 7
TYPE haveitem
STR0 lf_plasworm
END CONDITION

CONDITION 8
TYPE haveitem
STR0 lf_threep
END CONDITION

CONDITION 9
TYPE haveitem
STR0 lf_bloater
END CONDITION

CONDITION 10
TYPE haveitem
STR0 lf_piranbee
END CONDITION

CONDITION 11
TYPE haveitem
STR0 lf_windbag
END CONDITION

CONDITION 12
TYPE haveitem
STR0 lf_megamoeba
END CONDITION

CONDITION 13
TYPE haveitem
STR0 lf_drmsnake
END CONDITION

CONDITION 14
TYPE haveitem
STR0 lf_crysfish
END CONDITION

CONDITION 15
TYPE haveitem
STR0 lf_ppleater
END CONDITION

PAGE 0
REQ0 0
REQ1 1
ITEM random life
ITEM random life
ITEM random life
ITEM random life
ITEM random life
ITEM random life
ITEM random life
SVAR randA 0
SVAR randB 0
SVAR randC 0
SVAR randD 0
SVAR randE 0
SVAR randF 0
SVAR randG 0
SVAR randH 0
SVAR randI 0
SVAR randJ 0
SVAR rand4 3
SVAR rand5 0
SVAR rand8 0
SVAR randready 1
END PAGE

PAGE 1
REQ0 0
REQ1 15
REMV lf_ppleater
END PAGE

PAGE 2
REQ0 0
REQ1 12
REMV lf_megamoeba
END PAGE

PAGE 3
REQ0 0
REQ1 2
REMV lf_lookfrog
SVAR randA 1
INCV rand5 1
END PAGE

PAGE 4
REQ0 0
REQ1 3
REMV lf_eel
SVAR randB 1
INCV rand5 1
END PAGE

PAGE 5
REQ0 0
REQ1 4
REMV lf_foureyed
SVAR randC 1
INCV rand5 1
INCV rand8 1
END PAGE

PAGE 6
REQ0 0
REQ1 5
REMV lf_lummox
SVAR randD 1
INCV rand5 1
INCV rand8 2
END PAGE

PAGE 7
REQ0 0
REQ1 6
REMV lf_serpvine
SVAR randE 1
INCV rand5 1
INCV rand8 4
END PAGE

PAGE 8
REQ0 0
REQ1 7
REMV lf_plasworm
SVAR randF 1
END PAGE

PAGE 9
REQ0 0
REQ1 8
REMV lf_threep
SVAR randG 1
SVAR rand4 2
END PAGE

PAGE 10
REQ0 0
REQ1 9
REMV lf_bloater
SVAR randH 1
SVAR rand4 2
END PAGE

PAGE 11
REQ0 0
REQ1 10
REMV lf_piranbee
SVAR randI 1
SVAR rand4 1
END PAGE

PAGE 12
REQ0 0
REQ1 11
REMV lf_windbag
SVAR randJ 1
SVAR rand4 0
END PAGE

PAGE 13
REQ0 0
REQ1 13
REMV lf_drmsnake
END PAGE

PAGE 14
REQ0 0
REQ1 14
REMV lf_crysfish
END PAGE

PAGE 15
REQ0 0
DISP 1
ACTN popup endquest
TEXT RANDOM 0-3: <uvar=rand4><BR>RANDOM 0-4:
<uvar=rand5><BR>RANDOM 0-7: <uvar=rand8><BR>BITMAP:
<uvar=randA><uvar=randB><uvar=randC><uvar=randD>
<uvar=randE><uvar=randF><uvar=randG><uvar=randH>
<uvar=randI><uvar=randJ>
END PAGE

  #10  
Old November 14th, 2007, 06:56 PM
Fingers's Avatar

Fingers Fingers is offline
Sergeant
 
Join Date: Jun 2005
Posts: 341
Thanks: 0
Thanked 0 Times in 0 Posts
Fingers is on a distinguished road
Default Re: RANDOM GENERATOR PROTOTYPE

There's nothing special about haven.ini. Any quest with the "always" flag will always run.
 

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 07:45 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.