Advertisement Jump to content
Sign in to follow this  
Angus Hollands

NPC / AI should they be abstracted?

This topic is 2194 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
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, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!