Hi,
I am trying to create a huge amount of collectibles (>32’000) on a large multiplayer scene.
However, looks like there is a max_instances limit around 32’000.
Is there any way to increase it?
Another (somewhat related) question is - I already realized that it will be impossible to attach a small script to each of these collectible objects because of their enormous count. And it is better to control them using a centralized script and handle them from there (perhaps store in some table and handle one by one in a loop).
It is fine, however - how in this case do we handle collision detection with these collectibles? From the tutorials I understood that there must be a script attached to each game object with collision object which will handle “collision_response” message, and if I cannot have this script on each collectible, how do I handle collision detection when this object is being collected?
Is everything on screen at the same time? You could have the data in a table, and then have a queue of collectible templates ready to use when you need to draw them on screen.
Yes, multiple connected players will be located in different places of the “world”, and they move fast across the level, so theoretically all of them will be visible to all players at least on the server, so ideally I need all objects to be on the scene at the same time.
Thank you.
You can manage virtual objects in a table, and then put them into the local game area for the players which can see them so that the game is not wasting resources on objects that are way off screen.Then let local clients detect if they collided with the objects on their local screen area.
Correct, all 32000 objects must be visible only to the server at once. Players will see only their surroundings, and I can handle that somehow.
The problem is - it is server part which needs to detect whether any player has collided with a collectible or not.
I can move this logic to the player’s instance, but this will open a hole for cheating etc.
Obviously, if there is no way to do it on the server I need to rethink whole solution, but still hoping to see if anything can be done or not before exploring that.
Thanks.
You can do collision sanity checking on the server for anti-cheat. You don’t need to use box2d physics. You can simply have the player positions checked against object positions (distance between points) when a player claims to have collected something, and if they are too far away deny them.
Thanks Pkeod.
Yes, I had the same in mind but I was really hoping I can do this as straightforward and easy as possible.
So basically on the server I can have a table with 50’000 simple objects (not game objects) with their coordinates and move collision detection to the client side and just cross check on the server if it is legitimate or hack.
But I was hoping I will be able to do it in a regular way, looks like again I need to use some “crutches”.
Actually this won’t work. It is Server who needs to do all collision detection.
Because there will be another group of objects (also a lot of) - so called “danger objects”, which when player collides with should trigger health decrease.
If player will hack the client part and will not send collision detection with such objects, then server will never catch this, and it will give huge advantage to such player.
Cheers!
You can do collision detection on the client and the server. Server is the authority, but client can still react to collisions instantly (feels better to user), and then have its state reset if the authority says it’s wrong. For reward objects you can still trust the client to report first and then check after to save resources. For danger objects, you could make it a fuzzy system where you periodically do checks, and then ban users which are cheating, or hell ban cheaters so they don’t know they were caught and can still “play” but not have an actually real impact to the game world. You don’t need to do distance checks for each player against all danger objects, place things into quadrants (look up collision detection with quadtrees) and then only check against danger objects within each quadrant for closeness.
Are you trying to make the server with Defold too? I would not do that if I were you… What is your current plan for how your server system will work? Large service or player hosted servers?
Thanks Pkeod.
Your advises sound fantastic, this looks to be a very good way of doing it.
I was thinking to also create server in Defold and communicate with clients using some socket library.
So all code (client and server) will be written in the same style (ideally write a single code for both, just spiced up with “if server/if client” blocks).
Is it a bad choice? What would you recommend for the server side instead?
For the last question - I am thinking to create an open space 2D battle game with multiple collisions between players and other danger objects. There will be a dedicated server running on linux and players will connect to it.