In the attachment are two projects. The first builds a static objects and adds lightmaps then saves the static universe. The second project load a saves static universe. Both with movement and collision checking.
Quote: "define the static universe. (which means exactly ??)"
Set Static Universe x, y, x; x, y and z or the width height and depth respectfully and should be divisible by 100 - 3D units. Set Static Universe 4000, 2000, 4000 will set the static universe to be 4000 units wide by 2000 units high by 4000 units deep which is how FPS Creator set the universe.
Quote: "places and positions the objects
make them static (so ??)
"
Now, say we set up our universe as FPS Creator does. What this means is our universe is 4000 unit wide by 2000 units high by 4000 units deep in the positive x, y and negative in the z dimensions. We must place our object within this box we created for the objects to be visible in our static universe. We can give the objects a texture, position, rotation and even a effect. Then we add it to the static object with -
Make Static Object Object Number, Collision, Arbitrary Value, Cast Shadow, Portal Blocker;
Next we call Build Static Portals.
Quote: "adds light map lights ......"
Now we can either; Add Static Objects To Light Map Pool or start adding lights with - Add Light Map Light, the order does not matter. Once all the light are set just call - Create Light Maps. You need to create the directory for the light maps as the - Create Light Maps function will not do this for you.
Project 1 will create a static universe with light mapping and it will save the static universe so it can be loaded into project 2. Now here is the problem. Project 1 will crash on exit in DarkBasic Professional. However, this is not an issue with Dark GDK. I mention that, as I’m currently working on a level editor using the GameFX functions in Dark GDK.
I have DarkLights from the DBPro Extra's download for modding the FPS Creator source. So I really haven’t used it much. Sorry, can’t be much help there.
Edit: Please stay tuned. I am currently experiencing technical difficulties uploading the files.
Edit #2: Since I uploaded this code with out the light mapping a week or two ago on another thread, you can download from
here and replace the code.
GameFX1:
#constant SKYID 1
set static universe 4000, 2000, 4000
load image "wall_d2.dds", 1
load image "floor_d2.dds", 2
load object "wall.x", 1
load object "floor.x", 2
texture object 1, 1
texture object 2, 2
position object 1, 50, 50, 0
make static object 1, 1, 0, 0, 2
rotate object 1, 0, -90, 0
position object 1, 0, 50, -50
make static object 1, 1, 0, 0, 2
for y=0 to 19
for x=0 to 19
position object 2, x*100+50, 0, -y*100-50
make static object 2, 1, 0, 0, 2
next x
next y
delete object 1
delete object 2
build static portals
if file exist("test.dbo")
delete file "test.dbo"
delete file "test.dbu"
endif
if path exist ("LightMaps")=0
make directory "LightMaps"
endif
add light map light 100.0, 100.0, -100.0, 150.0, 255.0, 255.0, 255.0, 255.0, 1
add static objects to light map pool
create light maps 16, 1, "LightMaps"
save static objects "test.dbo"
delete static objects
load static objects "test.dbo", 0
load object "sky.x", SKYID
set object collision off SKYID
scale object SKYID, 100000, 100000, 100000
set object texture SKYID, 2, 0
set object light SKYID, 0
set object cull SKYID, 0
set object fog SKYID, 0
sync on
sync sleep 1
autocam off
position camera 250, 52.8, -250
point camera 0, 52.8, 0
set camera range 2.0, 9000.0
set camera fov 75.0
hide light 0
set ambient light 10
do
set cursor 0, 0
print "Camera X: ";camera position x()
print "Camera Y: ";camera position y()
print "Camera Z: ";camera position z()
rem Input source
tkeystate30=0 : tkeystate32=0 : tkeystate17=0 : tkeystate31=0
if keystate(17) or mouseclick()=1 then tkeystate17=1
if keystate(31) or mouseclick()=2 then tkeystate31=1
if keystate(30) then tkeystate30=1
if keystate(32) then tkeystate32=1
cammovex#=mousemovex()
cammovey#=mousemovey()
rem Camera old information
cox#=camera position X()
coy#=camera position Y()
coz#=camera position Z()
rem Control camera movement
movement=0 : speed#=3.0
x#=camera angle x() : z#=camera angle z() : sy#=camera angle y() : y#=sy#
if tkeystate30=1 then dec y#,90 : movement=1
if tkeystate32=1 then inc y#,90 : movement=1
rotate camera 0, y#, 0
if tkeystate17=1 or tkeystate30=1 or tkeystate32=1 then move camera speed# : movement=1
if tkeystate31=1 then move camera speed#*-1.0 : movement=1
rotate camera x#, sy#, z#
rem Camera new information
cmx#=camera position x()
cmy#=camera position y()-grav#
cmz#=camera position z()
rem Overall ellipse collision for camera
if static volume(cox#, coy#-20, coz#, cmx#, cmy#-20, cmz#, 1.0)
materialtype=get static collision value()
cmx#=cox#+get static collision x()
cmy#=coy#+get static collision y()
cmz#=coz#+get static collision z()
grav#=0.5
else
inc grav#, 0.5
endif
rem Stop falling forever
if cmy#<0 then cmy#=0
rem Update camera position and sky
position camera cmx#, cmy#, cmz#
position object SKYID, cmx#, cmy#, cmz#
rem Control camera view
camangx#=camera angle x()+cammovey#/1.5
camangy#=camera angle y()+cammovex#/1.5
if wrapvalue(camangx#)>85 and wrapvalue(camangx#)<180 then camangx#=85.0
if wrapvalue(camangx#)>180 and wrapvalue(camangx#)<275 then camangx#=275.0
rotate camera camangx#, camangy#, camera angle z()
sync
loop
end
GameFX2:
#constant SKYID 1
load static objects "test.dbo", 0
load object "sky.x", SKYID
set object collision off SKYID
scale object SKYID, 100000, 100000, 100000
set object texture SKYID, 2, 0
set object light SKYID, 0
set object cull SKYID, 0
set object fog SKYID, 0
sync on
sync sleep 1
autocam off
position camera 250, 52.8, -250
point camera 0, 52.8, 0
set camera range 2.0, 9000.0
set camera fov 75.0
hide light 0
set ambient light 10
do
set cursor 0, 0
print "Camera X: ";camera position x()
print "Camera Y: ";camera position y()
print "Camera Z: ";camera position z()
rem Input source
tkeystate30=0 : tkeystate32=0 : tkeystate17=0 : tkeystate31=0
if keystate(17) or mouseclick()=1 then tkeystate17=1
if keystate(31) or mouseclick()=2 then tkeystate31=1
if keystate(30) then tkeystate30=1
if keystate(32) then tkeystate32=1
cammovex#=mousemovex()
cammovey#=mousemovey()
rem Camera old information
cox#=camera position X()
coy#=camera position Y()
coz#=camera position Z()
rem Control camera movement
movement=0 : speed#=3.0
x#=camera angle x() : z#=camera angle z() : sy#=camera angle y() : y#=sy#
if tkeystate30=1 then dec y#,90 : movement=1
if tkeystate32=1 then inc y#,90 : movement=1
rotate camera 0, y#, 0
if tkeystate17=1 or tkeystate30=1 or tkeystate32=1 then move camera speed# : movement=1
if tkeystate31=1 then move camera speed#*-1.0 : movement=1
rotate camera x#, sy#, z#
rem Camera new information
cmx#=camera position x()
cmy#=camera position y()-grav#
cmz#=camera position z()
rem Overall ellipse collision for camera
if static volume(cox#, coy#-20, coz#, cmx#, cmy#-20, cmz#, 1.0)
materialtype=get static collision value()
cmx#=cox#+get static collision x()
cmy#=coy#+get static collision y()
cmz#=coz#+get static collision z()
grav#=0.5
else
inc grav#, 0.5
endif
rem Stop falling forever
if cmy#<0 then cmy#=0
rem Update camera position and sky
position camera cmx#, cmy#, cmz#
position object SKYID, cmx#, cmy#, cmz#
rem Control camera view
camangx#=camera angle x()+cammovey#/1.5
camangy#=camera angle y()+cammovex#/1.5
if wrapvalue(camangx#)>85 and wrapvalue(camangx#)<180 then camangx#=85.0
if wrapvalue(camangx#)>180 and wrapvalue(camangx#)<275 then camangx#=275.0
rotate camera camangx#, camangy#, camera angle z()
sync
loop
Well if this doesn't freak'n work this time, I give up!
Edit #3: Looks like I can't even get a link to work tonight. So, here is the url to the thread the download is at; http://forum.thegamecreators.com/?m=forum_view&t=212972&b=1
Edit #4: Download fixed. Had a virus.