I've been messing with game engines after game engines and I found 2 things out. 1 you usually have to spend more money to get anywhere or 2 you get a complicated peace of junk ya can't do anything with. Dark Basic is a Great Compiling Game engine once you learn how to use it.Hence the main problem. Knowing how to create the tools inside dark basic to create a good game Engine.
List of Things needed:
1. World Editor: One that can be added to inside dark Basic and recompiled and saves in a format you can later use a game engine created by dark basic
2. The Game Engine: FPS,RTS,RPG,etc
3. A good modeler and know how to use it with dark basic: I suggest anim8tor because it exsports in 3ds formats.
To make Dark basic usefull to all dark basic Classic users is the above list. Not people Saying Look at this tutorial or look at that. Share your own thoughts,ask for the code so you yourself can help improve and then share the outcome. Here's a good example:
Rem * Title : Map Editor
Rem * Author : David Bell
Rem * Date : 08/31/2008
` This code was downloaded from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com
`Hold (right click) and use mouse to move
`(left click) to place objects
`(SPACE) to change to next object
`Green cone Taraforms "use (TAB) key to switch up and down"
`(scroll wheel) rotates object
`(num pad) to look left/right and move up/down
`Hold (SHIFT) and use mouse/scroll to tilt cam/zoom
`Hold (S) key and scroll to scale
`(F2) save, (F3) load, (F4) delete
`Things I need to do:)
` get save working properly
` make scale work better
`clean up code
sync on
sync rate 40
Xrez=800
Yrez=600
set display mode Xrez,Yrez,32
`set window on
hide mouse
num = 1
flag = 0
fl=0
Q=1
strech# = 0
U#=180
`load image "grass.bmp",2
rem Load your object
load object "grass.x",4
load image "grass.bmp",3
texture object 4, 3
make object cone 1,1
rotate object 1,0,0,U#
color object 1, rgb(0,255,0)
make object cube 2,2
make object cylinder 3,2
color object 3, rgb(200,200,255)
move object 2,5
make matrix 1,60,80,60,80
load image "grass.bmp",2
position matrix 1,0,-1,0
dim hat#(60,80)
prepare matrix texture 1, 2, 1, 1
fill matrix 1, 2, 1
rem Switch off wireframe
set matrix wireframe off 1
position camera 15,15,22.5
rotate camera 45,0,0
`The start of our loop
do
`only show active object
hide object 1
hide object 2
hide object 3
hide object 4
`hide object 5
`hide object 6
show object num
` get values
camY# = (camera position Y())
camAngX# = camera angle X()
camAngY# = camera angle Y()
camAngZ# = camera angle Z()
obX#=object position X(num)
obY#=object position Y(num)
obZ#=object position Z(num)
speedx#=((mousex()-(Xrez/2))*.01)
speedy#=((mousey()-(yrez/2))*.01)
posY#=((Yrez-mousey())/5)
posX#=(((Xrez/2)-mousex())/-10)
`Click to place object
if mouseclick()=1 and flag = 0 then gosub placeobject
if mouseclick()=1
flag = 1
else
flag = 0
endif
`Use space to change to next object
if spacekey()=1 and flag2=0 then num=num+1
if num>4 then num=1
if spacekey()=1
flag2 = 1
else
flag2 = 0
endif
`Hold right click to move around level
if mouseclick()=2
camX# = (camera position X())
camZ# = (camera position Z())
else
camX# = int(camera position X())
camZ# = int(camera position Z())
endif
`Fallow terrain height
height#=get ground height(1,obX#,obZ#)
Zval#=height#
`Change terain height
if keystate(15)=1 and flag7=0 then U# = U#+180
if keystate(15)=1
flag7 = 1
else
flag7 = 0
endif
if U#>180 then U#=0
if num=1 and obZ#<80 and obZ#>0 and obX#<59 and obX#>0 and mouseclick()=1
set matrix height 1,obX#,obZ#,height#+.2
set matrix height 1,obX#,obZ#-1,height#+.1
set matrix height 1,obX#,obZ#+1,height#+.1
set matrix height 1,obX#-1,obZ#,height#+.1
set matrix height 1,obX#+1,obZ#,height#+.1
endif
if num=1 and obZ#<80 and obZ#>0 and obX#<59 and obX#>0 and U#=180 and mouseclick()=1
set matrix height 1,obX#,obZ#,height#-.2
set matrix height 1,obX#,obZ#-1,height#-.1
set matrix height 1,obX#,obZ#+1,height#-.1
set matrix height 1,obX#-1,obZ#,height#-.1
set matrix height 1,obX#+1,obZ#,height#-.1
endif
rotate object 1,0,0,U#
`Use scroll wheel to rotate object
if r=1 and shiftkey()=0
if mousemoveZ()>MMZ and flag3=0 and shiftkey()=0 then y=wrapvalue(y+45)
if mousemoveZ()<MMZ and flag3=0 and shiftkey()=0 then y=wrapvalue(y-45)
if mousemoveZ()>MMZ or mousemoveZ()<MMZ
flag3 = 1
else
flag3 = 0
endif
MMZ=mousemoveZ()
endif
`scale object
if keystate(31)=1
MMZ=0
r=0
scale object num,sizeX#+mousemoveZ()*.1,sizeY#+mousemoveZ()*.1,sizeZ#+mousemoveZ()*.1
else
r=1
endif
rotate object 2,0,y,0
rotate object 3,0,y,0
` rotate object 4,90,0,y
` rotate object 5,90,0,y
` rotate object 6,0,y,0
`Control input for camera rotation/height
`raise/lower camera
if keystate(72)=1 then camY#=camY#+1
if keystate(80)=1 then camY#=camY#-1
`rotate camera view
if keystate(75) and flag4=0 then Q=Q-1
if keystate(75)=1
flag4 = 1
else
flag4 = 0
endif
if keystate(77) and flag5=0 then Q=Q+1
if keystate(77)=1
flag5 = 1
else
flag5 = 0
endif
`Q selects look direction
if Q=5 or Q=-3 then Q=1
if Q=1 then gosub forward
if Q=2 or Q=-2 then gosub right
if Q=3 or Q=-1 then gosub backward
if Q=4 or Q=0 then gosub left
position camera camX#,camY#,camZ#
yrotate camera wrapvalue(camAngY#)
`Look up/down and zoom using shift key
if shiftkey()=1
position mouse Xrez/2,Yrez/2
if mousemovey() > 0 then xrotate camera wrapvalue(camAngX#+1)
if mousemovey() < 0 then xrotate camera wrapvalue(camAngX#-1)
if mousemoveZ() > MMZ then Move camera 2
if mousemoveZ() < MMZ then Move camera -2
MMZ=mousemoveZ()
endif
` wire frame
if keystate(17)=1 and flag6 = 0 then wframe = wframe + 1
if wframe>1 then wframe = 0
if keystate(17)=1
flag6 = 1
else
flag6 = 0
endif
if wframe =1
set matrix wireframe off 1
else
set matrix wireframe on 1
endif
`Save / Load / Delete Static objects
`F2 is save, F3 load and F4 is delete
if keystate(60)=1 then gosub _save_routine
if keystate(61)=1 then gosub load
if keystate(62)=1 then delete static objects
`Debug info
set cursor 10,10
print "mouse x " , mousex()
print "mouse y " , mousey()
print mousemovez()
print "object number ",num
print "object angle ",y
print obX#," ",obZ#
print "X ",camX#," Z ",camZ#
print sizeX#," ",sizeY#," ",sizeZ#
print posY#," ",posX#
print speedY#," ",speedX#
print scancode()
update matrix 1
sync
loop
`gosubs
` SPECIAL THANKS TO LATCH FOR THIS ONE!
_save_routine:
repeat
text 300,400,"are you sure you want to save? (Y)/(N)"
choice$=lower$(inkey$())
until choice$="y" or choice$="n"
if choice$="y"
set cursor 300,440
Set Camera View 0,0,1,1
input "Please Enter File Name : ";static$
`put matrix values in array
for x = 1 to 60
for y = 1 to 80
hat#(x,y)=get ground height(1,x,y)
next y
next x
`save matix values
save array "hat.dat",hat#(0)
text 300,460,"File "+static$+" was saved successfully"
else
text 300,460,"LEVEL NOT SAVED !!!"
endif
wait 1000
Set Camera View 0,0,800,600
return
load:
load array "hat.dat",hat#(0)
`set matrix height with values from array
for x = 1 to 60
for y = 1 to 80
set matrix height 1,x,y,hat#(x,y)
next y
next x
return
placeobject:
if num>1
make static object num
endif
return
`camera movement
forward:
if mouseclick()=2
camX#=camX#+speedx#
camZ#=(camZ#-speedy#)
endif
camAngY#=0
position object num,posX#+camX#,Zval#,(posY#+camZ#)-32.5
return
right:
camAngY#=90
if mouseclick()=2
camX#=camX#-speedy#
camZ#=camZ#-speedx#
endif
position object num,(posY#-32)+camX#,Zval#,((posX#*-1)+camZ#)+.5
return
backward:
if mouseclick()=2
camX#=camX#-speedx#
camZ#=(camZ#+speedy#)
endif
camAngY#=180
position object num,(posX#*-1)+camX#,Zval#,((posY#*-1)+camZ#)+32.5
return
left:
if mouseclick()=2
camX#=camX#+speedy#
camZ#=camZ#+speedx#
endif
camAngY#=270
position object num,((posY#*-1)+camX#)+32,Zval#,((posX#)+camZ#)+.5
return
This world Editor has quite a few glitches,and I haven't included the resources. But It needs a better save system and when you save, it doesn't save objects. But once these Things are fixed,the sky is the limit.
Here's another Game engine example:
Rem * Title : Dave's Game Engine
Rem * Author : David Bell
Rem * Date : 08/30/2008
` This code was modified and recreated from The Game Creators
` It is reproduced here with full permission
` http://www.thegamecreators.com
REM :: Curse of the Vampire
REM :: Dave's Game Studios :: 2008-2020
REM :: AUTHOR: David Lewis Bell
sync on : sync rate 1000
set display mode 1024,768,32
fog on : fog distance 8000
hide mouse : autocam off
set camera range 1,10000
rem Make a sphere and set culling on to show both sides so we can see the inside of the sphere (like a sky).
make object sphere 1,9000
set object 1,1,1,0
color object 1,rgb(150,180,255)
rem Put some random objects around the level so you can see the change of light better
for o=2 to 20
load object "mountains.x",o
scale object o,220,220,220
load image "mountains.bmp",3
texture object o, 3
position object o,rnd(100*o),0,rnd(100*o)
next o
rem Put some trees in the scene
for p=2 to 7
load object "Calanistic Tree.x",p
scale object p,75,75,75
position object p,rnd(1000*p),0,rnd(1000*p)
next p
rem Make an Extra Light
make light 1 : set directional light 1,0,0,0
color light 1,rgb(0,0,50)
make light 2 : set directional light 2,0,0,0
color light 2,rgb(0,0,50)
rem Make a Sun
Sun=21
make object sphere Sun,200
color object Sun,rgb(225,180,1)
set object Sun,1,1,1,1,0,1,0
rem Make a Moon
Moon=22
make object sphere Moon,200
color object Moon,rgb(150,171,150)
set object Moon,1,1,1,1,0,1,1
rem Make a matrix texture
create bitmap 1,64,64 : cls rgb(0,155,0) : ink rgb(0,145,0),0 : box 4,4,12,12
get image 1,0,0,64,64 : delete bitmap 1
rem Make a matrix to move on
make matrix 1,3000,3000,3,3
prepare matrix texture 1,1,64,64
rem create vampire to follow
load object "walk.x",30
scale object 30,75,75,75
x#=500
z#=500
rem If you are going to use a save game function, then take out this next line
rem ... and use the variable you load from that instead. Otherwise, the default
rem ... time starts at 2AM here, just because.
oclock=0
rem Pre-Set Values
day=0
srotate#=270
mrotate#=90
cx#=500
cz#=500
do
rem Print Values
set text font "Verdana"
ink rgb(255,255,255),1
set text to bold
set text size 20
set text to italic
oclock$=str$(oclock)
rt2$=str$(realtime#)
amb$=str$(amb#)
rgb$=str$(rgb#)
ls$=str$(lspeed#)
fps$=str$(fps#)
days$=str$(day-1)
hr$=str$(hr)
`center text 320,25,"Framerate: "+fps$
text 25,25,oclock$+":"+rt$+" "+xm$
text 25,50,"Hours: "+hr$
text 25,75,"Days: "+days$
text 25,100,"Sr: "+str$(int(srotate#))
text 25,125,"Sx: "+str$(int(sunx#))+" | Sy: "+str$(int(suny#))+" | Sz: "+str$(int(sunz))
rem Control camera with arrow keys
if upkey()=1 then x#=newxvalue(x#,a#,-10) : z#=newzvalue(z#,a#,-10)
if downkey()=1 then x#=newxvalue(x#,a#,10) : z#=newzvalue(z#,a#,10)
if leftkey()=1 then a#=wrapvalue(a#-10.0)
if rightkey()=1 then a#=wrapvalue(a#+35.0)
rem Update character
y#=get ground height(1,x#,z#)+0
position object 30,x#,y#,z#
yrotate object 30,a#
rem Position camera to the back of the character
cx#=newxvalue(x#,wrapvalue(a#+0),300)
cz#=newzvalue(z#,wrapvalue(a#+0),300)
cy#=get ground height(1,cx#,cz#)+50.0
position camera cx#,cy#,cz#
rem Point camera at object
point camera x#,y#,z#
rem Call on the time control
GOSUB TIME_CONTROL
rem Call on the satellite control
GOSUB SAT_CONTROL
sync
loop
rem This is the real-time Day/Night Simulator
TIME_CONTROL:
`Time Speed / Rationale
`Change timespeed# to .03 for a reasonable time for real games. .530 is very fast and is for showing how the time works.
timespeed#=0.01
realtime#=realtime#+timespeed#
`Lights and Fog
fog color rgb(red#,green#,blue#)
`
color light 0,rgb(red#,green#,blue#)
set directional light 0,1,1,1
`Red
if rl=0
rl#=rl#-(timespeed#*0.30)
if rl#=<0 then rl#=0
endif
if rl=1
rl#=rl#+(timespeed#*0.18)
if rl#=>255 then rl#=255
endif
`Green
if gl=0
gl#=gl#-(timespeed#*0.35)
if gl#=<0 then gl#=0
endif
if gl=1
gl#=gl#+(timespeed#*0.16)
if gl#=>255 then gl#=255
endif
`Blue
if bl=0
bl#=bl#-(timespeed#*0.41)
if bl#=<50 then bl#=50
endif
if bl=1
bl#=bl#+(timespeed#*0.25)
if bl#=>255 then bl#=255
endif
`On the clock - Red
if oclock=>4 and oclock=<16 then rl=1
if oclock=>17 and oclock=<23 then rl=0
if oclock=>0 and oclock=<3 then rl=0
`On the clock - Green
if oclock=>5 and oclock=<17 then gl=1
if oclock=>18 and oclock=<23 then gl=0
if oclock=>0 and oclock=<4 then gl=0
`On the clock - Blue
if oclock=>0 and oclock=<3 then bl=0
if oclock=>6 and oclock=<18 then bl=1
if oclock=>19 and oclock=<23 then bl=0
`
if oclock=24 then oclock=0
if oclock=>0 and oclock=<11 then xm$="AM"
if oclock=>12 and oclock=<23 then xm$="PM"
`
if oclock=0 and dstop=0 then day=day+1 : dstop=1
if oclock>1 then dstop=0
`Denote Time
if realtime#=>0 and realtime#<10 then rt$="0"+str$(int(realtime#))
if realtime#>=10 and realtime#<60 then rt$=str$(int(realtime#))
if realtime#=>60 then oclock=oclock+1 : realtime#=0
if realtime#=0 then hr=hr+1
`Altering Variables
amb#=1+rl#*1.5
red#=rl#*1.5
green#=gl#*1.0
blue#=bl#*1.5
if red#=>255 then red#=255 : if red#=<0 then red#=0
if green#=>255 then green#=255 : if green#=<0 then green#=0
if blue#=>255 then blue#=255 : if blue#=<0 then blue#=0
`Ambient Control
if amb#=<20 then amb#=20
if amb#=>75 then amb#=75
set ambient light amb#
RETURN
rem This is where the moon and the sun rotate around the landscape
SAT_CONTROL:
rem Sun
swide#=2500
if oclock=>0 and oclock=<22
sunx#=swide#*cos(srotate#)
suny#=swide#*sin(srotate#)
sunz#=swide#*sin(srotate#)
position object Sun,sunx#+camera position x(),suny#+camera position y(),sunz#+camera position z()
suntime#=suntime#+timespeed#
srotate#=suntime#*(timespeed#/1.5)
srotate#=wrapvalue(srotate#)-75
endif
rem Sun's Light
`
color light 1,rgb(red#,green#/2.5,0)
set light to object position 1,Sun
point object Sun,cx#,cy#,cz#
set light to object orientation 1,Sun
`
if oclock=23
sunx#=swide#*cos(srotate#)
suny#=swide#*sin(srotate#)
sunz#=swide#*sin(srotate#)
position object Sun,sunx#+camera position x(),suny#+camera position y(),sunz#+camera position z()
suntime#=0
srotate#=suntime#*(timespeed#/1.5)
srotate#=wrapvalue(srotate#)-75
endif
rem Moon
mwide#=-2200
moonx#=mwide#*cos(mrotate#)
moony#=mwide#*sin(mrotate#)
moonz#=mwide#*sin(mrotate#)
position object Moon,moonx#+camera position x(),moony#+camera position y(),moonz#+camera position z()
moontime#=moontime#+timespeed#
mrotate#=moontime#*(timespeed#/1.15)
mrotate#=wrapvalue(mrotate#)+245
rem Moon's Light
`
color light 2,rgb(0,green#/5,blue#)
set light to object position 2,Moon
point object Moon,cx#,cy#,cz#
set light to object orientation 2,Moon
RETURN
Now there's so many things in here I'd like to fix but don't have a clew. So Let us do more Sharing of Code knowledge and show the Dark Basic Pro Users they just wasted their money by spending more.
and please by all means any code Ideas for anything send me an email with code in text format and I'll be glad to get back with ya. Email at:
[email protected]
[Please use code tags in future - IanM]