Page 1 of 1

Networkable Optimizations

Posted: 2015-02-17 09:19
by Arab
*Update*

Special Thanks to the PR Team, Battlefield 2 SP Forum & the BF2Editor Forum community for their knowledge

Not too long ago I've been testing out which dummy networkables can be disabled. I made an editable list for anyone to test the tweaks to type in if it works or not.

To help out, test by modifying the files on the spreadsheet that need feedback and launch the mod as a Dedicated Server and test what's on the spreadsheet. (Edit your maplist in the Settings folder) to test it out. The server is private as modifying the files won't let you play online.
Here it is: https://docs.google.com/spreadsheets/d/ ... sp=sharing


Note: It's not a silver bullet to all crashes for vehicles with non-related problems but it will help immensely with the server so it can properly prioritize things. It will increase the chance of a server not crashing immensely, and I'm guessing hit detection will be fixed/less common and CTD's will be much much less or even removed on most vehicles.

This may be Anecdotal Evidence unless proven, but when I run the Dedicated Server on local and run any map, the 'O:' number in the Dedicated Server tool is low when I used the Networkable Tweak compared to how high it got when it didn't. 'O' probably means Overgrowths, like trees, grass, foliage.

So what are Statemasks?
They are the basic things added to the vehicles. They are the parts that are in a model's file that must be networked.

Basically they are templates. You want an additional seat? You add that in.

Examples:
  • Sounds. Engine Idle, Rev, Horn
  • Passenger and Vehicle Seats
  • Visual Effects
  • Features, like deploying crates
Ok, but what are Networkables?
Any objects that need to be transmitted to everyone by adding it to the networkable manager of the engine to auto-prioritize based on what it is. Like projectiles have a high priority.

They are Networkable Objects/Abilities in a vehicle that move on it's own, has abilities that affects the object in different states like a Forward Outpost being damaged that the players can rebuild, or that works together with another object as they move through the world. Things like Vehicles, Missiles, Engines, Aileron etc.

It's what needs to be transmitted and prioritized. Player Controlled Objects need them and nearly everything related to gameplay needs it.

Additional Information by [R-DEV]Mats391:
There is also need for network information based on the physics type:
Mesh: Must have it or else it'll crash
RotationalPoint (Wheels): Needs to have it or else it won't update position (does not crash)
Point: Does not need any network information to work

Then there is also things that need it for certain components to work on a dedicated server.
GenericProjectiles need BasicInfo if you want it to be guided. So Seek/Follow component require to have a BasicInfo otherwise the server won't track the projectile and it won't work as intended.

More detailed information can be found on this link at the bottom:
Networkables & Dummy Objects - Battlefield SinglePlayer Forum

The template looks like this:

Code: Select all

[size=150]rem -------------------------------------
ObjectTemplate.addTemplate S_us_trk_support_Ambient
ObjectTemplate.addTemplate S_us_trk_support_AmbientDamaged
ObjectTemplate.addTemplate us_trk_support_Entrypoint_front
ObjectTemplate.setPosition 0/0.25/1.25
ObjectTemplate.addTemplate us_trk_support_EntryPoint_rear
ObjectTemplate.setPosition 0/0.2/-2.75
ObjectTemplate.addTemplate e_amphib_wake
ObjectTemplate.setPosition 0/-0.1/2.8
ObjectTemplate.addTemplate e_amphib_wake
ObjectTemplate.setPosition 0/-0.1/-2.2
ObjectTemplate.setRotation 180/0/0
ObjectTemplate.addTemplate e_amphib_wake_sound
ObjectTemplate.addTemplate e_sinking_vehicle
ObjectTemplate.addTemplate us_trk_support_Codriver
ObjectTemplate.addTemplate us_trk_support_Passanger_RearL1
ObjectTemplate.setPosition -0.6/1.8/0.15
ObjectTemplate.setRotation 87.7/-15.9/0
ObjectTemplate.addTemplate us_trk_support_Passanger_RearR1
ObjectTemplate.setPosition 0.625/1.8/0
ObjectTemplate.setRotation -89.9/-18.5/-1.6
ObjectTemplate.addTemplate us_trk_support_Passanger_RearL2
ObjectTemplate.setPosition -0.59/1.82/-0.85
ObjectTemplate.setRotation 89.2/-14.1/1
ObjectTemplate.addTemplate us_trk_support_Passanger_RearR2
ObjectTemplate.setPosition 0.6/1.8/-2.1
ObjectTemplate.setRotation -100.1/-21.8/0
ObjectTemplate.addTemplate us_trk_support_Passanger_RearL3
ObjectTemplate.setPosition -0.65/1.8/-2.16035
ObjectTemplate.setRotation 134.6/-18.5/0
ObjectTemplate.addTemplate us_trk_support_Passanger_RearR3
ObjectTemplate.setPosition 0.64947/1.8/-2.25702
ObjectTemplate.setRotation -133.7/-13.1/0
ObjectTemplate.addTemplate truck_horn
ObjectTemplate.setPosition 0/1/2
ObjectTemplate.addTemplate us_trk_support_Camera
ObjectTemplate.setPosition -0.45/1.51/1.23
ObjectTemplate.addTemplate truck_dummy_weapon
ObjectTemplate.addTemplate supply_drop_smalltruck
ObjectTemplate.setPosition 0/0.5/-3.8
ObjectTemplate.addTemplate supply_drop_light_truck_us
ObjectTemplate.setPosition 0/0.5/-3.8
ObjectTemplate.addTemplate e_military_truck_open
ObjectTemplate.setPosition -0.782146/1.12534/1.06372
ObjectTemplate.addTemplate e_military_truck_close
ObjectTemplate.setPosition -0.765984/1.1097/1.05884
rem -------------------------------------
[/size]

The main thing are the templates that are underneath.

Here's an example of a BF2Editor error for the us_trk_support:

Code: Select all

[Network] : Object us_trk_support has to many statemasks (16) and will crash the network. Please fix!
0 unique networkableObject:us_trk_support
1 unique networkableObject:us_trk_support_asteeringwheel
2 unique networkableObject:us_trk_support_zMotor
3 unique networkableObject:us_trk_support_whl_BL
4 unique networkableObject:us_trk_support_whl_BLMiddle
5 unique networkableObject:us_trk_support_whl_BR
6 unique networkableObject:us_trk_support_whl_BRMiddle
7 unique networkableObject:us_trk_support_whl_Nav_FL
8 unique networkableObject:us_trk_support_whl_FL
9 unique networkableObject:us_trk_support_whl_FR
10 unique networkableObject:truck_horn
11 unique networkableObject:truck_dummy_weapon
12 unique networkableObject:supply_drop_smalltruck
13 unique networkableObject:supply_small
14 unique networkableObject:supply_drop_light_truck_us
15 unique networkableObject:light_supply_crate_us
How does the templates work?

The way it works is that the ObjectTemplate.addTemplate looks inside all server archives\common folder, grabs the object referenced which takes from the server archives version of the folders where it adds it to the vehicle.

Causes of Too many Statemask Errors
  • Template is over the Max Limit of 12
  • Name Conventions are duplicated in the model heirarchy
  • Problems with the Model Hierarchy (The Networkables that you tell to the system doesn't match up to the models you are referring to)
  • Wrong Template added as a Networkable
  • Missing Networkable
  • Duplicate Templates with extra Networkable
  • Invalid Template Name (?)
Resources:
Error. Help Plz - Battlefield SinglePlayer Forum
Battlefield SinglePlayer Forum > Exporting a Tank for BF2/2142
Battlefield 1942 Mods, Modding Tutorials. Forums and Mod Downloads. ? View topic - Debugging "too many statemasks" error
Hello - Battlefield SinglePlayer Forum
My own small fixes for this mod.... (Superdc)

Solutions for StateMasks & Networkables:

One solution is to merge several templates into one. This part I'm not quite sure if it's as simple as combining all codes into one, or there is a special way of doing so.

We could combine the supply crate and the vehicle repair kit with left click and right click although I'm not sure if it's possible.

-Update: Simply renaming all vehicle files, including the code inside .con and .tweak and the textures can fix the networkables, strangely.

-Remove these things (Backup files always!)

Code: Select all

ObjectTemplate.addTemplate e_amphib_wake
ObjectTemplate.addTemplate e_amphib_wake
ObjectTemplate.addTemplate e_amphib_wake_sound
ObjectTemplate.addTemplate e_sinking_vehicle (Not sure about this one)
I have no clue what they do. They may be used for APC's only, further research needed.
-Only network the wheels on each corner, with springinfo. There's a thread at BF2Editor (Site is dead, but you can search for 'Site:BF2Editor.org' on Google) and at Battlefield 2 SP Forum that had an advise to link the corner wheels with the others, and have them spin at the same time. Battlefield SinglePlayer Forum > Exporting a Tank for BF2/2142
-Steering wheel doesn't have to be added as a networkable. Only effect as far as I know is when the driver turns, it will have a short delay before the other passenger sees it for whoever is turning.
-Merge templates like all

Code: Select all

supply_drop_smalltruck with supply_drop_light_truck_us,
supply_small with light_supply_crate_us
into one or two templates. It will take a lot of time, and this means that all other vehicles that rely on the template must be changed. It's complicated.
-Removing any dummies using this list: https://docs.google.com/spreadsheets/d/ ... sp=sharing

Also, another error that you may get in the Debugger (The outdated debugger based on BF2 1.3)
Error: Networkable already added to network manager, netId=0
Solution: Read Error. Help Plz - Battlefield SinglePlayer Forum

I'm still kind of understanding how this system works. It's really interesting. Will try to update.

Re: Full list of Networkable Problems

Posted: 2015-02-17 11:46
by RarWinZip
As far as I understand you're trying to decrease amount of computed info coming thorugh servers... And I appreciate this.

Re: Full list of Networkable Problems

Posted: 2015-02-17 20:45
by Arab
RarWinZip wrote:As far as I understand you're trying to decrease amount of computed info coming thorugh servers... And I appreciate this.
That's right. Before I do anything, I'd first want to report these bugs so they can add what is missing from the bugtracker, and if some of them are fixed (Rhino was working on the logistics and support trucks of all factions, not sure if he is now) then I can do the other ones.

After that, Mats391 and I will host a server (Early to know details) and we will test existing maps with factions that the vehicle fixes were applied as a test to make sure they don't have any unexpected effects :)

If all goes well, we will apply the same fixes to each factions vehicles.

Re: Full list of Networkable Problems

Posted: 2015-04-15 10:23
by Arab
Actually, the problem is when you code vehicles, each part of the vehicle's feature must be added as a 'template.', it can only take 12 codes regarding what it has.

Anymore than that and it can cause a crash.

There's other things that can cause a crash. Some of them happen at the loading screen at different times. Common things that apply to any mod are:
-Misspelled names
-Missing Files that the system is looking for like Collision Meshes (Models that prevent the player from going through an object)
-Python Issues
-Too many Statemasks
-Too many effects (Things like effects having a longer duration than they are meant to do. You can shoot the ground, and notice how slow the dust on the ground flies, and then imagine people doing that across the map.)
-Missing AI files/invalid ai template
-Missing line of codes for other codes
-Coding that doesn't apply for an object
-Missing Textures
-Water Speed on Maps are kept at 0, which causes a CTD

and more


This list is to send a full report of all vehicles with crash problems to the devs to make aware of all issues with all land and air vehicles. There may be more that I haven't checked in the BF2Editor, so this list may be incomplete since I haven't checked folders like 'Civillian', 'common', 'sea' & Xpak_vehicles.

Re: Full list of Networkable Problems

Posted: 2015-04-15 18:40
by WeeD-KilleR
Arab for [R-DEV Bug Fixer]

Re: Full list of Networkable Problems

Posted: 2015-04-16 08:05
by Arab
WeeD-KilleR wrote:Arab for [R-DEV Bug Fixer]
It's all a team effort ;)

Re: Full list of Networkable Problems

Posted: 2015-05-03 13:48
by Arab
The code here

Code: Select all

ObjectTemplate.addTemplate e_amphib_wake
ObjectTemplate.setPosition 0/-0.38/2.22
ObjectTemplate.addTemplate e_amphib_wake
ObjectTemplate.setPosition 0/-0.47/-1.99
ObjectTemplate.setRotation -180/0/0
ObjectTemplate.addTemplate e_amphib_wake_sound
ObjectTemplate.setPosition 0/-0.38/0
can be remmed out with no issues.
Also e_sinking_vehicle, I'm not sure if it's okay or not.

Re: Full list of Networkable Problems

Posted: 2015-05-07 10:20
by Arab
Could an admin rename this topic to Networkable Optimizations?

Re: Networkable Optimizations

Posted: 2015-05-07 12:19
by Amok@ndy
done 1234

Re: Networkable Optimizations

Posted: 2015-05-08 07:38
by MikeDude
This all goes way beyond me..
Glad we've got Arab!

Re: Networkable Optimizations

Posted: 2015-05-28 09:33
by Arab
Testing will confirm if this change improves or breaks the server.