Hi, Thanks For Testing the Game
Benjamin:
Hmm a strange bug... i honestly havent seen the enemies disapear... except when you kill them. im not sure what happened when you played it. Ill definately look into it
Supremacy Project:
Hi, Here are the secrets
:
Quote: "the camera moves by waypoints right ? the ship moves around the camera, when u shoot the bullets point for the next waypoint right ?"
The camera route is generated by finding a 3D bezier curve through the center points of each segment of track. the ship is then offsetted from this "line". The enemy ship's route is generated by finding another 3D bezier curve through the "safe zones" of each segment and then a sine/cosine offset is applied to give the impression of random circling about a point. all objects in the game follow these "lines" and just take offsets. this means adding new weapons was really really easy
Quote: "what made me thinking was when i finished the last level i saw "random level" do u have a level generator ? how did u did the levels ?"
The levels are generated using a memblock creation system i developed where an array of "center points" are generated spanning the length of the track; the center points are then used to generate a big polygon of n sides which can be changed with a variable. i did this by taking a "up" vector of [0,1,0] and applying a rotational transformation matrix at angle increments of (360/n). this got me a basic 2d polygon. from there i rotated all the vectors so that they were angled facing the last position (i think) to give a smoother look. i then just connected the dots using vertices and memblocks.
thus it is possible to create completely random levels
here is my NO media tunnel generation code
screenX = 800
screenY = 600
`SET 3D SCENE
set display mode screenX,screenY,32
set camera range 1,10000
backdrop on : color backdrop rgb(0,0,0) : autocam off
sync on : sync rate 30
ink 0,0
set text size 16
set text font "simsun"
randomize timer()
`INITIALISATION
type vector
x as float
y as float
z as float
endtype
type gameData
tunnelDepth as integer
tunnelSize as integer
tunnelRadius as integer
tunnelSegments as integer
endtype
game as gameData
game.tunnelDepth = 50 `changes the number of sectors in the level : normal = 10 to 300
game.tunnelSize = 500 `changes the depth of each segment : normal = 500
game.tunnelRadius = 100 `changes the Radius of all segment : normal = 100
game.tunnelSegments = 8 `changes the polygon number of sides : normal = 5 to 20
dim vertex(1) as vector
dim pnt(4) as vector
dim tunnelPoints(game.tunnelDepth) as vector
dim tunnelVectors(game.tunnelDepth,game.tunnelSegments) as vector
dim matrix4(1,4,4) as float
dim vector3(1,4) as float
`CONSTRUCTING METHOD CALLS
`make random texture
makeTexture( 2 , 128 , rgb(rnd(255),rnd(255),rnd(255)) , rgb(rnd(255),rnd(255),rnd(255)) , rnd(50) , rnd(4) )
`makes the memblock tunnel
makeMemblockTunnel(2,2,2,2,2)
`MAIN LOOP
position camera tunnelPoints(0).x , tunnelPoints(0).y , tunnelPoints(0).z
do
mousePosX# = mouseX()
mousePosY# = mouseY()
pitch camera down ( mousePosY# - screenY / 2 ) / game.tunnelRadius
turn camera right ( mousePosX# - screenX / 2 ) / game.tunnelRadius
if mouseclick() = 1
target# = 10
move camera speed#
else
if mouseclick() = 2
target# = -10
move camera speed#
endif
endif
speed# = curvevalue(target#,speed#,10)
sync
loop
`--------------------------------- TEXTURE MAKING FUNCTIONS ---------------------------------
`function to make a texture
function makeTexture(imgNum , size , color1 , color2 , percent# , outline)
if outline > 0
ink 0 , 0
for i = 1 to outline
box 0 , 0 , size - i , size - i
next i
endif
ink color1 , 0
box 1 , 1 , size - 2 , size - 2
for i = 0 to int( ( ( ( size - 1 ) ^ 2 ) / 100.0 ) * percent# )
dot rnd( size - 3 ) + 1 , rnd( size - 3 ) + 1 , color2
next i
get image imgNum , 0 , 0 , size - 1 , size - 1
endfunction
`--------------------------------- MEMBLOCK TUNNEL FUNCTIONS ---------------------------------
`function to make a memblock tunnel
function makeMemblockTunnel( objNum , imgNum , memblockNum , meshNum , vectorNum )
makeTunnelVectors()
make memblock memblockNum , 12 + ((game.tunnelSegments * 216) * game.tunnelDepth)
write memblock dword memblockNum , 0 , 338
write memblock dword memblockNum , 4 , 36
write memblock dword memblockNum , 8 , (game.tunnelDepth * game.tunnelSegments) * 6
pos = 12
for sectorNum = 1 to game.tunnelDepth - 1
for segmentNum = 0 to game.tunnelSegments - 1
for polygonNum = 0 to 1
for vertexNum = 0 to 2
if polygonNum = 0 && vertexNum = 0 then getSectorVector(sectorNum , segmentNum , game.tunnelRadius)
if polygonNum = 0 && vertexNum = 1 then getSectorVector(sectorNum , segmentNum + 1 , game.tunnelRadius)
if polygonNum = 0 && vertexNum = 2 then getSectorVector(sectorNum + 1 , segmentNum + 1 , game.tunnelRadius)
if polygonNum = 1 && vertexNum = 0 then getSectorVector(sectorNum , segmentNum , game.tunnelRadius)
if polygonNum = 1 && vertexNum = 1 then getSectorVector(sectorNum + 1 , segmentNum+1 , game.tunnelRadius)
if polygonNum = 1 && vertexNum = 2 then getSectorVector(sectorNum + 1 , segmentNum , game.tunnelRadius)
write memblock float memblockNum , pos , vertex(1).x
write memblock float memblockNum , pos+4 , vertex(1).y
write memblock float memblockNum , pos+8 , vertex(1).z
null = make vector2(vectorNum)
set vector2 vectorNum , vertex(1).x , vertex(1).y
divide vector2 vectorNum , length vector2(vectorNum)
write memblock float memblockNum , pos+12 , - x vector2(vectorNum)
write memblock float memblockNum , pos+16 , - y vector2(vectorNum)
write memblock float memblockNum , pos+20 , 0
null = delete vector2(vectorNum)
write memblock dword memblockNum , pos+24 , rgb(255,255,255)
write memblock float memblockNum , pos+28 , ((polygonNum = 0 && (vertexNum = 2)) || (polygonNum = 1 && (vertexNum = 1 || vertexNum = 2)))
write memblock float memblockNum , pos+32 , ((polygonNum = 0 && (vertexNum = 1 || vertexNum = 2)) || (polygonNum = 1 && (vertexNum = 1)))
inc pos,36
next vertexNum
next polygonNum
next segmentNum
next sectorNum
make mesh from memblock memblockNum , meshNum
make object objNum , meshNum , imgNum
` set object ambient objNum , 0
delete memblock memblockNum
endfunction
`function to retrieve the tunnel vectors
function makeTunnelVectors()
for sectorNum = 0 to game.tunnelDepth - 1
height = wrapvalue(height + 50)
tunnelPoints(sectorNum).x = sin(height) * rnd(200)
tunnelPoints(sectorNum).y = cos(height) * rnd(200)
tunnelPoints(sectorNum).z = tunnelPoints(sectorNum - 1).z + game.tunnelSize * (sectorNum > 0)
next sectorNum
for sectorNum = 0 to game.tunnelDepth - 1
for segmentNum = 0 to game.tunnelSegments - 1
getSectorVector(sectorNum,segmentNum,game.tunnelRadius)
tunnelVectors(sectorNum , segmentNum).x = vertex(1).x
tunnelVectors(sectorNum , segmentNum).y = vertex(1).y
tunnelVectors(sectorNum , segmentNum).z = vertex(1).z
next segmentNum
next sectorNum
endfunction
`function to retrieve the sector vector
function getSectorVector(sectorNum , segmentNum , radius)
angx# = atanfull(tunnelPoints(sectorNum).y - tunnelPoints(sectorNum + 1).y , tunnelPoints(sectorNum).z - tunnelPoints(sectorNum + 1).z)
angy# = atanfull(tunnelPoints(sectorNum).x - tunnelPoints(sectorNum + 1).x , tunnelPoints(sectorNum).z - tunnelPoints(sectorNum + 1).z)
angz# = wrapvalue((360.0 / game.tunnelSegments) * (segmentNum))
rotateVector3(0 , radius , 0 , - angx# , angy# , angz#)
vertex(1).x = tunnelPoints(sectorNum).x + vector3(0 , 1)
vertex(1).y = tunnelPoints(sectorNum).y + vector3(0 , 2)
vertex(1).z = tunnelPoints(sectorNum).z + vector3(0 , 3)
endfunction
`--------------------------------- 3D MATH LIBRARY ---------------------------------
`function to make a matrix 4
function makeMatrix4(matNum,ax#,ay#,az#,aw#,bx#,by#,bz#,bw#,cx#,cy#,cz#,cw#,dx#,dy#,dz#,dw#)
matrix4(matNum,1,1) = ax#
matrix4(matNum,1,2) = ay#
matrix4(matNum,1,3) = az#
matrix4(matNum,1,4) = aw#
matrix4(matNum,2,1) = bx#
matrix4(matNum,2,2) = by#
matrix4(matNum,2,3) = bz#
matrix4(matNum,2,4) = bw#
matrix4(matNum,3,1) = cx#
matrix4(matNum,3,2) = cy#
matrix4(matNum,3,3) = cz#
matrix4(matNum,3,4) = cw#
matrix4(matNum,4,1) = dx#
matrix4(matNum,4,2) = dy#
matrix4(matNum,4,3) = dz#
matrix4(matNum,4,4) = dw#
endfunction
`function to make a vector 4
function makeVector3(vecNum,x#,y#,z#)
vector3(vecNum,1) = x#
vector3(vecNum,2) = y#
vector3(vecNum,3) = z#
vector3(vecNum,4) = 1
endfunction
`function to rotate a movement vector by an x y z ang;e
function rotateVector3(vx#,vy#,vz#,rx#,ry#,rz#)
vecNum = 1
matNum = 1
ax# = (COS(rz#)*COS(ry#))+(SIN(rz#)*SIN(rx#)*SIN(ry#))
ay# = (SIN(rz#)*COS(ry#))-(COS(rz#)*SIN(rx#)*SIN(ry#))
az# = COS(rx#)*SIN(ry#)
bx# = -(SIN(rz#)*COS(rx#))
by# = COS(rz#)*COS(rx#)
bz# = SIN(rx#)
cx# = (SIN(rz#)*SIN(rx#)*COS(ry#))-(COS(rz#)*SIN(ry#))
cy# = -(COS(rz#)*SIN(rx#)*COS(ry#))-(SIN(rz#)*SIN(ry#))
cz# = COS(rx#)*COS(ry#)
dw# = 1.0
makeVector3(vecNum,vx#,vy#,vz#)
makeMatrix4(matNum,ax#,ay#,az#,0,bx#,by#,bz#,0,cx#,cy#,cz#,0,0,0,0,dw#)
`matrix multiplication in homogenous coordinates
for i = 1 to 4
inc resultX#,(matrix4(matNum,1,i)*vector3(vecNum,i))
inc resultY#,(matrix4(matNum,2,i)*vector3(vecNum,i))
inc resultZ#,(matrix4(matNum,3,i)*vector3(vecNum,i))
inc resultW#,(matrix4(matNum,4,i)*vector3(vecNum,i))
next i
makeVector3(0,resultX#,resultY#,resultZ#)
endfunction
use the mouse to turn the camera and the mousebuttons to move
Good Luck with your game
Tomu