Autoritative movement of mobs

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

Moderators: Lapo, Bax

Post Reply
Robbilie
Posts: 190
Joined: 04 Sep 2010, 19:48
Location: Ratingen, Germany

Autoritative movement of mobs

Post by Robbilie »

hey guys

I am using unity and i want to make autoritative moving mobs...

Has anybody an idea how to do this?

In unity there is something like transform.lookat(vector3);

Or

transform.lookat(transform);

same with movetowards...

Is there something in java i can use for that?

Thanks for ur help ;)
Robert
Robbilie
Posts: 190
Joined: 04 Sep 2010, 19:48
Location: Ratingen, Germany

Post by Robbilie »

nobody who has an idea?

my mobs have life and get killed when life is 0 and they give exp to player and they have lvls...

but now i want to make them move

im using the fps demo exte as base....?

thanks for ur ideas ;)
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Post by ThomasLund »

You code them server side with a scheduler loop running to update what they do.

So look at the task scheduler and then every X milliseconds update the NPC movement states.
Robbilie
Posts: 190
Joined: 04 Sep 2010, 19:48
Location: Ratingen, Germany

Post by Robbilie »

damn i really have to read more through the docs :D

Thanks thomas ;)

ill try tomorro but i think thats what i need ...

Main Problem is solved now lets check if there are any minor probs :P
Robbilie
Posts: 190
Joined: 04 Sep 2010, 19:48
Location: Ratingen, Germany

Post by Robbilie »

one question i asked in my first post:

I know how to move the mob like 1 m in a direction but i dont know the direction.
The mob should face the player hes attacking but how to?
The methods from unity i cant use....

Ideas?

Thanks
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Post by ThomasLund »

Need to write your own simple transform classes - try to look at the FPS example, which has some basic already there. Like calculating distance to another transform and so. Rotating towards another transform is easy too - requires a little math, but lots of examples out there for calculating a vector towards a point in 3d space.
GRIM2594
Posts: 52
Joined: 07 Nov 2010, 23:16

Post by GRIM2594 »

I have been trying to wrap my mind about this aspect of my code for a couple days now. Getting the NPC to move is easy, but following collisions is something entirely different.

I have been trying to find information on how to actually create a collision map from Unity3D, but have had no luck. If I have the server tell the NPC to go in direction X, it will go through the ground, walls, or whatever else is in it's path.

I would also like to know how other's have done this, with Unity3d (if anyone has anyway). I know that Thomas has mentioned it, in the last paragraph, in the FPS tutorial documentation... but I can't find any information on actually doing it.

I will keep it in my mind for now, and use my current system until something better "clicks" in my mind.
User avatar
gabrielvpy
Posts: 69
Joined: 23 Jul 2015, 20:18

Re: Autoritative movement of mobs

Post by gabrielvpy »

Hi, Robilie. Can you post your code? I'm trying to implement movement towards another player and I'm having trouble. In unity is easy with vectors, but in java you have to implement yourself.
We made an awesome GPS - MOBA.
Try it out here: Get Fhacktions
Post Reply