Anti-Cheat functionality

More
19 years 11 months ago #18126 by MajorTom
As the beta release gets nearer, we've come to the point where we need to discuss the Anti-Cheat functions:

In previous scripts we read all of the relevant .ini file values on the client maschine in one block and compared that with hardcoded values. The solution had the advantage that it was niether possible to cheat on the client nor the server app.
But, it took nearly 2 seconds to do and was cumbersome to deal with for the scripter if a value was changed on any of the ships. It also required an update of the whole mod if anything was changed!

For SW I think we need an improved concept:

1) check all of the client config values (flux.ini) that have an influence on the mp game.

2) check the keybinds to insure that TRI is not activated.

3) Check the ship .ini files.
When the ship is selected in the players GUI we can create a sim using the players ini.file (but not place it in the world), and then use a switch with the T_type of the ship for the case statement.

For each T_type we would have a list of ini file values to check against a hardcoded value and also check for the correct subsims on the sim. (Thats because some of the scripted functionality is dependent on the existance or non-existance of certain Subsims.)

That would be much faster than simply reading all of the relevant .ini files on a client, regardless of which ship a player has selected.

The above could be done while still in the GUI, it would be fast and also let the player know something is wrong with his files before he even tried to join a game (and not occupy the server with first loading and then rejecting a client)


Items 1 and 2 would cover a server operator too but item 3, as described above, doesn't cover possible cheating by a server host! i.e the host could, for example, reduce the hitpoints on all the other ships, except his own.

The options I see here are:
a) create and check all possible sims via the GUI script before a server is started. This would probably add an additional 3 to 5 secs. load time for the server app. (which is already rather long)

b) Check the servers ship .ini files against the hardcoded reference values as other players enter the game, depending on the ship types that enter. That wouldn't delay loading but, if the host had incorrect files, a message would have to be transmitted, that the game will be terminated in, say 20 seconds, due to server malfunction.
(This would probably fall back on us more than on the server operator as the assumed source of the problem.)

Question:
What is the general view on this subject and are there other options you can think of?













Iwar2 Multiplayer Fan Site

Please Log in or Create an account to join the conversation.

More
19 years 11 months ago #10478 by Roi Danton
Replied by Roi Danton on topic Anti-Cheat functionality

Originally posted by MajorTom

Question:
What is the general view on this subject

It's quiet important: I would say, option 3a) 'cause it's crappy when the server starts, you're happy to play the scenario and then it ends immediately (or after 20 sec). So checking the ini files on every computer (clients and server) before loading the scenario is the best way.

and are there other options you can think of?

I think you can check the ship itself the player has selected instead of checking the whole Ship type. I.e. like (example EA StarFury):
Code:
// if all ship ini's are in the same path, here ini:/sims/ships/ea_starfury shiptocheck = String.TrimLeft( GlobalString("Shipsini"), 16 ); // referring to a SWMP_ShipData.pkg file containing the values for each ship (stored in Lists) // (for scripters fast to change and compile if the ini file has changed) // GetShipList returns the Values of the resp Ship (named like the resp ini file) shipvaluecheck = SWMP_ShipData.GetShipList(shiptocheck); // read out the ini file . . checkvalue3 = INIFile.Int( GlobalString("Shipsini"),"Properties","hit_points",0 ); . . // compare . . if ( ... && checkvalue3 == List.GetNth( shipvaluecheck, 3 ) && ... ) { //continue, mostly calling a new screen } else{ // to display in Error Screen and log which val is false (w/ switch) // just the first false value will be shown, then the function breaks if(){} . . else if( checkvalue3 != List.GetNth( shipvaluecheck, 3 ){ Debug.PrintString("SW MP CHEAT ERROR: Hit Points of the ship "); Debug.PrintString(shiptocheck); Debug.PrintString(" are wrong!\n"); Global.SetInt( "g_CheatError_id", 3 ); } . . iGUI.OverlayCustomScreen( "SWMP_????.ErrorScreen" ); }
(There are better ways for sure, but I'm more a material scientist than a programmer, so fast ideas aren't the best [:I] )

~Buda5 Designer & Scripter
buda5.firstones.com


~Buda5 Designer & Scripter
buda5.firstones.com

Please Log in or Create an account to join the conversation.

More
19 years 11 months ago #10483 by MajorTom
Replied by MajorTom on topic Anti-Cheat functionality
Yes, it would be faster to read the ini properties, and that is what we did on the previous versions of mp mods.

Now we have subsims that are important too:

Example: The CUV ship is recognized by the existance of a "Cargo_engineerreloader" and that triggers the reload and heal functions.
Obviously, other ships should not have that subsim. If you did put it on an A-Wing, you could dock it to an X-Wing and heal it. But you wouldn't notice it in the properties of the A-Wing.ini file.

I would rather not create the sim, but I don't know of a way to check the ships inifile for a subsims existance, without creating the ship. (unless you know the exact template number of it).
Can you think of a way, Roi?






Iwar2 Multiplayer Fan Site

Please Log in or Create an account to join the conversation.

More
19 years 11 months ago #10488 by Roi Danton
Replied by Roi Danton on topic Anti-Cheat functionality

Originally posted by MajorTom

I would rather not create the sim, but I don't know of a way to check the ships inifile for a subsims existance, without creating the ship. (unless you know the exact template number of it).
Can you think of a way, Roi?

Well, you can look in every template of a sims ini (referring to the example above):
Code:
// i,j = Integers, exists = boolean, templatestring = string // test the number of templates in an ini file // (I don't know the exact expression for a while loop spontaneous, but I think you get what I want): do{ exists = INIFile.NumberedExists( GlobalString("Shipsini"), "Subsims","template",i ); i = i + 1; } while(exists == true) for( j = 0; j = i - 1; ++j ){ templatestring = INIFile.NumberedString( GlobalString("Shipsini"), "Subsims","template",j, "" ); if( templatestring == "Cargo_engineerreloader"){ //debug msg, error screen and so on, besides its the CUV break; } }


~Buda5 Designer & Scripter
buda5.firstones.com


~Buda5 Designer & Scripter
buda5.firstones.com

Please Log in or Create an account to join the conversation.

More
19 years 11 months ago #10490 by MajorTom
Replied by MajorTom on topic Anti-Cheat functionality
That would certainly be faster than creating the ship.

Oh! I just thought:
what if the player made his own subsim .ini.
Or he could change the contents of an existant subsim, for example, one of his less usefull guns.

To heal and reload others, he would only need to change the weapon subsim like this:

[Properties]
name=Cargo_EngineerReloader

Or, if someone wanted to deploy gunstars he could change his X-Wing secondary laser to:

[Properties]
name=Cargo_MiniGunstar



[:(] I think we will have to create the ship and do something like this:
bool ClientInifilesOk (hsim sim)
{

switch
{
case: T_Patcom // this is the A-Wing

if ( Sim.FindSubsimByName(sim, "Cargo_MiniGunstar") ) return false;
// do the other inifile properties as you suggested in the first post
break;

case: T_Passenger //the cuv ship

if ( Sim.FindSubsimByName(sim, "Cargo_StationReloader") ) return false;

// do the other inifile properties as you suggested in the first post
break;

//ect. ect.

}// switch
} // bool IniFilesOk




What do you think?

btw: the previous versions of the mp mods have 470 lines of code used to get and compare the properties of all the ships and all of the different weapons. They are all still useable but we have even more ini files now.






Iwar2 Multiplayer Fan Site

Please Log in or Create an account to join the conversation.

More
19 years 11 months ago #10495 by Roi Danton
Replied by Roi Danton on topic Anti-Cheat functionality

Originally posted by MajorTom

What do you think?

Good solution against cheating, but I would test the ship.ini before the subsims b/c testing the ship ini is for every ship the same (besides the CUV), but testing the Subsims is different for almost every ship.
One ship to load doesn't take so long. Before loading and testing you could focus a screen with the lines "Standby ... perusing the ships check list" or smthg like that.

@Old Version: Maybe for checking the sim.ini it could be helpful? But I wouldn't copy whole passages if they doesn't fit exactly with that what you want to realize here.

~Buda5 Designer & Scripter
buda5.firstones.com


~Buda5 Designer & Scripter
buda5.firstones.com

Please Log in or Create an account to join the conversation.