Quote: "We can work together to resolve these issues but to do this I need your help."
Thank you Mike.
Quote: "I have been using Dark Physics in a very large application with many rigid bodies and not encountered any problems."
I'm certain this is true, since you are a developer of the product and know it better than end-users. (this is where better documentation would help us)
Quote: "As for your last comment - I'm not sure what you mean."
I was referring to
this thread on the last post.
Quote: "to say "they've got like 2 huge program examples that encompass all of the commands" is completely wrong."
I was more referring to the base help files for DBP, not the DP help files, most commands in the DBP help files refer to the same two "showcase" and "usage" programs that usually show just the command in use, not what the effects of all the parameters do.
Quote: "Have you read the tutorials?"
I started to, but stopped when I saw things like this:
post
Below is the code from my project, i have stripped out functions and routines that deal with multiplayer aspects. Please excuse the messy code, that is a result of hit-and-miss methods of trying to get things to work right. Media attached to post.
left/right aims, tap ctrl to hit, hold ctrl to go higher.
goto skipwinsock
remstart
winsock make
if (winsock error())
`an error has occurred, print the error message and quit.
print winsock error msg$()
wait key
end
endif
input "Type 1 for server or 2 for client:",ia$
if ia$="2"
input "Server IP:",ip$
input "Server port:",prt$
prt=val(prt$)
print "Connecting..."
channel = winsock connect(ip$,prt)
endif
if ia$="1"
input "Your public IP:",ip$
input "Listen port:",prt$
prt=val(prt$)
print "Waiting for connection...";
channel =winsock listen(ip$,prt)
while winsock channel data waiting(channel)=null
sleep 1000
print ".";
winsock refresh channels
endwhile
channel=winsock accept(channel)
endif
check_for_error(channel)
if tda<>0 then print "Error "+str$(tda)+" reported by Winsock"
print
print
print "*** Remote OK"
print
print "Connection established, loading program..."
sync
sleep 2000
remend
skipwinsock:
#constant opx object position x
#constant opy object position y
#constant opz object position z
#constant oax object angle x
#constant oay object angle y
#constant oaz object angle z
global debnce as integer: debnce=0
global dbct as integer
global zz$ as string
dim txtbuff$(200) as string
Null = Make Vector3(2)
sync on
sync rate 60
load effect "fur.fx",1,1
null=make vector4(1)
furscale as float
furscale=1.0
set effect constant float 1,"furscale",furscale
`set effect constant vector 1,"lightDir",1
`load image "grass2.bmp",4
`load image "stratat.bmp",3
`make object terrain 1
``set object effect 1, 1
`set terrain heightmap 1,"stratah.bmp"
`set terrain split 1,16
`set terrain scale 1,12.0,1.2,12.0
`set terrain texture 1,3,4
`set terrain tiling 1,1
`set terrain light 1,0,0,0,1,1,1,1
`build terrain 1
load object "golfcourse1.x",1
scale object 1,100,100,100
load image "grass2.bmp",4
texture object 1,4
scale object texture 1,100,100
`set object effect 1, 1
`set reflection shading on 1
phy start
`phy set gravity 0.0,-19.6,0.0
`phy set default sleep linear velocity squared 400.0
`phy set bounce threshold 0.0
`phy set auto fixed timing
phy make material 2,"golfball"
phy set material dynamic friction 2,0.2
phy set material static friction 2,0.2
phy set material restitution 2,0.2
phy set material friction combine 2,1
`phy set material restitution combine 2,3
phy build material 2
phy make material 3,"green"
phy set material dynamic friction 3,99.9
phy set material static friction 3,99.9
phy set material restitution 3,0.99
phy set material friction combine 3,1
`phy set material restitution combine 3,3
phy build material 3
phy make rigid body static mesh 1,3
load object "golfball.x",2
scale object 2,10,10,10
position object 2,10,10,30
phy make rigid body dynamic sphere 2,2
position camera 0,3100,400,1100
`phy set timing 50.0,8,1
phy set rigid body linear velocity 2,-1.0,1.0,1.0
phy set rigid body max angular velocity 2,1000
`phy set rigid body angular momentum 2,0.0,10000.0,0.0
phy set rigid body mass 2,10.0
`set shadow shading on 2,0,100,0
position light 0,3100,1000,1100
load image "golfbump.png",5,1
load image "golfball2.jpg",6
`set object effect 2,1
texture object 2,6
set bump mapping on 2,5
`set object effect 2,1
`phy set rigid body sleep linear velocity 2,500.0
`phy set rigid body sleep angular velocity 2,500.0
`phy set rigid body linear damping 1,0.0
`phy set rigid body linear damping 2,0.0
`phy set timing 60.0,1,0
`phy set default sleep angular velocity squared 10000.0
`phy set default sleep linear velocity squared 10000.0
d#=2
phy set timing 1.0 / 60.0, 60 / 20, 8
`phy set timing 20.1,2,1
phy set gravity 0.0,-9.8,0.0
make object plain 3,2,2
load image "arrow.bmp",7
texture object 3,7
rotate object 3,90,0,0
fix object pivot 3
set object transparency 3,1
load object "golfguy1.x",4
position object 4,10,200,10
scale object 4,2,2,2
color object 4,rgb(200,128,128)
hide object 4
make OBJECT sphere 5,5000
load image "sky.jpg",8
texture object 5,8
set object cull 5,0
`hide object 5
`scale object 5,5000,5000,5000
g#=10.0
`phy set auto fixed timing
`phy set continuous cd 1.0
`phy set rigid body ccd 2,1
`phy set rigid body ccd motion threshold 2,20
do
remstart skip winsock
winsock refresh channels
if winsock channel data waiting(channel)
message$ = winsock recv string(channel)
if message$<>"" then txtscradd("Remote: "+message$)
endif
remend
x#=phy get rigid body linear velocity x (2)
y#=phy get rigid body linear velocity y (2)
z#=phy get rigid body linear velocity z (2)
d#=phy get rigid body angular velocity x(2)
e#=phy get rigid body angular velocity y(2)
f#=phy get rigid body angular velocity z(2)
c=0
while phy get collision data() and phy get rigid body sleeping(2)=0
a=phy get collision object a()
b=phy get collision object b()
if a=1 and b=2 then c=1
endwhile
if c=1 `and (abs(x#)>0.8 or abs(y#)>0.8 or abs(z#)>0.8 and (abs(d#)+abs(e#)+abs(f#)>0.7))
x#=x#*0.99 : rem these are required since DP has no rolling collision
y#=y#*0.99
z#=z#*0.99
d#=d#*0.99
e#=e#*0.99
f#=f#*0.99
phy set rigid body linear velocity 2,x#,y#,z#
phy set rigid body angular velocity 2,d#,e#,f#
endif
if c=1 and (abs(x#)+abs(y#)+abs(z#))/3.0<3.33 and (abs(d#)+abs(e#)+abs(f#))/3.0<0.2 then h=h+2
if h>10
phy sleep rigid body 2:h=0:show object 3:show object 4
sttx# =opx (2)
stty# =opy (2)
sttz# =opz (2)
`winsock send string channel,"System: "+str$(opx (2))+","+str$(opy (2))+","+str$(opz (2))+",_,"+str$(d#)+","+str$(e#)+","+str$(f#)+chr$(10)+chr$(13)
`txtscradd("Loc System: "+str$(opx (2))+","+str$(opy (2))+","+str$(opz (2))+",_,"+str$(d#)+","+str$(e#)+","+str$(f#)+chr$(10)+chr$(13))
endif
if h>0 then h=h-1
`if x#<128.0 then x#=x#+0.01
`phy set rigid body linear velocity 2,x#,y#,z#
`if upkey() then phy set rigid body angular velocity 2,100.0,0.0,0.0
`if leftkey() then phy set rigid body angular velocity 2,0.0,0.0,100.0
`if downkey() then phy set rigid body angular velocity 2,-100.0,0.0,0.0
`if rightkey() then phy set rigid body angular velocity 2,0.0,0.0,-100.0
if leftkey() then yrotate object 3,oay (3)+0.3:rotate object 4,oax (3),oay (3)-90,oaz (3)
if rightkey() then yrotate object 3,oay (3)-0.3:rotate object 4,oax (3),oay (3)-90,oaz (3)
arx#=sin(wrapvalue(oay (3)-180.0))
arz#=cos(wrapvalue(oay (3)-180.0))
if controlkey()
phy set rigid body linear velocity 2,arx#*10.0,10.0,arz#*10.0:hide object 3:hide object 4
endif
if spacekey() then phy sleep rigid body 2:`g#=g#+0.1
if shiftkey() then phy wake up rigid body 2:`g#=g#-0.1
`k$=inkey$()
`if k$="a" then phy sleep rigid body 2
`if k$="s" then phy wake up rigid body 2
`if k$="l"
`delete file "debug.txt"
`open to write 1,"debug.txt"
`write string 1,str$(x#)
`write string 1,str$(y#)
`write string 1,str$(z#)
`write string 1,str$(d#)
`write string 1,str$(e#)
`write string 1,str$(f#)
`close file 1
`endif
position camera 0,opx (2),opy (2)+g#/2,opz (2)
set camera to object orientation 0,3
yrotate camera 0,camera angle y(0)+180
move camera 0,-g#
point camera opx (2),opy (2),opz (2)
position object 3,opx (2),opy (2)+2, opz (2)
position object 4,opx (2),opy (2),opz (2)
position object 5,opx (2),opy (2),opz (2)
`phy set timing 20.0,2,1
`phy update
`phy update
`phy update
xangle# = WrapValue( xangle# + 0.1 )
set vector4 1,Cos( XAngle# ), -1 , Sin( Xangle# ), 0
text 10,210,"x:"+str$(opx (2))
text 10,220,"y:"+str$(opy (2))
text 10,230,"z:"+str$(opz (2))
text 10,240,"c:"+str$(c)
text 10,250,"px:"+str$(x#)
text 10,260,"py:"+str$(y#)
text 10,270,"pz:"+str$(z#)
text 10,280,"pax:"+str$(d#)
text 10,290,"pay:"+str$(e#)
text 10,300,"paz:"+str$(f#)
text 10,310,"h:"+str$(h)
text 10,320,"arx:"+str$(arx#)
text 10,330,"arz:"+str$(arz#)
text 10,340,"fps:"+str$(screen fps())
text 500,20,"polycount:"+str$(statistic(1))
text 500,10,"Yards: "+str$(int((get_distance(opx (2),opy (2), opz (2),sttx#,stty#,sttz#))/4.0))
msgs$=getkey(80,20,10,400,9,549,rgb(150,150,150),rgb(50,50,50))
if msgs$<>""
txtscradd("Local: "+msgs$)
`winsock send string channel,msgs$+chr$(10)+chr$(13)
endif
msgs$=""
txtscroll()
set effect constant vector 1,"lightDir",1
phy update
sync
loop
Function Get_Distance(x1#,y1#,z1#,x2#,y2#,z2#)
Set Vector3 2,x1#-x2#,y1#-y2#,z1#-z2#
d#=Length Vector3(2)
Endfunction d#
function check_for_error(a_channel as DWORD)
if (winsock channel error(a_channel))
txtscradd(winsock channel error msg$(a_channel))
winsock clean up
endif
endfunction
function txtscroll()
ink rgb(255,255,255),0
for q=0 to 10
text 5,120-(q*10),txtbuff$(q)
next q
endfunction
function txtscradd(buff$ as string)
for q=200 to 1 step -1
txtbuff$(q)=txtbuff$(q-1)
next q
txtbuff$(0)=buff$
txtscroll()
endfunction
function getkey(tf as integer,ts as integer,tx as integer,ty as integer,tx2 as integer,ty2 as integer,tfc as integer,tbc as integer)
curcount=curcount+1
if curcount>5 then curcount=0:baron=baron +1
if baron=2 then baron=0
rem text 10,10,str$(baron)+" "+str$(curcount)
pfs=text size()
tzz$=zz$
if scancode()<>14 then zz$=zz$+entry$()
if scancode()<>14 and debnce=1 then debnce=0:dbct=0
if scancode()=14 and debnce=1 then dbct=dbct+1
if scancode()=14 and debnce=1
if dbct>16 then zz$=left$(zz$,(len(zz$)-1)):dbct=16
endif
if debnce=0
if scancode()=14 then zz$=left$(zz$,(len(zz$)-1)):debnce=1
endif
clear entry buffer
rem if scancode()=14 then goto skpy
rem if tzz$<>zz$ then ink tbc,0:box tx,ty,tx2,ty2:ink tfc,0
if right$(zz$,1)=chr$(13) then msgs$=left$(zz$,len(zz$)-1):clear entry buffer:zz$=""
if len(zz$)>tf then zz$=left$(zz$,tf)
if baron=1 then ad$="_"
if baron=0 then ad$=""
set text size ts
ink tbc,0
text tx2,ty2, "Chat> "+zz$+ad$
ink tfc,0
text tx,ty, "Chat>"+zz$+ad$
skpy:
set text size pfs
endfunction msgs$
