Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: razorjack on October 01, 2007, 06:17:41 pm

Title: Another tests
Post by: razorjack on October 01, 2007, 06:17:41 pm
Hello testers,

A next version can be found at the same link: http://www.razorjack.de/fs2-test.zip (executable + source)
Please test it if there are crashes. Especially I would like to know if the free camera from the scripting is working and if the multiplayer mode is still functioning.

The source can be compiled on the same way I told in http://www.hard-light.net/forums/index.php/topic,49809.0.html (one of my last posts)

Thank you all.
Title: Re: Another tests
Post by: Nuke on October 02, 2007, 06:18:36 pm
assuming you pulled your base code from head i should have a script or two that might help test those cameras. i know my guided missile script has a camera for the missile, but a pre-existing bug in the camera code wont let me reset back to my ship. the other script is a view script thats supposed to allow better view controls, but its also bugged and messes up the hud. but it should be enough to give a good test with.

unfortunately i cant seem to run a script with the r build. launching it just causes vista to give its program stopped responding error. the debur build ran with the script and managed to get in mission. but then i get a null vector error

Code: [Select]
Warning: Null vec3d in vec3d normalize.
Trace out of vecmat.cpp and find offending code.

File: vecmat.cpp
Line: 809


Call stack:
------------------------------------------------------------------
    fs2_open_dthing.exe 0086cb3b()
    fs2_open_dthing.exe 0087c7de()
    fs2_open_dthing.exe 0087ccb6()
    fs2_open_dthing.exe 0087db21()
    fs2_open_dthing.exe 00738778()
    fs2_open_dthing.exe 0073a007()
    fs2_open_dthing.exe 0073b09d()
    fs2_open_dthing.exe 0073e4cb()
    fs2_open_dthing.exe 00951551()
    fs2_open_dthing.exe 0073fb0f()
    fs2_open_dthing.exe 0073fd9e()
    fs2_open_dthing.exe 00c8b8e0()
    fs2_open_dthing.exe 00c8b61d()
    kernel32.dll 75c23833()
    ntdll.dll 7717a9bd()
------------------------------------------------------------------

fortunately i get the same message when running the script with my own debug build, so its not youre fault. i think theres either a bug in the script, or theres a bug in the camera handeling code. im currently trying to fix anything in my script which might cause the above error. i probibly foogot to check if something was valid.
Title: Re: Another tests
Post by: Nuke on October 02, 2007, 09:32:35 pm
oh heres my poorly commented missile code with hackishly added camera code that doesnt work too well :lol:

Code: [Select]
#Global Hooks ;;guided missiles, proof of concept version
$GameInit:
[
-------------------------------
----------screen vars----------
-------------------------------

setscreenvars = function() --scalers and constants for multi res support
local w = gr.getScreenWidth()
local h = gr.getScreenHeight()
local cx = w/2
local cy = h/2
local wf = 0
local hf = 0
local awh = 0
local hires = false

if w >= 1024 then
wf = w / 1024
hf = h / 768
awh = (wf + hf) / 2
hires = true
else
wf = w / 640
hf = h / 480
awh = ((wf + hf) / 2) * 0.625
hires = false
end

return w,h,cx,cy,wf,hf,awh,hires
end

----------------------------
----------controls----------
----------------------------

mousejoy = function() --mousejoy function, short version
local X = io.getMouseX()
local Y = io.getMouseY()

if hires then
X = (X / 511.5) - 1
Y = (Y / 383.5) - 1
else
X = (X / 319.5) - 1
Y = (Y / 239.5) - 1
end

return X, Y
end

-------------------------
----------Maths----------
-------------------------

matx = function(ma, mb) --matrix multiply
local m = ba.createVector(0,0,0):getOrientation()
m[1] = ma[1] * mb[1] + ma[2] * mb[4] + ma[3] * mb[7]
m[2] = ma[1] * mb[2] + ma[2] * mb[5] + ma[3] * mb[8]
m[3] = ma[1] * mb[3] + ma[2] * mb[6] + ma[3] * mb[9]
m[4] = ma[4] * mb[1] + ma[5] * mb[4] + ma[6] * mb[7]
m[5] = ma[4] * mb[2] + ma[5] * mb[5] + ma[6] * mb[8]
m[6] = ma[4] * mb[3] + ma[5] * mb[6] + ma[6] * mb[9]
m[7] = ma[7] * mb[1] + ma[8] * mb[4] + ma[9] * mb[7]
m[8] = ma[7] * mb[2] + ma[8] * mb[5] + ma[9] * mb[8]
m[9] = ma[7] * mb[3] + ma[8] * mb[6] + ma[9] * mb[9]
return m
end

arbrot = function(a, r)
local s = math.sin(r)
local c = math.cos(r)
local t = 1 - c
local m = ba.createVector(0,0,1):getOrientation()

m[1] = t * a.x^2 + c
m[2] = t * a.x * a.y + s * a.z
m[3] = t * a.x * a.z - s * a.y

m[4] = t * a.x * a.y - s * a.z
m[5] = t * a.y^2 + c
m[6] = t * a.y * a.z + s * a.x

m[7] = t * a.x * a.z + s * a.y
m[8] = t * a.y * a.z - s * a.x
m[9] = t * a.z^2 + c

return m
end

w,h,cx,cy,wf,hf,awh,hires = setscreenvars()

]
$Simulation:
[

player = mn.Ships['Alpha 1']
x,y = mousejoy()
x = x * ba.getFrametime()
y = -y * ba.getFrametime()

cam = nil --clear and reset camera

for i=1, #mn.Weapons do
local wep = mn.Weapons[i]
if wep.Class.Name == "Infyrno" then
local axis = wep.Orientation:unrotateVector(ba.createVector(1,0,0))
local mat = arbrot(axis,y)
wep.Orientation = matx(wep.Orientation,mat)

axis = wep.Orientation:unrotateVector(ba.createVector(0,1,0))
mat = arbrot(axis,x)
wep.Orientation = matx(wep.Orientation,mat)

wep.Physics.Velocity = wep.Orientation:unrotateVector(ba.createVector(0,0,wep.Class.Speed))
tracking = true

if cam == nil then
cam = ts.createCamera("Missile Camera", wep.Position, wep.Orientation)
end
end
end

if cam ~= nil then ts.setCamera(cam) else ts.setCamera(ts.Cameras[1]) end

]
$HUD:
[

if tracking then gr.setColor(255,0,0,128) else gr.setColor(0,0,255,128) end
tracking = nil
gr.drawCircle(3,io.getMouseX()*wf,io.getMouseY()*hf)

]
#End
Title: Re: Another tests
Post by: chief1983 on October 03, 2007, 01:19:47 am
Chain letters!?  Where?  I see no chain letters.

As far as the debug build goes, it crashes to desktop using the current FotG development files, which don't crash goob's 9/22 debug build (from the stable branch).  No debug error message either, just a windows illegal operation error.  The regular build doesn't crash.
Title: Re: Another tests
Post by: jr2 on October 03, 2007, 03:14:04 am
IIRC, Nuke, razorjack said he'd used a stable build...

EDIT: got it:

Please take also in account that I'm using a source snapshot from the 25th September and I can't keep the sources synchronized with the actual state of the SCP project.
Title: Re: Another tests
Post by: karajorma on October 03, 2007, 03:16:03 am
The builds are based on HEAD not the 3.6.9 branch.
Title: Re: Another tests
Post by: razorjack on October 03, 2007, 10:15:41 am
I'm using HEAD build, so maybe there are problems you mentioned.

For the camera script. Try to pass nothing to the function setCamera. I hope,  this would reset the camera tracking mode.
As I understood the FS2 code below looks if there isn't any argument available:

   if(!ade_get_args(L, "o", l_Camera.Get(&idx)))
   {
      Viewer_mode &= ~VM_FREECAMERA;
      return ADE_RETURN_NIL;
   }

Title: Re: Another tests
Post by: Nuke on October 03, 2007, 10:33:24 am
thats the way set camera is supposed to work. thats that pre-existing bug i was talking about. i mantised it. but if i try to call ts.setCamera() with no args, i tend to get a no arguments passed error and the game will crash.

on the scripting system side ive also noticed my guided missiles tend to go through their targets rather than hit them. the missile should detonate when you fly it into something. im controling the velocity directly and also changing the misiles orientation. you can also use this script on primaries but they tend not to hit anyything if you steer them more than a few degrees off the crosshair.
Title: Re: Another tests
Post by: chief1983 on October 03, 2007, 11:48:11 am
If someone could get me an unmodified HEAD build from close to the date he checked out, I can find out if the crash to desktop is his code's fault or an existing bug in HEAD.
Title: Re: Another tests
Post by: Inquisitor on October 03, 2007, 12:37:07 pm
Anyone with a CVS client can get by date.
Title: Re: Another tests
Post by: chief1983 on October 03, 2007, 12:58:52 pm
Last time I tried I wasn't having much luck compiling HEAD debug builds, I'll try again though.

Edit:  Well, I had success compiling, but the unmodified HEAD build still crashes with our files, so I guess it's something on our end.  Wish it gave some sort of error.  Probably one of our unstable models.
Title: Re: Another tests
Post by: Nuke on October 03, 2007, 11:10:49 pm
use my build from the scripting forum, its fairly new and diffed wmc's code to update some of the scripting stuff. im not sure if wmc commited the diffs to cvs yet or not.