The story goes: one day I was looking at the Caverunner code and the idea just kinda hit me. That and Starfox inspired this game. I eventually discovered that my DBClassic project was under 500 commands, so I formatted it in ridiculously large lines that comprise the source code you will see in the source code tab.
Yahoo doesn't like me posting images, so just visit the tiny website at:
http://www.geocities.com/tao_butt_kick/
The media is below 150k. A readable, compilable version of the source code is found here. At least I hope is translated as a snippet correctly (some of the lines are pretty long). You can cound it if you wish, but you'll find that it is around 480 commands:
rem CaveBlaster test project
rem This project shall attempt to produce simplistic 3D effects
rem for the sake of AI, and collision response in our latest
rem thinktank: CAVEBLASTER v0.3
rem the gameplay consists of the alien baddies randomly firing red orbs
rem at the player while the player dodges the cave wall, etc.
rem The best way for the player to succeed is to fire at the aliens
rem from the side.
rem make a spherical collision test for the bullets
` Initialize all variables etc.
hide mouse : load object "caveship5.3ds", 1 : set object collision to boxes 1
`Load shielding system
load object "shld.3ds", 300
ghost object on 300
hide object 300
` We're cheating for now
shld = 10
rem Load bitmaps
load image "baked03.bmp",1
load image "baked04.bmp",2
load image "fireball.bmp",6
rem the crosshair initialization
load image "crosshair.bmp",3
load image "crosshair2.bmp",4
load image "eyebot1.bmp",7
`You must make a hidden plain to test for crosshair collisions
make object plain 101, 200, 8
Yrotate object 101, 90
Zrotate object 101, 90
hide object 101
`set plain texture and transparency
`initialize the crosshair's position
make object plain 100, 8, 8
texture object 100, 3
set object 100,1,0,0
fix object pivot 101
fix object pivot 100
rem make sound
load sound "phaser.wav", 1
`Make the Plasma Bolts
for c = 2 to 5
load object "plasma.3ds", c
hide object c
next c
`Make explosions
DIM size(5)
for c = 301 to 304
make object plain c, 8, 8
texture object c, 6
set object c,1,0,0
hide object c
next c
particle = 301
`These will be the flying baddies (11)
for c = 25 to 35
make object plain c, 15, 15
texture object c, 7
set object c, 1, 0, 0
hide object c
next c
`The baddys' orbs
` Shot number 41 is for the turret
for c = 36 to 41
load object "blob.3ds", c
hide object c
next c
randomize timer()
`make caves
make matrix 1,250,1250,10,50
prepare matrix texture 1,1,1,1
position matrix 1,0,-30,-10
make matrix 2,250,1250,10,50
prepare matrix texture 2,2,1,1
position matrix 2,0,30,-10
`set general roughness
randomize matrix 1, 20
randomize matrix 2, 20
for z = 0 to 50
set matrix height 1,0,z,40
set matrix height 1,10,z,40
set matrix height 2,0,z,-40
set matrix height 2,10,z,-40
next z
`rem the backdrop
backdrop on
color backdrop rgb(50,50,50)
x# = 125.0
z# = 50.0
y# = 0
sync on
sync rate 35
`Yes, this works, but I fear that it slows things down.
set object collision to boxes 101
` Weapon Variables
DIM bx#(5)
DIM by#(5)
DIM bz#(5)
DIM b_duration(5)
round = 2
`enemy weapons
orb = 36
DIM rage(35)
`ENTER THE MAIN LOOP 451
Repeat
rem record old stuff!
oldx# = x#
olda# = a#
oldb# = b#
rem user inputs
if rightkey()=1 and x# < 245 and speedx#>-1.0 : speedx#=speedx#+0.5 : a#=wrapvalue(a#+1.5) : endif
if leftkey()=1 and x# > 1 and speedx#<1.0 : speedx#=speedx#-0.5 : a#=wrapvalue(a#-1.5) : endif
if upkey()=1 and y# < 40 and speedy#<1.0 : speedy# = speedy#+0.5 : b#=wrapvalue(b#-1.5) : endif
if downkey()=1 and y# > -30 and speedy#>-1.0 : speedy# = speedy#-0.5 : b#=wrapvalue(b#+1.5) : endif
if returnkey()=1 and speedz# < 6.0 : speedz# = speedz#+0.5 : endif
` Weapons!
`It may be benificial to make this code modular and use it for the AI as well!
if spacekey()=1 and gun_cool = 0
round=round+1
if round = 6 : round = 2 : endif
bx#(round)=NewXValue(x#, a#, 8)
by#(round)=NewYValue(y#, b#, 8)
bz#(round)=NewZValue(z#, a#, 8)
position object round, bx#(round), by#(round), bz#(round)
b_duration(round)=200
Yrotate Object round, a#
Xrotate Object round, b#
show object round
gun_cool = 10
play sound 1
endif
rem test the plasma rounds 412
for c = 2 to 5
if object visible(c) = 1
`Test to see that it hasn't collided with the caves or enemies
for obj2 = 25 to 35
di# = ((object position x(obj2) - bx#(c))^2 + (object position y(obj2) - by#(c))^2 + (object position z(obj2) - bz#(c))^2)^0.5
if di# < 12 and object visible(c)=1: hide object obj2 : hide object c : PlaceParticle(20,bx#(c),by#(c),bz#(c)-20, particle) : particle = particle+1 : dec enemy_count : score = score+100 : endif
if object visible(obj2)=1 and di#<12 : hide object obj2 : endif
next obj2
if (by#(c)+35) - Get Ground Height(1,bx#(c),bz#(c)+mz) < 1 : hide object c : PlaceParticle(10,bx#(c),by#(c),bz#(c)-20, particle) : particle = particle+1 : endif
if (Get Ground Height(2,bx#(c),bz#(c)+mz)+35)-(by#(c)) < 1 and object visible(c) = 1 : hide object c : PlaceParticle(10,bx#(c),by#(c),bz#(c)-20, particle) : particle = particle+1 : endif
move object c, 10
bx#(c)= object position x(c)
by#(c)= object position y(c)
bz#(c)= object position z(c)
b_duration(c)=b_duration(c)-10
if b_duration(c) < 0 : hide object c : endif
endif
next c
if gun_cool > 0 : gun_cool=gun_cool-1 : endif
rem control the speed
if speedz# < 2 : speedz#=speedz#+0.25 : endif
if speedz# > 2 : speedz#=speedz#-0.25 : endif
if speedy# < 0 : speedy#=(speedy#+0.25) : endif
if speedy# > 0 : speedy#=(speedy#-0.25) : endif
if speedx# < 0 : speedx#=(speedx#+0.25) : endif
if speedx# > 0 : speedx#=(speedx#-0.25) : endif
if speedx# > 4 : speedx#=4 : endif
if speedx# < -4 : speedx#=-4 : endif
y#=y#+speedy#
mz=mz+speedz#
`angle variables
if a# > 0 and a# < 32 : a# = wrapvalue(a#-0.5) : endif
if a# > 329 and a# < 359 : a# = wrapvalue(a#+0.5) : endif
if b# > 0 and b# < 32 and upkey()=0 and downkey()=0 : b# = wrapvalue(b#-0.5) : endif
if b# > 329 and b# < 359 and downkey()=0 and upkey()=0 : b# = wrapvalue(b#+0.5) : endif
if a# = 31 : a# = olda# : endif
if a# = 329 : a# = olda# : endif
if b# = 31 : b# = oldb# : endif
if b# = 329 : b# = oldb# : endif
Yrotate object 1, (a#)
Xrotate object 1, (b#)
` Fix the angles
Set Object To Object Orientation 100,1
Set Object To Object Orientation 101,1
rem DO AI
gosub make_enemies
gosub handle_enemies
rem position crosshair
position object 100,NewXValue(x#,a#,dist#), NewYValue(y#, b#, dist#),NewZValue(z#,a#,dist#)
position object 101,NewXValue(x#,a#,120), NewYValue(y#, b#, 120),NewZValue(z#,a#, 120)
rem control variables
if x# < 1
speedx#=0
x# = 1
endif
x#=x#+speedx#
rem scroll caves 313
if mz>25
mz=mz-25
shift matrix up 1
shift matrix up 2
for x = 1 to 9
if rnd(5) > 1
set matrix height 1, x, 49, -20+rnd(30)
set matrix height 2, x, 49, 20-rnd(30)
else
set matrix height 1, x, 49, -20+rnd(60)
set matrix height 2, x, 49, 20-rnd(60)
endif
next x
update matrix 1
update matrix 2
endif
rem position all the stuff
position matrix 1,0,-40,-10-mz
position matrix 2,0,40,-10-mz
` Check for crosshair collision
obj_hit_num = Object Collision(101,0)
If obj_hit_num > 20 And obj_hit_num <> 100 and object_hit_num < 300
if Object Visible(Object Collision(101,0)) = 1 and object Collision(101,0) < 300
cx# = Object Position X(obj_hit_num)
cy# = Object Position Y(obj_hit_num)
cz# = Object Position Z(obj_hit_num)
dist# = ((cx# - x#)^2 + (cy# - y#)^2 + (cz# - z#)^2)^0.5 - (2*Object Size(obj_hit_num))
sights=1
Else
dist# = 200
sights = 0
endif
else
dist# = 200
sights = 0
endif
center text 200, 340, "FPS: " + str$(screen fps())
center text 200, 380, "Aggression Factor: " + str$(enemy_count)
text 10, 400, "score: " + str$(score)
`Handle scoring information
enemy_max = ((score/100)^(.35))+3
`This next loop is vital in keeping the crosshair always visible
max_dist#=dist#
dist#=1
do#=1
Repeat
If (NewYValue(y#,b#,dist#)+30) - Get Ground Height(1,NewXValue(x#,a#,dist#),NewZValue(z#,a#,dist#)+mz) < -2
dist#=dist#-14
do#=max_dist#
sights = 0
Else
dist# = dist#+1
do# = dist#
Endif
Until do# >= max_dist#
`This is loop number two of the crosshairs situation 257
max_dist#=dist#
dist#=1
do#=1
Repeat
If Get Ground Height(2,NewXValue(x#,a#,dist#),NewZValue(z#,a#,dist#)+mz)+30-(NewYValue(y#,b#,dist#)) < -2
dist#=dist#-14
do#=max_dist#
sights = 0
Else
dist# = dist#+1
do# = dist#
Endif
Until do# >= max_dist#
`change crosshair color if necessary
if sights = 1 : texture object 100, 4 : endif
if sights = 0 : texture object 100, 3 : endif
`Check the distances so we don't get anything so small that it is bogus
if dist# < 10 : dist# = 10 : endif
`Now we test for player collision
if Object Collision(1, 0) > 24 and Object Collision(1, 0) < 100
if object visible(Object Collision(1, 0)) = 1
if shld_live = 0 : shld_live = 15 : speedz#=-1*(speedz#+1) : endif
endif
endif
`Five terrain collision nodes 227
`front collision nodes: 3
if (NewYValue(y#,b#,15)+37) - Get Ground Height(1,NewXValue(x#,a#,15),NewZValue(z#,a#,15)+mz) < 1 : speedz# = -1*(speedz#+1) : if shld_live = 0 then shld_live = 15 : endif
if (Get Ground Height(2,NewXValue(x#,a#,15),NewZValue(z#,a#,15)+mz)+37)-NewYValue(y#,b#,15) < 1 : speedz# = -1*(speedz#+1) : if shld_live = 0 then shld_live = 15 : endif
if (NewYValue(y#,b#,15)+37) - Get Ground Height(1,NewXValue(x#,a#,15)+3,NewZValue(z#,a#,15)+mz) < 1 : speedz# = -1*(speedz#+1) : if shld_live = 0 then shld_live = 15 : endif
if (Get Ground Height(2,NewXValue(x#,a#,15)+6,NewZValue(z#,a#,15)+mz)+37)-NewYValue(y#,b#,15) < 1 : speedz# = -1*(speedz#+1) : if shld_live = 0 then shld_live = 15 : endif
if (NewYValue(y#,b#,15)+37) - Get Ground Height(1,NewXValue(x#,a#,15)-3,NewZValue(z#,a#,15)+mz) < 1 : speedz# = -1*(speedz#+1) : if shld_live = 0 then shld_live = 15 : endif
if (Get Ground Height(2,NewXValue(x#,a#,15)-6,NewZValue(z#,a#,15)+mz)+37)-NewYValue(y#,b#,15) < 1 : speedz# = -1*(speedz#+1) : if shld_live = 0 then shld_live = 15 : endif
`Right Collision Node
if (y#+35) - Get Ground Height(1,x#+4,z#+mz+10) < 1 : x# = oldx#-4 : speedx# = -3 :if shld_live = 0 then shld_live = 15 : endif
if Get Ground Height(2,x#+7,z#+mz+10)+37-y# < 1 : x# = oldx#-4 : speedx# = -3 : if shld_live = 0 then shld_live = 15 : endif
`left Collision Node 193
if (y#+35) - Get Ground Height(1,x#-4,z#+mz+10) < 1 : x# = oldx#+4 : speedx# = 3 : endif
if Get Ground Height(2,x#-7,z#+mz+10)+37-y# < 1 : x# = oldx#+4 : speedx# = 3 : endif
if object visible(300) = 0 and shld_live < 15 : show object 300 : endif
if object visible(300) = 1 and shld_live = 0 : hide object 300 : endif
`Handle the shielding system 179
if shld_live = 15 : shld = shld-1 : endif
if shld_live > 0 : shld_live = shld_live -1 : endif
`more shield stuff
text 10, 440,"SHIELDS: "+str$(shld)
position object 1, x#, y#, z#
position object 300, x#, y#, z#
`
camx#=x#
if camy# < y#+10 : camy# = camy#+0.5 : endif
if camy# > y#+10 : camy# = camy#-0.5 : endif
if camz# > z#-40 : camz# = camz#-0.5 : endif
`Test to see if camera is where it should be, else move it outta da way : 148
if (camy#+30) - Get Ground Height(1,camx#,camz#+mz+10) < 0
repeat
camy#=camy#+0.2
if Get Ground Height(2,camx#,camz#+mz+10)+30-(camy#) < 3 and camz# < z#-10 : camz# = camz# + 0.1 : endif
until (camy#+30) - Get Ground Height(1,camx#,camz#+mz+10) > 0
endif
if Get Ground Height(2,camx#,camz#+mz+10)+30-(camy#) < 3
repeat
camy#=camy#-0.2
if (camy#+30) - Get Ground Height(1,camx#,camz#+mz+10) < 0 and camz# < z#-10 : camz# = camz# + 0.1 : endif
until Get Ground Height(2,camx#,camz#+mz+10)+30-(camy#) > 3
endif
position camera camx#, camy#, camz#
`fog stuff
fog on
fog color rgb(50,50,50)
fog distance 700
` Handle Particles
if particle = 305 : particle = 301 : endif
for c = 301 to 304
if object visible(c) = 1
point object c, camx#, camy#, camz#
scale object c, 100+(size(c-300)*20), 100+(size(c-300)*20), 100+(size(c-300)*20)
ZRotate Object c, wrapvalue(size(c-300)*30)
size(c-300) = size(c-300)-1
position object c, object position x(c), object position y(c), object position z(c) - speedz#
if size(c-300) = 0 then hide object c
endif
next c
` Handles enemy bullets
` They are pretty fast for now
dump = 0
for c = 36 to 41
if object visible(c) = 1
position object c, object position x(c), object position y(c), object position z(c) - 20
if object collision(c, 1) = 1 : hide object c : orb = orb-1 : if shld_live = 0 then shld_live = 15 : endif
if object position z(c) <= z# : hide object c : orb = orb-1 : endif
if (object position Y(c)+35) - Get Ground Height(1,object position x(c),object position z(c)+mz) < 1 : hide object c : orb = orb-1 : endif
if (Get Ground Height(2,object position x(c),object position z(c)+mz)+35)-(object position y(c)) < 1 : hide object c : orb = orb-1 : endif
else
dump = dump+1
endif
next c
orb = 41-dump
SYNC
until shld = 0
END
`command cound : smaller than 500!
function PlaceParticle(dur, x#, y#, z#, p)
show object p
position object p, x#, y#, z#
size(p-300) = dur
endfunction
`subs
make_enemies:
if enemy_count < enemy_max
enemy_count = enemy_count+1
endif
for todo = 25 to (25+enemy_count)
if object visible(todo) = 0 : show object todo: position object todo, 20 + rnd(210), -10+rnd(35), 900 : endif
next todo
for todo = (25+enemy_count) to 35
hide object todo
next todo
return
handle_enemies:
for h = 25 to 35
opy# = 0
if object visible(h) = 1
if (object position y(h)+30) - Get Ground Height(1,object position x(h), object position z(h)+mz+10) < 0
repeat
opy# = opy#+0.2
until (object position y(h)+30+opy#) - Get Ground Height(1,object position x(h), object position z(h)+mz+10) > 0
endif
if Get Ground Height(2,object position X(h),object position Z(h)+mz+10)+30-(object position Y(h)+opy#) < 3
repeat
opy# = opy#-0.2
until Get Ground Height(2,object position X(h),object position Z(h)+mz+10)+30-(object position Y(h)+opy#) > 3
endif
` bullet firing statement
if rnd(25) = 1 and object position Z(h) > 120 and object position z(h) < 450 and orb <= 40 : orb=orb+1 : show object orb : position object orb, object position X(h)-3, object position Y(h)+opy#, object position Z(h)-5 : endif
randomize timer()
if rnd(100)=1 and rage(h) = 0 : rage(h)=40 : endif
if rage(h) > 0 and object position x(h) > 150 : position object h, object position x(h)-1, object position y(h), object position z(h) : rage(h) = rage(h)-1 : endif
if rage(h) > 0 and object position x(h) < 100 : position object h, object position x(h)+1, object position y(h), object position z(h) : rage(h) = rage(h)-1 : endif
if rage(h) > 0 and object position x(h) > 100 and object position x(h) < 150 : position object h, object position x(h)-2+rnd(3), object position y(h), object position z(h) : rage(h) = rage(h)-1 : endif
position object h, object position x(h), object position y(h)+opy#, object position z(h)-speedz#-(mz/3)-1
if object position z(h) < z# : position object h, 20 + rnd(210), -10+rnd(35), 900 : endif
point object h, camx#, camy# , camz#
endif
next h
return
Merry Christmas. In a future version, there will be shield powerups (hopefully). I still have somewhere around 18 commands left to play with. But like I said, just go to the website. You will only find the sourcecode here, which means I've made .exes!
Oh, by the way, I made sure the FPS rate doesn't go over 35 for playability. If I left it unchecked the game would well go over 45+, and look like a bunch of hummingbirds on steroids.
"Power, precision, and don't forget about speed. If you practice everyday with these things in mind... you begin to develope A FIGHTING MODE." - Fist of Legend (Jet Li)