Hard Light Productions Forums
Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Cross-Platform Development => Topic started by: northtwilight on January 10, 2006, 08:02:08 pm
-
Hi all,
I'm about to start messing around with the code. Over the next month or so I will be getting a Linux build on an Nvidia 6600LE going, with the aim being to learn about development. I'm no guru, but I do use Linux daily, and it's been my desktop for 6 years now.
Any pointers you could give me -- even the trivially simple -- would be very much appreciated.
Thanks
M
-
http://www.hard-light.net/forums/index.php/topic,37772.0.html ;)
-
Will look at Lua references online, starting tonight (Wikibooks/pedia) - others?
;)
Am one jazzed mofo now! Thanks boss. :D
(edit): I think I'm going to start a new series of topical posts, called 'Developmentally Challenged Questions,' where I can ask you lot the dumbest dev questions imaginable. Feel free to mock!
Mind if I start here?
DCQ 1: Is Lua part of Fred? If it is, does that mean I can't see it on Linux just yet?
-
Oh... While you're at LUA... I think your newest changes broke something ;)
freespace2/freespace.cpp: In function `void game_frame(int)':
freespace2/freespace.cpp:5991: error: `Script_hudhook' was not declared in this scope
freespace2/freespace.cpp:5991: warning: unused variable 'Script_hudhook'
make[1]: *** [freespace.o] Error 1
Oh... And "-output_scripting" still produces an empty file ;)
But I think that this is correct....
-
DCQ 1: Is Lua part of Fred? If it is, does that mean I can't see it on Linux just yet?
Nope. It's general in nature so it's supposed to be a basic part of the engine. Lua itself is statically linked into the Linux build but I don't think that there is an option to actually enable scripting (Lua) yet. Define USE_SCRIPTING (is that right?) to enable it in the build.
-
Was including a scripting language something that implied pain on your part? I've seen threads where you've noted a real problem with it (something about Python being imprecise and poo?) (this is getting offtopic...)
Will check it out tonight (got sidetracked watching the French-language debates on Radio-Canada last night). Thanks T. M
-
We had a big debate awhile back..Goober wanted to expand the SEXP system instead, and taylor was concerned about memory/CPU usage.
Right now, it's set up so that if you define USE_LUA, you can use "[]" to define a Lua code block for any scripting variables. The Lua code is separated from the rest of the code with a language-independent layer, so you can toggle on and off USE_PYTHON seperately. However, unless you're going to actually work on the PYthon code, I don't recommend compiling it in. Mostly I just copied my code from the initial scripting implementation, I've never tested it since implementing the layer.
I've uploaded my codebase to CVS. This should fix the compile problems, and give you a few goodies (http://fs2source.warpcore.org/temp/scripting.html) to play with. :)
Adding a hook is very easy. Here are some examples:
$Splash: [
--Display the SCP logo on the splash screen (You'll need the mediaVPs for
this)
gr.drawImage(0, 0, "2_PreLoadLogo")
]
$HUD: [
--Display a rather lackluster escort list
if mn.getNumEscortShips() > 0 then
gr.drawText(100, 0, "==ESCORT==")
end
for count=0,mn.getNumEscortShips()-1 do
ship = mn.getEscortShip(count)
gr.drawText(100, (count+1)*10, ship:getName())
gr.drawText(250, (count+1)*10, ship:getHitpointsLeft()/ship:getHitpoints())
end
]
$Global: [
--Tells you which mouse buttons are down
if ms.isButtonDown("Left") then
gr.drawText(10, 10, "Left down!!")
ms.setMouseHidden(true)
end
if ms.isButtonDown("Middle") then
gr.drawText(10, 20, "Middle down!!")
ms.setCursorImage("attacker")
end
if ms.isButtonDown("Right") then
gr.drawText(10, 30, "Right down!!")
ms.setMouseHidden(false)
end
]
-
Holy ****, thanks!! :lol:
This is going to take me a few days to digest ... ! :nod:
Thanks again ! I'll have another DCQ soon. :)
Mass
-
Was including a scripting language something that implied pain on your part? I've seen threads where you've noted a real problem with it (something about Python being imprecise and poo?) (this is getting offtopic...)
I wasn't really against it unless it was reasonably possible to have the current SEXP system do the job. Doesn't look like that would happen anytime soon though. Python is far too overkill for this and would be too much of a resource hog. Lua on the otherhand is much slimmer and considerably less resource intensive than python is. Plus Lua can be easily linked directly into the game binary so there is no issue with the platform and version issues that could arise from using Python. Python is great, but not for this. :)
Of course having Lua in there is pointless if no one uses it. But hopefully that will change soon enough.