Author Topic: Making a Table from Scratch  (Read 2599 times)

0 Members and 1 Guest are viewing this topic.

Offline Sanocon

  • 24
    • Steam
Making a Table from Scratch
So I'm making my first mod which means I'm going to make my first table. However i want to make it from a bare txt file. so I need to know this:

what is the bare minimum for the ship and weapon table? And I mean just the essentials so that FSO can read it without crashing, put it in the schematics window and make it a playable ship/usable weapon.

 

Offline Droid803

  • Trusted poster of legit stuff
  • 213
  • /人 ◕ ‿‿ ◕ 人\ Do you want to be a Magical Girl?
    • Skype
    • Steam
Re: Making a Table from Scratch
When people say make from scratch they usually mean copying entries of similar ships/weapons and changing all the values as necessary.
That way you don't have to worry about the minimum requirements, and if it crashes you know it means you broke something and aren't just missing a required field.
(´・ω・`)
=============================================================

 

Offline Sanocon

  • 24
    • Steam
Re: Making a Table from Scratch
When people say make from scratch they usually mean copying entries of similar ships/weapons and changing all the values as necessary.
That way you don't have to worry about the minimum requirements, and if it crashes you know it means you broke something and aren't just missing a required field.

Yea I forgot to elaborate. While safe, It's not very effective the copy/paste method development wise. Crashing and bugs is a risk I'm willing to take since i had to deal with it a lot while learning c++.

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Making a Table from Scratch
Documentation on what you must provide and what's optional is something that's pretty lacking at least in ships/weapons tables, in my experience. So, yeah, the bare minimum is something you'd pretty much have to deduce by reading the table parsing code... which is, luckily, pretty simple to do.

Just open up for example ship.cpp or weapons.cpp, search for the table entry you're interested in and see whether the line says optional_string or required_string.

Having done that myself right now, it seems that both ships and weapons tables pretty much have no required entries, besides the ship/weapon class name? That's... interesting. I was very much under the impression that a lot of the tabling was mandatory and that there was relatively few sensible defaults when it came to entries which date back to retail. I don't know whether a barebones entry would actually work or not, though, or just result in tons of errors when a ship/weapon of that type gets created.

 

Offline Sanocon

  • 24
    • Steam
Re: Making a Table from Scratch
it seems that both ships and weapons tables pretty much have no required entries, besides the ship/weapon class name? That's... interesting.

huh. somehow that made that made reading the ship table part of the wiki 500% less intimidating. because most stock ships in the original games had like 60% of the listed items excluding flags, I guess they programmed it so the game doesn't crash if almost nothing is there, but the requiring of a class name does make sense (It's got to go into RAM somewhere.) while this does help, I may still ask questions on what a certain parts. Like these ones:

#1. What is an engine wash?
#2. When was landing added to the game and how does it work?
#3. I need to know how each of the ship type A.I. works, I cant seem to find anything related to it in the wiki.
#4. On some of the lines there is XSTR("", -1) what is that supposed to do?

That's all my questions so far.

 

Offline Nyctaeus

  • The Slavic Engineer
  • 212
  • My "FS Ships" folder is 582gb.
    • Minecraft
    • Exile
Re: Making a Table from Scratch
1. It defines power of the engine. It's usually placed below $engine entry. The bigger number is here, the bigger turbulences ir causes on a player fighter, when You fly into engine thrust.
2. Check Diaspora.
3. Check standard ships.tbl.
4. In case of only fighters, bombers and some weapons, text displayed in Weapon and Ship Selection is keept here. In case of every ship, Tech Room description belong here.
« Last Edit: September 28, 2014, 07:05:15 am by Betrayal »
Exile | Shadow Genesis | Inferno | Series Resurrecta  | DA Profile | P3D Profile

Proud owner of NyctiShipyards. Remember - Nyx will fix it!

All of my assets including models, textures, skyboxes, effects may be used under standard CC BY-NC 4.0 license.

 

Offline zookeeper

  • *knock knock* Who's there? Poe. Poe who?
  • 210
Re: Making a Table from Scratch
#4. On some of the lines there is XSTR("", -1) what is that supposed to do?
Those are the way to define translatable strings. The number is the corresponding string number in strings.tbl.

I don't know if you have to use them anywhere or if they're a purely optional construct.

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Making a Table from Scratch
I don't know if you have to use them anywhere or if they're a purely optional construct.
They are optional; if you look at lcl_ext_localize_sub() (both the char* and SCP_string versions) in /localization/localize.cpp, if a string doesn't start with "XSTR", it sets the output to match the input and sets the localization ID to -2 (if the id pointer is non-NULL, anyway), so it's even possible for the calling code to know whether or not XSTR translation was done (well, sort of; it also gets set to -1 if "XSTR" is present but it can't parse it right).
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline chief1983

  • Still lacks a custom title
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: Making a Table from Scratch
I don't think anyone mentioned it, but please use a debug build when editing tables.  They are set to throw a lot of helpful warnings for those making edits to mod contents that may not present themselves as problems immediately in game otherwise.  And don't just go by the popup warnings, keep an eye on the fs2_open.log file in the data folder as well.  Depending on what you're editing there may be even more verbose levels of debugging you can enable, via debug_filter.cfg.
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 Sanocon

  • 24
    • Steam
Re: Making a Table from Scratch
This is starting to feel like this game is really easy to mod. My ship is almost done (minus cockpit and decals) and making the table will be minimal to no hassle. I am so happy I got this game and joined the community fanbase.

 

Offline AdmiralRalwood

  • 211
  • The Cthulhu programmer himself!
    • Skype
    • Steam
    • Twitter
Re: Making a Table from Scratch
This is starting to feel like this game is really easy to mod.
Well, some things are certainly easier than others...
Ph'nglui mglw'nafh Codethulhu GitHub wgah'nagl fhtagn.

schrödinbug (noun) - a bug that manifests itself in running software after a programmer notices that the code should never have worked in the first place.

When you gaze long into BMPMAN, BMPMAN also gazes into you.

"I am one of the best FREDders on Earth" -General Battuta

<Aesaar> literary criticism is vladimir putin

<MageKing17> "There's probably a reason the code is the way it is" is a very dangerous line of thought. :P
<MageKing17> Because the "reason" often turns out to be "nobody noticed it was wrong".
(the very next day)
<MageKing17> this ****ing code did it to me again
<MageKing17> "That doesn't really make sense to me, but I'll assume it was being done for a reason."
<MageKing17> **** ME
<MageKing17> THE REASON IS PEOPLE ARE STUPID
<MageKing17> ESPECIALLY ME

<MageKing17> God damn, I do not understand how this is breaking.
<MageKing17> Everything points to "this should work fine", and yet it's clearly not working.
<MjnMixael> 2 hours later... "God damn, how did this ever work at all?!"
(...)
<MageKing17> so
<MageKing17> more than two hours
<MageKing17> but once again we have reached the inevitable conclusion
<MageKing17> How did this code ever work in the first place!?

<@The_E> Welcome to OpenGL, where standards compliance is optional, and error reporting inconsistent

<MageKing17> It was all working perfectly until I actually tried it on an actual mission.

<IronWorks> I am useful for FSO stuff again. This is a red-letter day!
* z64555 erases "Thursday" and rewrites it in red ink

<MageKing17> TIL the entire homing code is held up by shoestrings and duct tape, basically.

 

Offline Sanocon

  • 24
    • Steam
Re: Making a Table from Scratch
This is starting to feel like this game is really easy to mod.
Well, some things are certainly easier than others...

While that is true. Just to make a new game with new ships from nothing is more easy than most games that have modding capabilities.

Also I think I need to rephrase question #3, my mind was way off when I wrote it. :nono:
What is the defining characteristics of each ship class? (Example: Fighters are main attackers, bombers carry heavy missles that are only for them, support helps refil ammo, ect.) As much as I love space combat stuff. I can't classify advanced ships that well.

 

Offline headdie

  • i don't use punctuation lol
  • 212
  • Lawful Neutral with a Chaotic outook
    • Minecraft
    • Skype
    • Twitter
    • Headdie on Deviant Art
Re: Making a Table from Scratch
For the AI definitions in the flag section

Fighter: / Bomber:
 - uses fixed primary and secondary bank firing points for weapons
 - iirc Ignores waypoints on triggers relating to hostile distance* and upon being fired upon
 - uses afterburners
 - has full player orders availability
 - Defaults to fighter briefing icon
 - Bomber flag is targetable with the B key by default

Cruiser: / Corvette: / Capital: / Supercap: / Transport: / Freighter: / Gas Miner:
 - Uses turreted weapons
 - Will stick to waypoints religiously
 - Does not use afterburners
 - Limited Player orders
 - Defaults briefing icon as appropriate

Support:
 - Repair ship
 - Limited Player orders
 - Uses Support Icon
 - Only one ordered to the field at a time, though I believe others can be placed into the mission space

Cargo: / Sentry Gun: / Installation: / Drydock: / Knossos:
 - No orders
 - Cannot move by itself
 - Sets Briefing Icon

AWACS:
 - Uses turreted weapons
 - Will stick to waypoints religiously
 - Does not use afterburners
 - Limited Player orders
 - Defaults briefing icon as appropriate
 - Works with AWACS related sexp (though that could be a subsystem flag, i cant remember)

* I dont know the parameters for this

all ship classes use the head on attack approach when using the chase AI order so anything not optimised should use the broadside AI flag or use waypoints and allow the weapons to auto fire and/or use weapons fire sexps

These behaviors along with many other aspects of how ships operate can be set in the objecttypes.tbl table and the AI / AI_Profiles tables.

As for battlefield roles, ultimately it depends on what you balance them to do.  The cruiser is a good example of this, in FS1 it was a general purpose attack ship that was pathetic at everything, unless it was a Lilith which was tabled as an absolute beast.  In FS2 they are more defined as anti fighter screening ships and generally dont do too bad at this (The Lilith is still a beast to capships though)

Generally though (FS terms, in RW the warship definitions are nothing like)

Fighters: tackle fighter sized objects and larger ships into the Cruiser threat range.
Bombers: Specialist fighters which generally forgo fighter combat capabilities for the ability to bring down anything... with enough rearms.
Sentry Gun: Protecting stationary points, just goes pew pew pew mostly
Transport: for moving people and occasionally cargo
Freighter: for moving cargo and occasionally people
Cargo: What it says on the tin really
AWACS: Target practice, occasionally helps with nebula detection range
Support: fixing subsystems and rearming, using FSO can fix hull
Cruiser: Jack of all trades, general wisdom has them as anti fighter escorts to convoys
Corvette: Midrange brawler, exists to smash cruisers and give destroyers a bad day
Destroyer: Fighter base ship and normally pinnacle warship**
Super Cap: Big boys, smash everything, use them for spectacle fights and as the "We are all going to die" ship.
Installation: / Drydock: / Knossos: Sit there and look pretty, like with the supercap base missions around it

** unless you are a Hecate or a shivan
Minister of Interstellar Affairs Sol Union - Retired
quote General Battuta - "FRED is canon!"
Contact me at [email protected]
My Release Thread, Old Release Thread, Celestial Objects Thread, My rubbish attempts at art

 

Offline z64555

  • 210
  • Self-proclaimed controls expert
    • Minecraft
    • Steam
Re: Making a Table from Scratch
Just a note in case anyone missed it,

The table defines on the wiki are approximately in the same order as what's in the .tbl's and .tbm's. So, follow the relative order of the entries on the wiki first, and if it spits out errors ask a coder or a tabler about it. If they're nice they'll update the wiki, too. :P
Secure the Source, Contain the Code, Protect the Project
chief1983

------------
funtapaz: Hunchon University biologists prove mankind is evolving to new, higher form of life, known as Homopithecus Juche.
z64555: s/J/Do
BotenAlfred: <funtapaz> Hunchon University biologists prove mankind is evolving to new, higher form of life, known as Homopithecus Douche.

  

Offline Sanocon

  • 24
    • Steam
Re: Making a Table from Scratch
I remember listening to a tutorial on that. Also the definitions of the ship types was really helpful.