Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

darkbard

Manageing NPCs out of the screen

This topic is 5386 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys, I posted on Game programming forums asking for a way to manage npcs updateing when they are out of the screen. Someone asked me to use a method that needs to keind of Ai to work. The first AI mange NPCs on the screen, updateing their movement, apparence and so on; the second AI works only for NPCs out of the screen, changeing only basical information in the NPCs-struct. If you want you can read what I wrote here: http://www.gamedev.net/community/forums/topic.asp?topic_id=181591 I''d like to know more information about this tecnique, so I can implement an optimized way to manage npcs out of the screen bye

Share this post


Link to post
Share on other sites
Advertisement
I think that technique is completely dependent of the game. But you can simplify movement/path-smoothing/A*-checking and Collision Detection for off-screen characters.

if( pChar->Visible() )
{
UpdatePath();
SmoothPath();
CheckCollision();
}
else
{
UpdatePath();
CheckSimpleCollision();
MoveChar();
}

AI Game Programming Wisdom has a nice article about this subject. It describes different Level of detail to use on the ai.

----------------------------------------------
Petter Nordlander

"There are only 10 kinds of people in the world. The who understand binary and those who don''t"

Share this post


Link to post
Share on other sites
The kicker is the level of detail. For the most part, if there is something you can''t see, you don''t need to know what it looks like. However, you DO need to know where it is so that you can determine when you will be able to see it again. Also, if the NPCs that are off the screen can respond to things that are happening, you need to be able to still include them in your checks for these actions. For example, if they can respond to something that is happening on the screen... a sound, combat, etc. you will need to have them still check for that so that they can do whatever you tell them to... such as run TOWARDS the view area.

Dave Mark - President and Lead Designer
Intrinsic Algorithm -
"Reducing the world to mathematical equations!"

Share this post


Link to post
Share on other sites
Ok, I tried, and it seems to work.

I included also "ability" to here sounds and be allerted and also the "ability" to be hitten by ranged weapons that strike also out of the screen.

I switch to first Ai class when the NPCs enter the screen, and I switch to the second one (that does not manage apparence and other things) when they leave the screen.

It seems to work correctly for my game engine.

I''ve to improve it a lot, because is not fast enaught to manage a lot of NPCs, but it''s OK.

In a multiplayer game, NPCs-status changeing must be managed by the server??
Must the server tell to the clients changes in NPCs status, so, if someone is in the area where and NPC appears, the client can manage correctly what it is doing?

bye

Share this post


Link to post
Share on other sites
quote:
Original post by darkbard
Ok, I tried, and it seems to work.



Good to hear!

quote:
Original post by darkbard
I included also "ability" to here sounds and be allerted and also the "ability" to be hitten by ranged weapons that strike also out of the screen.



You can think of it like this... there is actually a large world out there with all of the interactions going on that are handled by your game engine. There is also a small part of that world that you have a window into. As InnocuousFox pointed out, you generally need to adjust the level of computational detail based on whether an activity is within your view window of the world or not... and whether, if the event is outside, it is necessary to handle it.

quote:
Original post by darkbard
In a multiplayer game, NPCs-status changeing must be managed by the server??



If you leave it up to the client, it leaves your game open to be hacked by false clients.

quote:
Original post by darkbard
Must the server tell to the clients changes in NPCs status, so, if someone is in the area where and NPC appears, the client can manage correctly what it is doing?



Typically the game client for a Client-Server game handles just three things
1: collection of user inputs
2: transmission of inputs to server and collection of game state from server
3: display of current game state

This minimises the ability for players to hack the game state using a modified client, since all physics and AI is done on the game server.

Cheers,

Timkin

Share this post


Link to post
Share on other sites
quote:
Original post by Timkin
Typically the game client for a Client-Server game handles just three things
1: collection of user inputs
2: transmission of inputs to server and collection of game state from server
3: display of current game state

This minimises the ability for players to hack the game state using a modified client, since all physics and AI is done on the game server.



it seems obvious
I''l try to implementa small server that "thinks" for the NPCs ... if I''ll have some problem, I''ll ask you ...

bye

Share this post


Link to post
Share on other sites
Basically, you are taking the NPC processing that you would do in a single player game and putting it into it''s own ''client''. The only change that you would make is how those NPCs communicate with the game world. Even then, since the server is doing the world calcs and the NPCs are on the server, not much would change. Really, in a client/server multiplayer game, the server side IS the stand alone game and you just need to write remote clients.

Dave Mark - President and Lead Designer
Intrinsic Algorithm -
"Reducing the world to mathematical equations!"

Share this post


Link to post
Share on other sites
I planned to create small client programs that manage AI of NPCs that are importants in my World. These programs should be ran when someone is on the net, and thay manage NPCs making them able to create items, build things, and so on.

Do you think it could work?

I''d like to write this small program to do something like SETI: if someone doesn''t want to play the game, he can only run this very small program to improve realism in my World.

I an NPC isn''t controlled by HIS program, it behaves like the NPC on the other MMORPG ... for example: it only sells things, without creating new one, and so on ...

Share this post


Link to post
Share on other sites
quote:
Original post by darkbard
I planned to create small client programs that manage AI of NPCs that are importants in my World. These programs should be ran when someone is on the net, and thay manage NPCs making them able to create items, build things, and so on.

Do you think it could work?

I''d like to write this small program to do something like SETI: if someone doesn''t want to play the game, he can only run this very small program to improve realism in my World.



You''re asking for a world of torment and heartache here... it would be far too easy for someone to write a hacked AI NPC that destroyed the gameplay experience for your players. You might think that this wouldn''t happen, but trust me, there are people out there whose only happiness comes from the misery of others.

SETI is different in that it works in isolation from the main server, except to update it with the results of its work. It doesn''t need to communicate back to the server in real time and the results don''t affect the data sent out to other clients. Your game, on the other hand, would be different. Your AI clients would perform actions that would affect the game world and thus the data sent to other AI and players. This is very open to corruption.

Timkin

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!