Author Topic: Starting off Coding FS2...  (Read 3047 times)

0 Members and 1 Guest are viewing this topic.

Offline Polpolion

  • The sizzle, it thinks!
  • 211
Starting off Coding FS2...
...and I need some help (big suprise).

I've gotten a bit tired of not doing anything during programing class. None of the assignments have ever taken me more than about 15 minutes to do, and I get new assignments at most once a week, so I've decided that I'd actually do something useful on my own. I've taken a semester of true BASIC (not actual programming), a semester of c/c++ (oh wow, I know the syntax and understand the extreme basics of the language), and I'm currently taking a year-long AP Java course (I've taught myself more Java in about a half a day back in august than what's been taught in the class so far).

I don't need help learning more of the language itself, I'll be taking care of that myself if I have any issues (after all, I'll have an hour a day where I wouldn't be able to do anything else other than randomly browsing the intraweb). What I would like help with in general, is actually learning my way around the FSO code. Is there any good way to become fluent in the way everything works? Is there any types of things I could try and code that would help me better learn how the game functions? My overall goal is to eventually be able to actually help code for the SCP, but that's not possible yet.

I downloaded the code itself for 3.6.9 a while ago, and that's just what I'll be using until I know that I could do more than just tinker and fool around.

Also, I need a real IDE. For some reason, I don't think Dev-C++ will quite cut it, and last time I checked, I couldn't access the ones in the stickied threads. Any suggestions?

And once I figure that out, what I think that I'll be doing first is trying to add in an optional effect for beam weapons to have exponential damage. Depending on how long the beam is held on its target, the amount of damage the beam does would keep increasing.

So where exactly is the weapons.tbl parased in the code, and where is the damage calculations done? At first I assumed in the weapons and math sub folders respectivly, but I still can't quite find anything.

 :)

I really appreciate any help.

 

Offline Flipside

  • əp!sd!l£
  • 212
Re: Starting off Coding FS2...
I have the same problem with languages, they seem to want me to do everything in Java which is annoying as hell.

I agree with them that once you know one language, it's possible to learn them all, but possible doesn't get the job done.

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Starting off Coding FS2...
If you are using windozer then you can probably get the MS Visual Studio Express Edition.

http://www.hard-light.net/forums/index.php/topic,52845.0.html
http://www.microsoft.com/express/download/

As for table parsing (where the functions are located)... see for example this.. the box on the right side of the screen..
http://www.hard-light.net/wiki/index.php/Tables

Damage calculations... well... shiphit.cpp would probably be the best bet to find them. However - for example - if you search for the references in to code to for example weapon_info struct's damage variable you can see where it is used.

« Last Edit: October 15, 2008, 01:16:50 pm by Wanderer »
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: Starting off Coding FS2...
You should check to see if you have access to the MSDN Academic Alliance program through your school as well, they may be able to get you a legit copy of VS2008 Pro for cheap, or free.  I would suggest getting the up to date code base and tinkering with that, just doing an SVN checkout isn't going to affect anything and you'll have up to date project files and bugfixes to boot.  You can easily use TortoiseSVN to get the SCP code.  Then it's just a matter of rightclick->update to get the latest code.

Code::Blocks might be another IDE to look at eventually but we don't currently have a project file specifically for it.

I think VSExpress comes with the debugger.  If so you can compile your own builds, and analyze any crashes that happen in realtime.  I've figured more stuff out looking at what's led up to a crash than I have most any other way.  It's still a bit daunting to me though.
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

 

Offline Polpolion

  • The sizzle, it thinks!
  • 211
Re: Starting off Coding FS2...
Well, I've gotten MSVC++ 2008 up and running with 3.6.9 right now. I've been looking through the code for this and it looks like what I'll have to do is add in an optional table entry for damage exponent, a weapons_info value for it, and factor it into the damage attenuation (Somehow). Hopefully I won't run into too many complications...
« Last Edit: October 18, 2008, 09:45:44 pm by thesizzler »

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Polpolion

  • The sizzle, it thinks!
  • 211
Re: Starting off Coding FS2...
Well, I'm doing this more to try and learn my way around the code, not purely just to have it done. On top of that, I don't quite think it's what I had in mind.

And it seems like theres a million billion different kind of weapon info structs scattered throughout the code. Really confusing.

 

Offline Polpolion

  • The sizzle, it thinks!
  • 211
Re: Starting off Coding FS2...
I'm almost done. All I need to do is figure out where you plug in data into the beam struct. Anyone know where?

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Starting off Coding FS2...
Well.. there is actually just one single weapon info structure that is just referenced all throughout the code... As for where is data is plugged to beam struct... You could try first finding the said struct (or actually the variable within the struct you want to fill) then right-clicking it and selecting 'Find All References' (using MSVC++ 2008).
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Polpolion

  • The sizzle, it thinks!
  • 211
Re: Starting off Coding FS2...
Okay, I think I've got it done. Now how to I go about compiling this, or even just having it check for errors?

 

Offline Wanderer

  • Wiki Warrior
  • 211
  • Mostly harmless
Re: Starting off Coding FS2...
First select the solution configuration (probably debug for starters). Then go to menu item 'Build' and select 'Build Solution'.
Do not meddle in the affairs of coders for they are soggy and hard to light

 

Offline Polpolion

  • The sizzle, it thinks!
  • 211
Re: Starting off Coding FS2...
What does Assert(); do?

 

Offline phreak

  • Gun Phreak
  • 211
  • -1
Re: Starting off Coding FS2...
I'll test the indicated expression and cause an assertion failure if the expression evaluates to 'false'.  They are only triggered in debug builds.
Offically approved by Ebola Virus Man :wtf:
phreakscp - gtalk
phreak317#7583 - discord

 

Offline Jeff Vader

  • The Back of the Hero!
  • 212
  • Bwahaha
Re: Starting off Coding FS2...
I'll test the indicated expression and cause an assertion failure if the expression evaluates to 'false'.
:lol: Sounds funny when it's missing a "t".

Sorry. I'll be quiet now.
23:40 < achillion > EveningTea: ass
23:40 < achillion > wait no
23:40 < achillion > evilbagel: ass
23:40 < EveningTea > ?
23:40 < achillion > 2-letter tab complete failure

14:08 < achillion > there's too much talk of butts and dongs in here
14:08 < achillion > the level of discourse has really plummeted
14:08 < achillion > Let's talk about politics instead
14:08 <@The_E > butts and dongs are part of #hard-light's brand now
14:08 <@The_E > well
14:08 <@The_E > EvilBagel's brand, at least

01:06 < T-Rog > welp
01:07 < T-Rog > I've got to take some very strong antibiotics
01:07 < achillion > penis infection?
01:08 < T-Rog > Chlamydia
01:08 < achillion > O.o
01:09 < achillion > well
01:09 < achillion > I guess that happens
01:09 < T-Rog > at least it's curable
01:09 < achillion > yeah
01:10 < T-Rog > I take it you weren't actually expecting it to be a penis infection
01:10 < achillion > I was not

14:04 < achillion > Sometimes the way to simplify is to just have a habit and not think about it too much
14:05 < achillion > until stuff explodes
14:05 < achillion > then you start thinking about it

22:16 < T-Rog > I don't know how my gf would feel about Jewish conspiracy porn

15:41 <-INFO > EveningTea [[email protected]] has joined #hard-light
15:47 < EvilBagel> butt
15:51 < Achillion> yes
15:53 <-INFO > EveningTea [[email protected]] has quit [Quit: http://www.mibbit.com ajax IRC Client]

18:53 < Achillion> Dicks are fun

21:41 < MatthTheGeek> you can't spell assassin without two asses

20:05 < sigtau> i'm mining titcoins from now on

00:31 < oldlaptop> Drunken antisocial educated freezing hicks with good Internet == Finland stereotype

11:46 <-INFO > Kobrar [[email protected]] has joined #hard-light
11:50 < achtung> Surely you've heard of DVDA
11:50 < achtung> Double Vaginal Double ANal
11:51 < Kobrar> ...
11:51 <-INFO > Kobrar [[email protected]] has left #hard-light []

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Starting off Coding FS2...
What does Assert(); do?

Basically it's a method of catching coding errors. If I'm writing a new function which uses a variable called x and I'm sure that x is never going to be zero (and it would screw things up if x was 0) I'll Assert (x != 0). Now if the debug build is running and x is zero at that point in the code then the debug build will basically go "Aha! You were wrong! x can be zero!"

This gives the coder the chance to fix their mistake. Int3() works in a similar way. Except Int3() is placed in a part of the code that should never be reached while Assert is a statement that should never be true.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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