Author Topic: Beginning SCP coding  (Read 3000 times)

0 Members and 1 Guest are viewing this topic.

Beginning SCP coding
Hullo! Longtime Freespace SCP fan here. I'm developing an interest in programming and have begun learning C++. I'm under the impression that FSO uses Lua but my understanding is that C++ is similar? Anyway, I'm just wondering if anyone could throw me a tip on how I could get to a point where I can eventually work on the source code myself? How did you guys learn to do what you do??

 

Offline Iss Mneur

  • 210
  • TODO:
Hullo! Longtime Freespace SCP fan here.
Good.  Good. That is the only type of coder we accept. :D  A little bit of crazy may also be needed.

I'm developing an interest in programming and have begun learning C++. I'm under the impression that FSO uses Lua but my understanding is that C++ is similar?
FreeSpace 2 Open is written in C with classes.  There are parts that are actually C++ but that is mostly new code only, and is the direction that we (seemingly) are going.

The Lua language is similar to C++ in respect to syntax and form, but its use in FSO is much different.  The C/C++ is the core part of the engine, which calls out to Lua code snippets to implement the behaviour. For more one what Lua scripting is able to do, see the output of -output_scripting.  For some of the things that have been implemented using Lua take a look at some of the stuff that Nuke or Wanderer have posted.

Anyway, I'm just wondering if anyone could throw me a tip on how I could get to a point where I can eventually work on the source code myself?
See the sticky at the top of this forum for information on Subversion (the software that we store our code in) and how to get a copy of the code.  Keep in mind that the FS2Open source code is generally a good example of how not to program but nevertheless it is a working (and old) code base that belongs to former commercial game engine (which are notorious for their bad code). Also see my response to the next question.

How did you guys learn to do what you do??
I learned to program C/C++ in College, but that is entirely different than what you see in the actual engine source code.  To get to the point of having patches in the engine, I started going though Mantis (a bug tracker) and found a bug that looked like it could be interesting and tried implement a fix for the problem.  Some I couldn't figure out, some that I couldn't be bothered to figure out, and yet others that I have had committed to the repository.

If you have any questions for the SCP you can either post them in this forum (or thread if you want to keep them consolidated) or you could visit us on the SCP IRC channel #SCP on irc.epser.net.
"I love deadlines. I like the whooshing sound they make as they fly by." -Douglas Adams
wxLauncher 0.9.4 public beta (now with no config file editing for FRED) | wxLauncher 2.0 Request for Comments

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
I learned how to code in Java and then read a "Teach yourself C++ in 24 hours" book to learn enough of the differences that I could make a start working for the SCP.

I started by working with the SEXP code since I found it one of the easiest parts of the code to grasp due to my familiarity with FREDding. If you already have skills with a certain part of the engine you might find it similarly easy to start there.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Nuke

  • Ka-Boom!
  • 212
  • Mutants Worship Me
i learned lua specifically for freespace open. i had done some c/++, and vb before in high school (mostly just having us write 2 page programs), but i decided that i was better off with graphics and set off to make nukemod. of course when lua was thrown into the engine i just had to learn it (i had used quake c some time ago and was impressed with its modding capabilities it added to quake, and something similar for freespace would have been awesome) and have since become quite proficient. i have done a few things with the freespace source, mostly just adding functionality to the game-scripting interface. ive also started a few other projects in c++, like my own game engine, and a few command line programs to talk to microcontrollers over a com port (i do projects with my arduino as well). havent written much code lately since i re-discovered an intrest in electronics. most everything ive learned has been through online tutorials and reference material, and of course by reading source code.
« Last Edit: August 24, 2010, 03:46:50 am by Nuke »
I can no longer sit back and allow communist infiltration, communist indoctrination, communist subversion, and the international communist conspiracy to sap and impurify all of our precious bodily fluids.

Nuke's Scripting SVN

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
I barely write code.  When I have added a feature, I usually have to find code that looks like it does what I want and copy/modify it to suit my needs.  So yeah, it may be a little dangerous but that's why I make sure a few other eyes check it out.  I'm more in the release department, and all that was involved there was getting a compiling environment set up, and figuring out the various build systems across all the platforms.  Many times, you wouldn't need to know a lot about the FSO source, but it does help to have some sort of programming background, or at least a programmer's mindset.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 
Re: Beginning SCP coding
I know this is an old thread, but thanks for all of the info on the FreeSpace source code, and language application. I learned Java in college, but have really developed an interest in some of the newer languages like Ruby. After realizing the FSO code was similar, but distinctly different from C/C++, I found a reference to Lua. Me being the language nerd I am, I got super excited to see this being used more and more in FSO coding. This really helps me understand though where and how each language is used. Thanks!

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: Beginning SCP coding
I know this is an old thread, but thanks for all of the info on the FreeSpace source code, and language application. I learned Java in college, but have really developed an interest in some of the newer languages like Ruby. After realizing the FSO code was similar, but distinctly different from C/C++, I found a reference to Lua. Me being the language nerd I am, I got super excited to see this being used more and more in FSO coding. This really helps me understand though where and how each language is used. Thanks!

Glad to hear it!  If you haven't seen it already, be sure to check out the Scripting Workshop.  FSO's support for Lua has come a long way since this thread was started.

 
I know this is an old thread, but thanks for all of the info on the FreeSpace source code, and language application. I learned Java in college, but have really developed an interest in some of the newer languages like Ruby. After realizing the FSO code was similar, but distinctly different from C/C++, I found a reference to Lua. Me being the language nerd I am, I got super excited to see this being used more and more in FSO coding. This really helps me understand though where and how each language is used. Thanks!

Glad to hear it!  If you haven't seen it already, be sure to check out the Scripting Workshop.  FSO's support for Lua has come a long way since this thread was started.

Thanks! I will definitely check this out!