Jump to content
Sign in to follow this  
zorrobyte

Dynamic load balancing of AI

Recommended Posts

Greetings!

Some of you know what a headless client is or how CQB from MSO spawns enemy on client machines to enhance performance. Some scripts/addons have come out recently that can report the simulation speed of every connected worldspace.

I bring to you the setOwner command, a highly underrated solution to our AI issues in Arma (in part).

Some may argue units loose waypoints, init line, scripts etc put onto the units so the command is useless, however I see room for use. Why not hand off AI to a few connected HCs dynamically and/or all connected clients (even the accuracy issue was solved)?

For proof of concept, why can't a loop run that checks locality and reinits UPS or SHK patrol for the waypoint issue? Why not run HETMAN/HAL to reinit and give these "new" units a job? Would it be possible to PVAR waypoints, etc and pass them between setowner?

Question remains: "From server machine, change the ownership of an object to a given client. Returns true if locality was changed." can you change locality from a CLIENT to SERVER or CLIENT to CLIENT?

Feedback welcome

Share this post


Link to post
Share on other sites

I'm interested in HC Task Manager (Load Balancer) but currently have no time to implement it in our project due deadline.

I have some ideas how it should work:

1. Server-side slow loop (scheduled env, sleeps) every 1-10 minutes which monitors current objects state (locality).

2. HC-side slow loop with FPS measurement based on Moving Average.

3. Server requests HC's average FPS regularly

4. Based on HC's FPS server calculates gross power of the HC: total objects on that HC divide on FPS drawdown. For eaxample:

20 objects on HC

40 FPS (average)

So drawdawn is 10 FPS because: 50 FPS (max) - 40 FPS (current avg.) = 10 FPS

20 objects / 10 FPS = 2 O/FPS.

It means each object "eats" 0.5 HC FPS.

5. Calculate total power for all HC. Just summarize all gross power for all HC. For example we have two HC with 75 O/FPS and 25 O/FPS. As you can see they have different power and/or load. We have 100 O/FPS for all.

6. Create object "cart": [groups, vehicles, environment, static_objects]

7. Calculate share for each HC: HC's gross power / total power available.

75 / 100 = 0.75

25 / 100 = 0.25

8. Now we can assign the cart objects to HCs in compliance with their shares

HC #1: [groups * 0.75, vehicles * 0.75, environment * 0.75, static_objects * 0.75]

HC #2: [groups * 0.25, vehicles * 0.25, environment * 0.25, static_objects * 0.25]

9. We must delegate AI properly because they will lost all waypoints and other stuff. Well, actually it's not easy. We can get waypoints by waypoints command but synchronized objects will be pain in ass.

....

after gathering all AI data and packing it to one big array, something like

[
   [group_0, waypoints_0, sync_data_0, some_other_shit_0],
   [group_1, waypoints_1, sync_data_1, some_other_shit_1],
                            ....
   [group_N, waypoints_N, sync_data_N, some_other_shit_N]
]

send it to remote HC function (via BIS_fnc_MP or some sort of CBA function)

Share this post


Link to post
Share on other sites

I was thinking of something like this just yesterday in fact, but from what I've seen hosting a server, server fps can be a straight 50, while clients only get around 20, so how much would this really help the clients?

Share this post


Link to post
Share on other sites

It may help server, not clients. It is the way to see hundreds of AI on the map at the same time. And a lot (thousands) of non-AI objects with low FPS drawdown on the server.

Share this post


Link to post
Share on other sites

Couldn't putting more load onto the clients bog their FPS down more as well, especially those on weak rigs? or are you going to limit the number able to be transferred.

I do think this is a good thing to use with headless clients though, although I am still hoping that BIS will build this kind of functionality into the main server.exe

Share this post


Link to post
Share on other sites

A balancing system to balance AI on connected HC's and the server itself could be handy. However using actual clients probably won't work without some sort of trickery. We had a broken script on a mission one night that ended up spawning a few AI on each connected client instead of just the server. The server FPS took a nosedive along with all the connected clients due to the immense amount of data that each client had to send to the server which was then sent to other clients. It could have been the initial syncing that just never resolved but spreading a few AI on all clients will likely not work. Identifying clients with good fps and high bandwith to take a larger amount of AI like the HC's might work though.

Share this post


Link to post
Share on other sites

Beta: 25-04-2014

Added: BIS_fnc_tasksUnit - Grab all tasks currently created for a given unit

Time to experiment, wonder if this function would be useful for saving unit state before setowner.

EDIT

Ah, or not. More like tasks save for players. No worries.

Edited by zorrobyte

Share this post


Link to post
Share on other sites

Oooh .. experiment away zorrobyte. Will be interested in the results!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×