Page 1 of 1

Autoritative movement of mobs

Posted: 21 Dec 2010, 11:48
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

Posted: 30 Dec 2010, 15:40
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 ;)

Posted: 30 Dec 2010, 18:41
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.

Posted: 30 Dec 2010, 21:03
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

Posted: 31 Dec 2010, 09:56
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

Posted: 31 Dec 2010, 11:03
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.

Posted: 13 Jan 2011, 03:24
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.

Re: Autoritative movement of mobs

Posted: 03 Nov 2015, 18:26
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.