Monsters collsion and pathfinding

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
WishFish
Posts: 8
Joined: Thu Feb 07, 2008 10:08 am

Monsters collsion and pathfinding

Post by WishFish »

Hi,

I searched a lot on the forum but strangely didnt find anything related to the following problem:

I have client using irrLicht for graphic.
I have server to which clients connect.
Clients are basicaly players playing in the multiplayer world, that means they are getting coordiantes of all other object in the game from the server. And everything is fine while it is only about human players.

But if i want to add computer controlled players (monsters), my question is, how can server do the collision or pathfinding when it doesn't even know what is irrLicht?
It means i must run irrLicht on the server also?

2nd question:
Ok, i will run irrLicht on the server also, then if there are lets say 7 levels (zones) in the game, that means that server will need to load and run all 7 maps simultaniously?

3rd question (MAIN QUESTION)
Ok, i have server runing irrLicht with 7 maps runing simultaniously. Now about monster AI and 3D issue. Lets say i have built a waypoint graph for my levels so that monsters know where and how to move around.

We talk about server:
monster #13 see player #3 and want to follow him. They are not on the same height level. Is there any support (or possibility to implement) in irrLicht so that i can just tell the monster to move to 2d point of the player, and then irrLicht will calculate height coordinate based on the collision between monster and level.

Like: monster->moveTo(horizontalPlanePoint)
and height component will be calculated depending on the level configuration?

Ask me if i need to explain more.

Thanks for the anwers!
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Re: Monsters collsion and pathfinding

Post by rogerborg »

WishFish wrote:But if i want to add computer controlled players (monsters), my question is, how can server do the collision or pathfinding when it doesn't even know what is irrLicht?
It means i must run irrLicht on the server also?
If you want to use Irrlicht's collision detection, then yes, of course you will. You can use the video::EDT_NULL device if you're not going to be doing any actual rendering.

Alternatively, you may be able to get away with using a much more abstract scheme, or a 3rd party physics engine, depending on how much accuracy you want.

At this point, it might be a good idea for you to start thinking of your level topography and actors in abstract terms rather than as Irrlicht objects.

WishFish wrote:Ok, i will run irrLicht on the server also, then if there are lets say 7 levels (zones) in the game, that means that server will need to load and run all 7 maps simultaniously?
That looks like another rhetorical question to me. Are you just thinking out loud? :P

WishFish wrote: Is there any support (or possibility to implement) in irrLicht so that i can just tell the monster to move to 2d point of the player, and then irrLicht will calculate height coordinate based on the collision between monster and level.

Like: monster->moveTo(horizontalPlanePoint)
and height component will be calculated depending on the level configuration?
Answer: it depends. If you are using appropriate level topography (e.g. ramps) and collision animators, then it might all work out peachy. What Irrlicht won't do is have scene nodes climb ladders or jump. Also, the "moveTo()" functionality would be an iterative setPosition() - the logic of that is up to you.

The best person to ask would be JP. Have a look at irrAI and see if that helps you.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Yeah feel free to check out irrAI, it might not be usable for you at this stage as it's still very early on but you could always just look over the source code and see how i've done the pathfinding and put that into your own project or be inspired by it in some way.
Image Image Image
WishFish
Posts: 8
Joined: Thu Feb 07, 2008 10:08 am

Re: Monsters collsion and pathfinding

Post by WishFish »

rogerborg wrote: If you want to use Irrlicht's collision detection, then yes, of course you will. You can use the video::EDT_NULL device if you're not going to be doing any actual rendering.
I can see that IrrlichtDevice has pointer to only one sceneManager, that means i will have to use more NULL devices, will that work?
Is it possible to disable textures loading to save resources?
rogerborg wrote:
WishFish wrote:Ok, i will run irrLicht on the server also, then if there are lets say 7 levels (zones) in the game, that means that server will need to load and run all 7 maps simultaniously?
That looks like another rhetorical question to me. Are you just thinking out loud? :P
:) sorry, i must, its all getting so complicated right now!
rogerborg wrote: Answer: it depends. If you are using appropriate level topography (e.g. ramps) and collision animators, then it might all work out peachy. What Irrlicht won't do is have scene nodes climb ladders or jump. Also, the "moveTo()" functionality would be an iterative setPosition() - the logic of that is up to you.
Not following you completly here.
If i attach collision animator to node and call its setPosition(x, y, z), the irrLicht will automaticaly adjust its vertical postition?

EDIT:
Camera node with collision animator works that way. User press "forward" key and camera will move in that direction updateing vertical position automaticaly. Is it possible to use the same functionality for other nodes?
Last edited by WishFish on Thu Feb 21, 2008 12:59 pm, edited 1 time in total.
WishFish
Posts: 8
Joined: Thu Feb 07, 2008 10:08 am

Post by WishFish »

JP wrote:Yeah feel free to check out irrAI, it might not be usable for you at this stage as it's still very early on but you could always just look over the source code and see how i've done the pathfinding and put that into your own project or be inspired by it in some way.
Ill check it, thnx!
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Re: Monsters collsion and pathfinding

Post by JP »

WishFish wrote: I can see that IrrlichtDevice has pointer to only one sceneManager, that means i will have to use more NULL devices, will that work?
Is it possible to disable textures loading to save resources?

Not following you completly here.
If i attach collision animator to node and call its setPosition(x, y, z), the irrLicht will automaticaly adjust its vertical postition?

EDIT:
Camera node with collision animator works that way. User press "forward" key and camera will move in that direction updateing vertical position automaticaly. Is it possible to use the same functionality for other nodes?
A device can have as many scene managers as you want i think, you can create new ones and hold on to the pointers of them and then draw/update them as you like.

Calling setPosition for a node with a collision animator should update the vertical position according to the level, yeah, applying gravity if it's above or pushing the node up if it's in the geometry.
Image Image Image
WishFish
Posts: 8
Joined: Thu Feb 07, 2008 10:08 am

Re: Monsters collsion and pathfinding

Post by WishFish »

JP wrote:
WishFish wrote: I can see that IrrlichtDevice has pointer to only one sceneManager, that means i will have to use more NULL devices, will that work?
Is it possible to disable textures loading to save resources?

Not following you completly here.
If i attach collision animator to node and call its setPosition(x, y, z), the irrLicht will automaticaly adjust its vertical postition?

EDIT:
Camera node with collision animator works that way. User press "forward" key and camera will move in that direction updateing vertical position automaticaly. Is it possible to use the same functionality for other nodes?
A device can have as many scene managers as you want i think, you can create new ones and hold on to the pointers of them and then draw/update them as you like.

Calling setPosition for a node with a collision animator should update the vertical position according to the level, yeah, applying gravity if it's above or pushing the node up if it's in the geometry.
Fascinating!
Thnx!
:D
Daniel FF
Posts: 53
Joined: Tue Feb 19, 2008 7:15 pm

Post by Daniel FF »

HI,

I suppose you will use client/server , am i rigth ? if yes , running graphics in server is a bad idea. You should choose a client point to control and run ai monsters and send informations to server , like position, state , rotation etc...
In my game i have 2 flags : humanPlayerFlag, and remoteFlag , so if a monster is controlled in a client point the flags would be:

humanPlayerFlag = false;
remoteFlag = false;

sorry , my engilsh is realy bad!! :)
WishFish
Posts: 8
Joined: Thu Feb 07, 2008 10:08 am

Post by WishFish »

Daniel FF wrote:HI,

I suppose you will use client/server , am i rigth ? if yes , running graphics in server is a bad idea. You should choose a client point to control and run ai monsters and send informations to server , like position, state , rotation etc...
In my game i have 2 flags : humanPlayerFlag, and remoteFlag , so if a monster is controlled in a client point the flags would be:

humanPlayerFlag = false;
remoteFlag = false;

sorry , my engilsh is realy bad!! :)
Np, i understood you perfectly!
But i see one big downside of that approach.
What happens if that player on that client hit the reset button on his PC?
Monsters controlled by him become stuned? :)
Or server search another node to give him that moster?
Seems like a too much effort to me.
Daniel FF
Posts: 53
Joined: Tue Feb 19, 2008 7:15 pm

Post by Daniel FF »

Yes , In my case i catch clients disconection and server send message to others clients to migrate monster controller. Its easy if use a good network engine.
Post Reply