Terrain objects as MMOItems?

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

OhMyOhmit
Posts: 18
Joined: 24 Apr 2018, 12:25

Terrain objects as MMOItems?

Postby OhMyOhmit » 06 May 2018, 11:06

Hello everyone. I've come to a point where I have to think about npcs and their movements. What I need is to prevent npcs walking through trees and rocks in my scene. The first solution that comes to my mind is getting all trees'/rocks' coordinates, simulate some "cube" collision on this coordinates and handle this stuff on a server like MMOItems, so players/npcs will "see" it only when they are close to them. Or maybe just a List of such collision-cubes, not MMOItems, I am not sure what is better, or if this solution is absolutely awful.

So what do you guys think about it? Is this idea ok or you can give me some better solution?
User avatar
Lapo
Site Admin
Posts: 23008
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Terrain objects as MMOItems?

Postby Lapo » 07 May 2018, 07:17

Hi,
there can be different ways of doing this.

One approach is to have the "map data" on the server side so that the NPC movement logic can detect collisions and non-walkable paths and avoid the problems you described.

Representing obstacles as MMOItems should be fine if you need those items to be sent to the clients. Otherwise you could simply represent obstacles using server side only data structures.

This approach well if your map is relatively simple. If you have complex terrains with 100s of small obstacles (e.g. trees, bushes, rocks...) it's probably going to be difficult to translate all that map data to server data and keep it in synch every time you edit the world.

Can you give us an idea of the complexity of your map?
Also how is it created? Unity?

Thanks
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 81 guests