t
AS INTEGER ' (Type of planetary system; terran, frozen, radiated, toxic, etc.) Ships p
AS INTEGER ' (Population) For now ships produced per turn
'DECLARE SUB NewGame
'DECLARE SUB PaintStars
'DECLARE SUB StarNames
'DECLARE SUB ShowPanel (i)
'DECLARE SUB Identify (x, y)
'DECLARE SUB PaintBackground
'DECLARE SUB GetInput
' Global variables shared because they are needed in more than one routine
DIM SHARED ratio
AS _FLOAT ' the Ratio of the games natural screen width to the actual DIM SHARED seed
AS INTEGER ' Seed to prime the Randomizer to display identical background each frame DIM SHARED home
(6) AS INTEGER ' The starting star for each player. The human always has star(0), Sol
sww = sw / 24 ' margin based on native video width to keep stars away from edge
swn = sw / 48 ' adjustment that works with sww to keep stars away from left and top of screen
nw = 1920
ratio = sw / 1920 ' Used to adjust distances and sizes for various screen modes
shw = sh / 20
shn = sh / 40
nh = 1080
tt = 0
cx = sw
cp = 100
h = 100
ar = 0
rng = 200
SCREEN _NEWIMAGE(sw
, sh
, 256) ' creates a screen the resolution of the users native system
ps
= _NEWIMAGE(400 * ratio
, 540 * ratio
, 256)
StarNames ' Routine to load star names into string array stars(200)
NewGame
repeat = 1
_LIMIT 60 ' Set to 60 frames per second
PaintBackground
PaintStars
PaintFleet
GetInput
Identify x, y ' Identify star mouse is over if any
computer
count = fltcnt
i = 0
CIRCLE (fleet
(i
).x1
, fleet
(i
).y1
), 3, fleet
(i
).o
+ 8 count = count - 1
i = i + 1
fleet(i).o = star(org).o
fleet(i).d = dst
fleet(i).x1 = star(org).x
fleet(i).y1 = star(org).y
fleet(i).x2 = star(dst).x
fleet(i).y2 = star(dst).y
fleet(i).n = star(org).t / 2
star(org).t = star(org).t / 2
fltcnt = fltcnt + 1
IF rng
< 4000 THEN rng
= rng
+ 4 LL = LL + 1
star(i).t = star(i).t + 1
star(i).t = star(i).t + 1
num = 0
num = star(j).t
idx = j
org = idx
num = 10000
sway
= ABS(star
(org
).x
- star
(j
).x
) + ABS(star
(org
).y
- star
(j
).y
) num = star(j).t
idx = j
dst = idx
IF star
(org
).t
> 100 AND star
(org
).t
> star
(dst
).t
* 2 AND star
(org
).t
> LL
THEN SendFleet org, dst
count = fltcnt
i = 0
count = count - 1
IF fleet
(i
).x2
> fleet
(i
).x1
THEN fleet(i).x1 = fleet(i).x1 + 1
IF fleet
(i
).x2
< fleet
(i
).x1
THEN fleet(i).x1 = fleet(i).x1 - 1
IF fleet
(i
).y2
> fleet
(i
).y1
THEN fleet(i).y1 = fleet(i).y1 + 1
IF fleet
(i
).y2
< fleet
(i
).y1
THEN fleet(i).y1 = fleet(i).y1 - 1
IF fleet
(i
).x1
= fleet
(i
).x2
AND fleet
(i
).y1
= fleet
(i
).y2
THEN dst = fleet(i).d
IF star
(dst
).o
= fleet
(i
).o
THEN star(dst).t = star(dst).t + fleet(i).n
fleet(i).o = 0
fltcnt = fltcnt - 1
alive = 1
alive = 0
damorg = fleet(i).n / 11 + 1
damdst = star(dst).t / 10 + 1
fleet(i).n = fleet(i).n - damdst
star(dst).t = star(dst).t - damorg
alive = 1
star(dst).t = fleet(i).n
star(dst).o = fleet(i).o
fleet(i).o = 0
fltcnt = fltcnt - 1
i = i + 1
ch = ""
clk = 0
cx = x
cy = y
clk = 1
cx = sw
ShowPanel h
ProcessPanel
ar = 0
dx = star(i).x - x
dy = star(i).y - y
ShowPanel i
clk = 0
h = i
ar = 1
ax = x
x1 = star(i).x - 420 * ratio
IF star
(i
).x
< sw
/ 2 THEN x1
= star
(i
).x
+ 20 x2 = x1 + 400 * ratio
y1 = star(i).y
IF y1
> sh
- 560 * ratio
THEN y1
= sh
- 560 * ratio
y2 = y1 + 540 * ratio
_PUTIMAGE (x1
, y1
), ps
, 0, (0, 0)-(400 * ratio
, 540 * ratio
)
c = star(i).c
x = star(i).x
y = star(i).y
o = star(i).o
CIRCLE (x
, y
), (star
(i
).s
+ 6) * ratio
, c
n$ = star(i).n
fleet(i).o = 0
fltcnt = 0
LL = 50
star(0).n = "Sol"
star
(0).x
= RND * (sw
- sww
) + swn
star
(0).y
= RND * (sh
- shw
) + shn
star(0).c = 14
star(0).s = 2
star(0).o = 1
star(0).p = 10
star(0).t = 100
home(0) = 0
k = 1
k = 0
x
= RND * (sw
- sww
) + swn
y
= RND * (sh
- shw
) + shn
n = names(r)
dx = x - star(j).x
dy = y - star(j).y
k = 1
k = 1
star(i).n = n
star(i).x = x
star(i).y = y
star(i).o = 0
star
(i
).p
= star
(i
).s
+ (RND * 8) + 1 star(i).t = 0
k = 1
k = 0
x = star(0).x
y = star(0).y
home(i) = r
star(r).o = i
star(r).p = 10
star(r).t = 100
' A lot of star names I made up
names(0) = "Acamar"
names(1) = "Arcab"
names(2) = "Acrux"
names(3) = "Adhara"
names(4) = "Arneb"
names(5) = "Antares"
names(6) = "Arcturus"
names(7) = "Atria"
names(8) = "Beid"
names(9) = "Betelgeuse"
names(10) = "Botein"
names(11) = "Beemim"
names(12) = "Bellatrix"
names(13) = "Bharani"
names(14) = "Biham"
names(15) = "Brachium"
names(16) = "Canopus"
names(17) = "Capella"
names(18) = "Castor"
names(19) = "Chara"
names(20) = "Cursa"
names(21) = "Copernicus"
names(22) = "Chalawan"
names(23) = "Chertan"
names(24) = "Dabih"
names(25) = "Dalim"
names(26) = "Deneb"
names(27) = "Denebola"
names(28) = "Diadem"
names(29) = "Diphda"
names(30) = "Dschubba"
names(31) = "Dziban"
names(32) = "Edasich"
names(33) = "Electra"
names(34) = "Elgafar"
names(35) = "Elkurud"
names(36) = "Elnath"
names(37) = "Eltanin"
names(38) = "Enif"
names(39) = "Errai"
names(40) = "Fafnir"
names(41) = "Fang"
names(42) = "Fawaris"
names(43) = "Felis"
names(44) = "Fomalhaut"
names(45) = "Fulu"
names(46) = "Fumal"
names(47) = "Furud"
names(48) = "Garnet"
names(49) = "Giausar"
names(50) = "Gienah"
names(51) = "Ginan"
names(52) = "Gomeisa"
names(53) = "Graffias"
names(54) = "Grumium"
names(55) = "Gudja"
names(56) = "Hadar"
names(57) = "Haedus"
names(58) = "Hamal"
names(59) = "Hassaleh"
names(60) = "Hatysa"
names(61) = "Helvetios"
names(62) = "Heze"
names(63) = "Homan"
names(64) = "Iklil"
names(65) = "Imai"
names(66) = "Intercrus"
names(67) = "Izar"
names(68) = "Iccar"
names(69) = "Inar"
names(70) = "Iaeth"
names(71) = "Imaous"
names(72) = "Jabbah"
names(73) = "Jishui"
names(74) = "Jax"
names(75) = "Jalae"
names(76) = "Jewel"
names(77) = "Jumbo"
names(78) = "Jerue"
names(79) = "Jabear"
names(80) = "Kakkab"
names(81) = "Kang"
names(82) = "Kekouan"
names(83) = "Keid"
names(84) = "Kitalpha"
names(85) = "Kochab"
names(86) = "Kolob"
names(87) = "Kobol"
names(88) = "Larawag"
names(89) = "Lesath"
names(90) = "Libertas"
names(91) = "Lich"
names(92) = "Lilly"
names(93) = "Laddel"
names(94) = "Luminous"
names(95) = "Lasacious"
names(96) = "Mizar"
names(97) = "Markab"
names(98) = "Matar"
names(99) = "Mintaka"
names(100) = "Meleph"
names(101) = "Menkar"
names(102) = "Merga"
names(103) = "Merope"
names(104) = "Nahn"
names(105) = "Naos"
names(106) = "Nashira"
names(107) = "Navi"
names(108) = "Nekkar"
names(109) = "Nembus"
names(110) = "Nihal"
names(111) = "Nunki"
names(112) = "Ogma"
names(113) = "Okab"
names(114) = "Ohmy"
names(115) = "Oragami"
names(116) = "Origen"
names(117) = "Omanii"
names(118) = "Obytewa"
names(119) = "Oglok"
names(120) = "Phact"
names(121) = "Pherkad"
names(122) = "Pleione"
names(122) = "Polaris"
names(123) = "Pollux"
names(124) = "Procyon"
names(125) = "Proxima"
names(126) = "Polis"
names(127) = "Quaint"
names(128) = "Quazzat"
names(129) = "Quetzal"
names(130) = "Qussol"
names(131) = "Quella"
names(132) = "Quyaeo"
names(133) = "Ququdas"
names(134) = "Quekak"
names(135) = "Rasalas"
names(136) = "Regor"
names(137) = "Regulus"
names(138) = "Rigel"
names(139) = "Revati"
names(140) = "Rotenev"
names(141) = "Rukbat"
names(142) = "Rastaban"
names(143) = "Sabik"
names(144) = "Sadr"
names(145) = "Saiph"
names(146) = "Sargas"
names(147) = "Sarin"
names(148) = "Syrma"
names(149) = "Spica"
names(150) = "Sirius"
names(151) = "Tarazed"
names(152) = "Taygeta"
names(153) = "Tejat"
names(154) = "Thabit"
names(155) = "Thuban"
names(156) = "Tiaki"
names(157) = "Toliman"
names(158) = "Torcular"
names(157) = "Umala"
names(158) = "Ulatte"
names(159) = "Ubbessa"
names(160) = "Unoless"
names(161) = "Umaddem"
names(162) = "Ummbra"
names(162) = "Uniqu"
names(163) = "Uzzaal"
names(164) = "Vega"
names(165) = "Veritate"
names(166) = "Vindetrix"
names(167) = "Vedas"
names(168) = "Vergg"
names(169) = "Vacant"
names(170) = "Vucae"
names(171) = "Vicar"
names(172) = "Wasat"
names(173) = "Wazn"
names(174) = "Wezen"
names(175) = "Waiten"
names(176) = "Wachar"
names(177) = "Wheelz"
names(178) = "Whatsp"
names(179) = "Wassand"
names(180) = "Xenno"
names(181) = "Xyphod"
names(182) = "Xu"
names(183) = "Xaal"
names(184) = "Xyross"
names(185) = "Xiggot"
names(186) = "Xirrks"
names(187) = "Yed"
names(188) = "Yildun"
names(189) = "Yundun"
names(190) = "Yavyo"
names(191) = "Yotrac"
names(192) = "Yxzoqu"
names(193) = "Ynnot"
names(194) = "Zaniah"
names(195) = "Zaurak"
names(196) = "Zhang"
names(197) = "Zibal"
names(198) = "Zosma"
names(199) = "Zuben"