A3Antistasi / A3-Antistasi

A3-Antistasi is the new official Antistasi version
https://a3antistasi.enjin.com/
MIT License
79 stars 337 forks source link

Enemy attacks performance #126

Closed Sparker95 closed 6 years ago

Sparker95 commented 6 years ago

Hi!

When CSAT decides to attack NATO at the other side of the world our FPS drops like hell. Obviously it makes little sense to waste our precious CPU cycles to simulate their fights far away. People were renting servers to play the old Antistasi, now with this new feature even our rented servers are not enough.

So I suggest you could half-virtualize these fights. It could work this way:

  1. A faction decides to attack a location.
  2. If the location is already spawned in or is close to players, handle it as usual.
  3. If it's not spawned in, take into account different criteria to estimate if the location under attack is close, far enough or very far from the players. Criteria can be different, for instance: Does the straight line connecting the CSAT carrier and the target comes close to players, so that players can potentially see aircrafts fly above their heads? And so on.
  4. If the location is very far we just estimate the results of their fight and say 'Zaros base has been taken over by ...' or 'Zaros base has defended an attack' and decimate their garrison.
  5. If the location is far enough, do it the more complicated way. The location switches to under attack state. If the player comes close to a location which is under attack, it spawns in, and enemy units spawn there as well. It's probably the hardest part to spawn both of them mid-fight in a way which makes sense. If noone comes within the spawn distance of the location, the location stays in this state for a while (10-15 minutes) and we use the random command again and estimate the result of this attack.

Does it make any sense or is the code already done in a similar way?

bobchaos commented 6 years ago

Even with a powerful rig and 3 HCs server perf on dedi drops to 10 FPS during attacks when stuff starts blowing up, I'm all for simulating distant fights but it can get tricky since players can fast travel. Maybe B has some ideas?

Sparker95 commented 6 years ago

The 5. from my 'algorithm' addresses the issue of players coming close to the battle scene.

Barbolani77 commented 6 years ago

Sorry but no. The road to ultra optimisation in Antistasi has been run with the solid foundation of never, ever, simulate anything.

This is a dynamic mission, it is not a matter only of "where is the HQ, where is the player", because the players can be in the flying path, or some rebel garrison / roadblock whatever.

If we are having 10 FPS then maybe we have to low the settings of amount of AI or whatever.

Another "solution" is to give more terrain to CSAT on the begining, so you may think all the attacks, at least in early stages, will be in some zone.

Sparker95 commented 6 years ago

never, ever, simulate anything.

Except that everything is already simulated. You are doing unit caching at locations and it is obviously seen to all players. What if an AT soldier sees an enemy tank at another base 1.1 km away? We will never know because it is simulated as if they don't see each other beyond spawn range.

I am just suggesting another variation of unit caching. Make attacks that are obviously away from all players cached. At the end of a fight, if noone came close to this place, you will have to simulate which side of the two enemy sides won the fight. It won't be totally fair but do we as players really care about fairness between two enemy factions?

Barbolani77 commented 6 years ago

Of course, but in both cases the player has the chance to participate in some way.

In the cases you mention, I will allways have the chance of doing a fas travel, or just buy a civilian heli and be where the action is in 3 minutes...

Sparker95 commented 6 years ago

Probably I didn't explain my idea clear enough. In my idea, you will still be able to join the NATO vs CSAT fight if you come close to it. The units will spawn and start killing each other. But if you are far away they will have their fight in a virtual SQF battle space.

Barbolani77 commented 6 years ago

So you mean "I disembark, if the player is very far away, diceroll, some chance to die, some chance to kill", something like that?

Sparker95 commented 6 years ago

I mean like your script decides that CSAT must attack a NATO airbase, allright? The NATO airbase is obviously 10th of km away from all players right now. Then it becomes a special kind of location. Let's call it a battle field. The battle field stays there for 10 minutes. If during these 10 minutes anyone comes within, say, 4km of the battle field, then both faction's units spawn at the battle field. If no player comes close to it, then the battle field stays there for its 10 minutes, during this time you can do dicerolls of different levels of accuracy, and at the end of this 10 minute interval we decide who won and how many units there are now at the airbase - without ever spawning physical units.

bobchaos commented 6 years ago

another option is to spawn the units in but disable sim until someone has them in sight. My only worry with something like this is that the attack waves need to travel, sometimes getting shot down or causing damage outside the intended AO on the way. We'd need a way to account for that too, especially if it's rebel locations the attack would be flying over

Sparker95 commented 6 years ago

It can be calculated easily. Image link Make a rectangle ~2km wide which starts at attack source and goes to the attack destination. If there are any other locations within this rectangle then the attack must be fully simulated with helicopters flying. In SQF you can easily implement it with the inArea command

Barbolani77 commented 6 years ago

uhm da duhm da duhm. Lets see:

Disable simulation is not an option, because it wont make the units die or shoot. Indeed Antistasi does it on spawning engine.

Now Sparker idea: yes, detecting enemy zones in some direct line with rectangle area is easy, but that is not the only thing. The check has to be looped because the player can move. And btw, 90% of those times the rectangle will detect an enemy garrison.

The flying path is hard to solve in a reliable way.

What I can do is the following:

This will make remote attacks much faster, but still players will have the chance of going there, even with the battle almost finished, to loot / take advantage, and there will be soldiers around.

Barbolani77 commented 6 years ago

implemented in the next patch: remote battle accelerator. Once all the troops are disembarked, some counts and formulas are applied to auto kill a defender or attacker every 10 seconds, allways checking player presence in a long radius (2*spawnDistance).

Barbolani77 commented 6 years ago

Solved

Sparker95 commented 6 years ago

Oh that's cool! Good job!

zalexki commented 6 years ago

Can we talk about this some more.

This feature is still destroying the entire server performances for nearly nothing. (frankly, i've never seen anyone joined these attacks on our officials servers)

Plus every player that i explained why the server is going to shit every hour and we have to restart is only about this feature which they dont even understand why it exists and want it gone (except 2 guys on a poll vs more than dozens that i asked).

Now we also have the guys from armahosts.com (providing us with beast of perfs for US 1) saying that a lot of players are blaming the providers because of the bad FPS.

Can we brainstorm about a solution where when you play SW of the map an attack NE will not kill your server performance ?

I know you like this feature @Barbolani77 but IMHO it's ruining the mission for MP. I'd like to keep it as a way more optional thing to do which will not have that much impact of perfs.

An attack spawn 280 AIs at the big central airfield while we were just at the beginning of the mission at the very SE of the map, what is the fun of loosing all serv perfs to something you cant do shit about ?

Maybe the commander can have access to a yes or no button where he can decide to spawn or not the AIs with a default to no after 5min ? maybe even coupled to another start parameter i dont know.

Main thing would be to reduce the number of AIs which is stupidly high 300 units is already the limit of arma so when this happened and we are on missions, the server goes up to 500 !! (with the max AI set to 150)

Barbolani77 commented 6 years ago

Main thought. If all the SP community feedback comes about the amazing performance of the mission plus my own experience also is not having a single fps drop during mayor attacks. We must investigate in two ways:

Some actions to do on my side anyway:

Neeqza commented 6 years ago

I'm playing singleplayer only and I'm getting huge FPS drops as well. Spamming the garbage clean button somewhat helps.

zalexki commented 6 years ago

probably due to the vehicules being destroyed during this attack.

Yes arma3server really has some internal issues and shared servers are often barely ok for arma 3 servers but now we have a full dedicated(physical) server for us from armahosts.com, there we have 32Go with a i7-4790 thats goes up to 4ghz, it is a beast compared to shitty cloudnitrado with there 2.1ghz, tho not the same prices.

We have really good FPSs all the time until these attacks :/

Ok cool @Barbolani77 i'm gonna try to setup some performance profiling on both servers. I'm thinking about a periodical log of FPSs (server/hc), number of player, number of AIs maybe also a way of knowing if there is an attack during this logging ? (if you can help me on that would be nice)

justnwaters commented 6 years ago

My recommendation with this feature, would be to by default have it off. Then have 1 or 2 servers that are ultra hardcore with 2-3 headless clients supporting the real-time battles. Most people that want to play Antistasi are looking to enjoy it at a very small scale version. Typically they are with 2-3 friends or solo and they want a server that costs less than $10 a month. So when their server starts performing poorly they are wondering why the provider sucks. But in reality if we want to give them the performance necessary to run the default mission settings they would need to pay something closer to $60-80/month. Then you lose a large portion of interested players.

If any sort of combat simulation is out of the question. Alternatively, CSAT could be removed/disabled. This would reduce the gear/vehicles that the rebellion could obtain. The CSAT could potentially come in later once the rebels war score hits X amount and soley focus on raiding the rebel's controlled points. This would make their assaults more meaningful without 'virtualizing' the simulation.

Sparker95 commented 6 years ago

It's not only the question of performance but also of a total time loss due to frequent restarts. Very often headless clients can't handle these attacks regardless of server clock speed and they just disconnect and connect back. Then we have the problem that HC disconnection is not supported and thus we must finish our operations, RTB, save, restart, prepare again, etc. You can imagine that it takes a lot of time. Maybe large attacks should be hosted purely by server then? And everything else offloaded to headless clients. At least we won't need to restart the server every two hours.

Barbolani77 commented 6 years ago

That can be done. But I still dont have a full picture of What happens. If you start monitoring the machines as @zalexki says, its the first step.

Now we have cloud servers we may install the Arma 3 monitor mod which Will log all that info that can be crossed with .rpt output.

I wont disable anything, if Antistasi requieres more budget, I can do nothing but optimise.

I have an average-good 3 years old PC And I have never noticed a major fps drop during my humdereds of Major attack tests.

zalexki commented 6 years ago

Profiling is in place on both servers, check your forum messages

Barbolani77 commented 6 years ago

Things that I am currently testing:

Barbolani77 commented 6 years ago

As the wavedCA cap is working like a charm, I may call this "solved"