0

note:I am not sure if this questions belongs here, if appropriate please move to appropriate stackexchange site.

I am developing a multiplayer game.

What I want to maintain in my code : 2d clusters.

What are clusters: they are aggregation of users (a convex hull around users).

What is a user : a user has a x,y position and an envelope around him which he can influence. The envelope can be ideally a circle, whose radius is how far he can see. Every user envelope in a cluster should intersect with at least one others envelope in the same cluster.

In the figure I have 4 clusters. 2nd and 3rd figure shows how new clusters will be formed as users move. enter image description here enter image description here enter image description here

As users move around clusters will split, or merge to maintain above property.

I want to know if "kinetic convex hull" is the right area where I should be looking to find a solution to implement such a cluster maintenance in my c++ game code.

Note: Also I am reading about the kinetic convex hulls right now, and I havent finished it, but I think that it deals with forming a convex hull around a fixed set of points. I need that, but what I also needs is splitting the hull into two or more when user's envelope inside the hull doesnt intersect with others envelope inside the same hull.For example A in the 3rd picture above.

2 Answers2

0

From your description, I don't see why you would need convex hulls.

In your 3rd picture, the empty space between B and F would be inside the convex hull. The hull itself would be from B to F.

https://i.stack.imgur.com/8CG97.png

(Note: The hull of the envelopes would be tangent to the envelopes of B and F. It is harder to compute but can easily be approximated.)

If this kind of information is useful to your game, then convex hulls are right for you! If kinetic convex hulls don't support splitting/merging, you'll just have to recompute the convex hulls. But with so few points, this should not be an expensive operation anyway. At least it's not for non-kinetic hulls.

nkaleidoskop
  • 126
  • 4
0

Not a specialist about it but it looks like you'll need to check for intersections on every user movement (check only the moving user). If a user's envelope has stopped intersecting with users from the same hull you'll need to rebuild the hull. You'll also need to check whether the user's envelope has started intersecting with another user's envelope too. If it is - you'll need to rebuild both old and new hulls (probably merging them).

EDIT: clarification

Basycally on every user movement you'll have to check what is the status of the moving user:

  • if this user's envelope has stopped intersecting with other user's envelope - exclude the user from the hull
  • if this user's envelope has started intersecting with other user's envelope
    1. if this user is not part of any other hull add it to the other user's hull
    2. if this user is part of another hull - merge the hulls
stan0
  • 11,549
  • 6
  • 42
  • 59