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

This Month's Specials

Air Command 3.0- Save $12.00
War Plan Pacific- Save $7.00

   







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

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #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
 

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 03:21 AM.


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