Jump to content
  • Advertisement
Sign in to follow this  
Angus Hollands

NPC / AI should they be abstracted?

This topic is 2010 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

Hey everyone! I've finally come close enough to considering networking a game. My question is this:
For a traditional FPS, whereby there may be AI *teammates*, one could use the same class (UserBase) as the other real clients, but replace the networked inputs with simulated ones.
However, this particular game (no surprise here) involves zombies. I originally intended to implement them as a separate team, and network them in the same way as normal players. However, this gives rise to the fact that many packet entries for zombies wouldn't require all the same data as that of a normal player (weapon type, ammo, clip). Do you think that this would be an acceptable solution to take?

My other option would be to split the packet into two parts; Base information and then specific information, but I don't like the sound of that very much
Thank you everyone!

Share this post


Link to post
Share on other sites
Advertisement
Either will work.

Also, you can split packets into separate subtypes, and include a bitmask up front of what subtypes are included. A single byte gives you 8 possible subtypes. Thus, Zombies simply would not send weapon and clip information... unless some zombies have some kinds of weapons ;-)

It's common in "deep inheritance" hierarchies, to marshal the parent class first, then add your own information in the serialized stream. If you use this mechanism for networking, having some parts (movement) in a superclass, and specifics (player vs zombie) in a subclass would work out alright. But I personally don't like deep inheritance -- I much prefer composition.

In a composition system, you pretty much get the same thing, though -- add a "gun and chip" component to players with guns and clips, and a "ooze and brains" component for zombies, or whatever. Marshal (and de-marshal) components in order, and you have the same effect. Use the bitmask to tell which components have updated data, perhaps. Edited by hplus0603

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!