Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Black Wolf on January 14, 2003, 01:04:39 pm

Title: Too...Many...ships...!
Post by: Black Wolf on January 14, 2003, 01:04:39 pm
Is it true that despite repeated attempts, it's still impossible to stably put more than 130 ships in the ships.tbl? And if so, is this looking at being fixed soon? We desperately need a bigger ships.tbl for TI.
Title: Too...Many...ships...!
Post by: Inquisitor on January 14, 2003, 02:04:06 pm
It breaks multi.

We can build a special EXE for you, but no multi, and I don;t want to get in the habit of building special exe's.

I could probably do it once, and have a SP only version.
Title: Too...Many...ships...!
Post by: SKYNET-011 on January 14, 2003, 03:17:18 pm
Quote
Originally posted by Inquisitor
I could probably do it once, and have a SP only version.


Can I have a copy if you do it?
Title: Too...Many...ships...!
Post by: LtNarol on January 14, 2003, 05:05:31 pm
How exactly does it break multi?
Title: Too...Many...ships...!
Post by: DTP on January 14, 2003, 07:27:02 pm
Quote
Originally posted by LtNarol
How exactly does it break multi?


Chrashes Clients on join Server since MAX_PACKETS is reached, its because the stats transmitted on the net is transmitted in one single pack, and it can max have 512 bytes in it.

a machine byte can, max hold the value of 255, so it must use a second byte to generate a number larger than 255

syntax is value =(byte2*256+byte1)

Since the stats function runs trough all availeble ships, that means you must reserve at least 2 bytes for each ship.

We had it set to 200, since i tested this as a safe value for the server, but then lacking LAN, i could´nt test what would happen to clients. and i recieved no error reports in my own builds, the infamous DTP versions :).

but when i put this to FS2_open, these error reports started to appear.

anyway, you still got 130 ships, anything beyond that is information overload IMHO. if you run out of ships, try to remove the ones not needed.

IF you still need more ships because you are working on several MODS, I encourage you to use the -mod flag.

If you are doing a TC MOD, you can even copy fred2_open into the mod directory, so that also only loads the MOD´s tbl.

command line handling for fred2_open, will come, but right now im working on my TBL SHIP/WEAPON file checker since many error reports are caused by bad tbl files. This also gives me chance to learn quite a lot of handleling Files, strings, chars in a very dynamic way. not to mention Memory allocation NEW and DELETE, etc. etc.
Title: Too...Many...ships...!
Post by: Black Wolf on January 14, 2003, 09:18:26 pm
Irritatigly enough, we almost definitely will need more than 130 ships :(. We've gone in the deep end - the pirates in the first act will need all the old Terran ships, plus we have a new species planned for later on that will require at least a dozen or more new ships (probablymore), and seeing as how it's eleven years later, there would logically be new GTVA ships as well (in fact, there already are.) And on top of all that, we set one of our initial aims as being 'to fill in the gaps unjustly left by V in the civilian population' - there are yachts, and civy transports, and light freighters, and all manner of civillian traffic - in short, we cant avoid > 130 ships :(
Title: Too...Many...ships...!
Post by: Goober5000 on January 14, 2003, 09:29:32 pm
How easy would it be to fix it so multiplayer can do > 130 ships?
Title: Too...Many...ships...!
Post by: Anaz on January 14, 2003, 09:41:36 pm
seems like you would have to split it up into 2 packets to me...which of course would be twice the transfer time...
Title: Too...Many...ships...!
Post by: LAW ENFORCER on January 14, 2003, 10:03:52 pm
how would that affect it? much?

this kinda important cos my TC is gonna be like Black Wolf's post but I will have at least 6 diffrent forces (inc pirates, police, civ, company - many of which have multipul ships classes in each class category (and my class category, destroyer etc, stands at about 30)
Title: Too...Many...ships...!
Post by: Bobboau on January 14, 2003, 10:21:50 pm
well the question is will anyone notice if multiplayer is gone,
how many people are playing FSO online ?

breaking multi-player should be (IMHO) a nonissue untill we have our own PXO set up,
wich I would have hoped that we would have done by now but...
Title: Too...Many...ships...!
Post by: LtNarol on January 14, 2003, 10:36:16 pm
Couldn't a third byte be used?

The 130 ships is a real barricade since the 158th mod covers some 9 decades, and 130 is frightenly close to the number of mod ships booked for post-Capella alone, no including the EBG Corps fleet, civilian vehicles/vessels, and FS2 era Sol ships.  The numbers add up rather quickly :shaking:
Title: Too...Many...ships...!
Post by: LAW ENFORCER on January 14, 2003, 11:06:25 pm
Quote
Originally posted by LtNarol
Couldn't a third byte be used?




:lol: your right!
Title: Too...Many...ships...!
Post by: Whitelight on January 14, 2003, 11:31:57 pm
I agree with Inquisitor, 2 builds would be all that is needed...:yes:

(Edit) One for multi
One for max ships, say 200, not sure if it can be stable at set amount....

Multi would also benifit people with slower machines even if they don`t play multi ...:)
Title: Too...Many...ships...!
Post by: daveb on January 15, 2003, 12:09:07 am
Quote
Originally posted by DTP
Chrashes Clients on join Server since MAX_PACKETS is reached, its because the stats transmitted on the net is transmitted in one single pack, and it can max have 512 bytes in it.


Y'know, there's no reason you can't fix this if you're feeling like testing the waters of multiplayer programming.

We're talking about the PLAYER_STATS packet right? The "real" reason multiplayer gets broken was because of PXO code - which made some assumptions about what data was coming in/going out. But since PXO isn't really part of the equation here, fixing this really isn't a big deal.

What I'd do is :

Change the PLAYER_STATS packet so that it gets sent multiple times. It would send the normal fixed-length data that's in there now (score, assists, what have you). Don't send ship stats right away. After you've sent the data, send multiple -more- PLAYER_STATS packets, packing in say, 64 ship types each. Each packet would contain a list of pairs of ship info indices and counts. So, you'd have a packet that looked like

int num_ships_in_packet
short ship_type
int num_kills
....

Just keep sending these packets until you've sent info for all ship types.

This works because of a couple of the properties of the low-level network layer. FS2 has 2 main types of packets. "unreliable" packets which are not guaranteed delivery and which can arrive in a different order than they are sent. And "reliable" packets which are guaranteed to arrive, and will guarantee to arrive in the order they are sent. The psnet layer takes care of managing this (for those interested, psnet2.cpp contains some of the truly arcane and dark secrets of game programming that you're not likely to find too many other places. Its a treasure trove of black magic. psnet_rel_work() is a true masterpiece of nutty code.)

. In general, you only want to use reliable packets for absolutely critical info that can't be missed. There's a lot of overhead with reliable packets because the code has to deal with dropped packets and the like. -But- in this case, you're only talking about sending maybe 1 or 2 additional packets (or even in an extreme case with hundreds of ship types, 5-10 packets). The code won't even blink.

You'd also have to bump up the server version - which would essentially get rid of backwards compatibility with FS2. But from then on, it wouldn't matter what MAX_SHIP_TYPES was.

A strong word of caution : there are probably several dozen other places in the network code that assume MAX_SHIP_TYPES will fit in a single unsigned byte (0-255). If you bump MAX_SHIP_TYPES to something greater than that, you'd have to hunt through every single packet type and make sure to send them as unsigned shorts (giving you up to 65535 ship types) or even an int. This is an inherently tricky thing to get right. Debugging multiplayer code is the biggest possible ***** you can imagine. The FS2 multiplayer code is a particularly big and complicated piece of multiplayer code. Far nastier than Summoner or RF's.

Still, if you're feeling bold and adventurous, this is a fine project.
Title: Too...Many...ships...!
Post by: Nico on January 15, 2003, 02:32:51 am
:nervous:
"sees big glowing hammer"
Well, I guess God has spoken.
Thou Shall Follow His Words To the Letter!
( fix the multi and bring us more ships - that way I can keep old ships in new chapters :p )
Title: Too...Many...ships...!
Post by: DTP on January 15, 2003, 07:28:13 pm
thx for the reply dave;

huh, not sure i have "Time" to do more than 255 ships. but i think 200-255 ships will suit most modders just fine, since we never announced anything bigger than 200.

basicly what you wrote is what i assumed, but given reasent "RL" events i did 'nt have the time to confirm it.

Now i will look at the netcode again regarding send packets, but to tell the truth, i was scared of beginning to mess with it, in case i triggerd some other segfaults, this Code base is "Huge", but very well commented.

Think i might be able to commit it, next weekend, if i dont run into something unexpected.
Title: Too...Many...ships...!
Post by: Whitelight on January 15, 2003, 09:58:48 pm
I stand corrected... Just when you least expect it,  daveb saves the day:D
Title: Too...Many...ships...!
Post by: LtNarol on January 15, 2003, 10:18:55 pm
Anything above 200 should be enough for most anything, the 158th I know is looking at potentially 200 (including FS1 and FS2 canon ships) but realistically 160-180.
Title: Too...Many...ships...!
Post by: Black Wolf on January 15, 2003, 11:38:00 pm
If anybody thinks they'll ever have use for more than 200 ships they're deluding themselves. :rolleyes:

200-255 will be perfect :)
Title: Too...Many...ships...!
Post by: Nico on January 16, 2003, 02:31:10 am
Quote
Originally posted by LtNarol
Anything above 200 should be enough for most anything, the 158th I know is looking at potentially 200 (including FS1 and FS2 canon ships) but realistically 160-180.


"cough"Woomeister could use easily 255 ships if tbl space allowed him to"cough" :D
Title: Too...Many...ships...!
Post by: LAW ENFORCER on January 16, 2003, 07:29:51 pm
I could easily use 500 ship entries! Ok mebey not but well over 120ish per force (I have old tech, now and 'advanced' to think about!) (and I have a minamum of 6 forces)
Title: Too...Many...ships...!
Post by: SKYNET-011 on January 18, 2003, 07:38:07 pm
Yeah. Definitley over 120-130.
Title: Too...Many...ships...!
Post by: Inquisitor on January 19, 2003, 12:01:56 am
What daveb said :)

Someone wants to take a look at it, and doesn;t already have access, holler.