ID:161145
Jun 11 2008, 6:56 pm
|
|
how would a go about making a decent NPC system? It seems like everytime i make one garthor goes and crits it till its dust.
|
In response to GhostAnime
|
|
I don't hate him, He's just a little harsh >.<; I want cliche, AI, if anyone in area, attack else wander. just in the "advanced" mannor.
|
In response to Tubutas
|
|
When you say advanced, what do you mean?
|
In response to Dead_Demon
|
|
more complex than a while loop with a bucnhs of ifs... to tell the truth i don't even know what im looking for. Just an AI, thats not-bad.
|
In response to Tubutas
|
|
Tubutas wrote:
more complex than a while loop with a bucnhs of ifs... Thats all AI ever is, more ifs are what makes it more complex. ALSO, I dont recomend having your AI mindlessly wander around as it tends to cause lag |
In response to Falacy
|
|
if im only gonna have 25 Mobs with AI on a map at anytime i wouldn't worry about lag xD.
|
In response to Tubutas
|
|
Pertinent question:
If nobody's in the area, why should they wander about? There's nobody around to appreciate it. |
In response to Garthor
|
|
It depends on your reasons. My Life As A Spy used it to make the 'informants' - NPCs that you needed to find to complete certain missions - harder to find. You could have a wandering salesman that sells valuable items as well. If you're making a hunting game, you wouldn't want deer to stand there and suddenly start wandering once a hunter shows up. The list goes on.
|
In response to Darkmag1c1an11
|
|
Bingo! xD. its no fun if the mobs standing still till you get in view then it starts running away.(even though that is kinda realistic I.E. Drug Dealers only skip town when the cops are near.) Im just looking for an example of a good AI not a debate.
|
In response to Tubutas
|
|
Tubutas wrote:
Im just looking for an example of a good AI not a debate. The problem is a good AI is specifically designed for a game. That drug dealer could opt to shoot at the cops instead of run away, what would cause him to do such? Maybe he has body armor on that gives him more confidence in himself being able to win the shootout. Maybe his childhood friend and current companion has hurt his leg and can't run away so he tries to keep him out of prison. |
In response to YMIHere
|
|
*bangs head on keyboard* *deep breath*. Can any one just show me an example of non-crappy AI. >_>; almost the complete opposite of http://www.byond.com/developer/Tubutas/AIsystem
|
In response to Darkmag1c1an11
|
|
This still kind of misses the point. There is often no good reason to have the NPC periodically do actions such as move around if there is no player in the vicinity. If you want the effect of realism where people move over time instead of remaining in the same spot or some such, then simply simulate it (when a player enters the vicinity after no player being in it for a while, move (instantly) the monsters around to new locations, so it appears as if they've been moving around).
In actuality, games that aim to be more realistic and therefore have lots and lots of population (NPCs) can't afford to have them all moving around all the time. |
In response to Kaioken
|
|
Gawd, you guys are missing the point. It doesn't matter whether or not the monsters move >_>; what makes an ai good -.-'
|
In response to Tubutas
|
|
What makes an AI "good" is that your program every instance of what you want to happen. EVERYTHING. Then think about what they do - that's what'll help make it good.
Compare these four: 1) AI/New() AI_ON() // Activation step 2) AI/New() AI_ON() // Activation step 3) Player/Move() // Activation step 4) area/ZoneOfDoom Lets go through the four examples and note what's wrong: 1 & 2) They both have AI_ON() called when created. Every 1 minute (~600 ticks), they both say "Hi!". Difference is that 1) looks for every single /Player where as 2) says it to anything that will "hear" it, per say. This is useless if you think about it. The procedure always remains on and every minute: (1) will keep searching for /Player in range and output Hi (2) it'll just say "Hi!", despite if anyone is there. You can see how much resource is wasted, especially in the case of (1) where it'll loop for any /Player. 3) This AI is activated when a /Player moves within 20 steps of the AI and is deactivated when it cannot locate any/Player in 20 steps (through the active variable). Once activated, it'll keep saying Hi to anyone within 20 steps every minute (which means someone must be there, if the AI moved successfully before the message)! Note that it walks randomly and stops when it no longer is activated. And the /Player may wonder where the person is, as they would most likely be out of view :P 4) This is the first step towards an "intelligent AI". The AI is activated when someone Entered() the /area/ZoneOfDoom where the AI is located and is stopped when no /Player remains there. This does not waste as much resource as step 3, which looks for /AI or /Player every step taken! Of course, if someone have their loc forcefully changed (rather than calling Move()), Entered/Exited will not be called. When the AI is activated, it'll walk randomly. If it meets someone directly in front of it, it'll say "Hi!". If the same person comes in front of it, the AI will say nothing (because it already said hi before!)... unless that person is an Admin :P Of course it'll waste some resource as it is looking for a /Player every step but you can see that it became a bit more intelligent than #1 and 2. Especially if the /Player is an Admin :P [That's a BYOND Life reference btw] |
In response to GhostAnime
|
|
Thanks for actually answering my question XD. now i have ana of idea of what to do.
|
In response to Tubutas
|
|
It seems you're the one who's missing the point. You're asking what makes an AI good, and this is what we discussed (my and Garthor's point being an AI is better if it doesn't do useless work). It also seems like we both (you and I) have no idea what you're asking. First you've asked what makes an AI good, which belongs in the Design Philosophy section, then you asked how to program one without a while() loop or something, and now you apparently want a coded example of AI in general, and payed little to no attention to anyone who has posted on the subject of AI so far. What exactly are you after here? Anyway, you can't have an AI without any loop. You need it to repeat itself so your NPC can do more than 1 action or 1 set of actions per whole game session.
But either way really, I didn't reply to you, so there wasn't much need to make a useless reply to me. |
And don't hate Garthor, take his advice/criticism, he knows his stuff.