How to: Client Sided Hostiles?

I’m currently working on a game that relies heavily on ClientSided ‘Chunk Generation’ - By this, I mean the map is split into different sections that the Player “travels” (teleports) to and creates the illusion that they are in that area.

However, I’m struggling on concepts of how to create ClientSided hostiles for this - As the terrain will not be present on the ServerSide, all Hostiles spawned will fall straight through the non-existent Map piece, so this option is not viable.

I did create a work around for this as follows:

  • Player approaches a ‘Spawner’.
  • Spawner loads appropriate Hostile; :SetNetworkOwner is then set to the nearest Player.
    (( if no Players nearby, this will then despawn ))

I’m looking to create a method that works with the ClientSided Chunks singularly, however, I want the NPC / Hostiles to be visible to all Players present so that the Player is not seen to be fighting literally nothing.

Does anyone have any experience in this?
ANY help or suggestions will be greatly appreciated.

you can save every hostile’s position and other potential values such as health in a dictionary on the client when the chunk they’re on despawns and load them back to their position once the chunk gets reloaded, if you want to give an illusion that they moved around after the player has left the chunk, you can randomize their position slightly when loaded

as for having the client-made hostiles be visible for everyone else, you’d probably need to do something along the lines of
-have each client simulates the hostiles’ AI, which would target other players
-when another client damges a hostile, have them fire a remote to the server, which would then tells every other client the hostile has been damaged in order for the clients to render out the damage on their simulated hostile (if the hostile is unloaded, change the saved value for when it gets loaded back in)
this would gets while wacky for situations like another player interacting with hostiles in an area you’ve unloaded, while on their screen the hostiles are next to them, if you were to load them back in, they’d only be starting to move next to the other player. you can prevent this with some logics of your own such as having despawned hostiles still simulating their AI while despawned (you can use the saved hostile dictionary to act as a pseudo-npc by editing each of its saved properties)