Mob status
#62
I am considering refactoring the current mob architecture to avoid reaching a big ball of mud. I believe an inheritence tree is not the best tool for modeling the mobs. Some problems:
- The current code is hard to follow.
- The state system does not cover all use cases and has to be supplanted by flags (isInLove and the like).
- Wolves can't breed, because they do not inherit cPassiveMonster.
- Many mobs have methods/fields they'll never use because cMonster is fat. I believe cMonster is fat because people in the past solved inheritence related problems by moving code upstream. For instance, I can solve the wolf breeding problem by putting the breeding code in cMonster, but then zombies would have more stuff they don't use. For the sake of long term maintainability, I believe the issue should be solved at its core, and the inheritence model should be ditched.

I'm still cooking a solution in my head but here are the initial thoughts: I'm considering a state-machine like architecture, where there's a common state map, but each mobtype has only some of the states enabled (and some states have parameters, e.g. bait type). See attached photo (mutable, likely to change).

With this architecture, each mobtype is defined solely by its enabled state combination and their parameters. (And possibly few exceptions like overriding some transitions between states (e.g. wolf idle > attacking requires sending the angrywolf packet).


Attached Files Thumbnail(s)
   
Reply
Thanks given by:


Messages In This Thread
Mob status - by LogicParrot - 05-01-2015, 04:54 PM
RE: AI Reborn - by tonibm19 - 05-01-2015, 07:30 PM
Breeding todo'ed - by LogicParrot - 05-01-2015, 07:32 PM
RE: AI Reborn - by Seadragon91 - 05-01-2015, 08:28 PM
RE: AI Reborn - by worktycho - 05-01-2015, 09:16 PM
Merged - by LogicParrot - 05-01-2015, 10:34 PM
RE: Mob status - by Jammet - 05-07-2015, 02:27 AM
RE: Mob status - by LogicParrot - 05-08-2015, 10:58 PM
RE: Mob status - by NiLSPACE - 05-07-2015, 05:52 AM
RE: Mob status - by Jammet - 05-08-2015, 11:03 PM
RE: Mob status - by sphinxc0re - 05-09-2015, 01:32 AM
RE: Mob status - by LogicParrot - 05-25-2015, 03:08 AM
RE: Mob status - by Jammet - 05-25-2015, 06:42 PM
RE: Mob status - by Jammet - 05-27-2015, 03:44 AM
RE: Mob status - by LogicParrot - 05-27-2015, 05:33 PM
RE: Mob status - by Jammet - 05-27-2015, 08:11 PM
Reproduce? - by LogicParrot - 05-27-2015, 11:47 PM
RE: Mob status - by Jammet - 05-27-2015, 11:50 PM
RE: Mob status - by LogicParrot - 05-27-2015, 11:55 PM
RE: Mob status - by Jammet - 05-27-2015, 11:57 PM
RE: Mob status - by LogicParrot - 05-28-2015, 12:42 AM
RE: Mob status - by Jammet - 05-28-2015, 01:37 AM
RE: Mob status - by LogicParrot - 05-28-2015, 04:58 PM
RE: Mob status - by Jammet - 05-28-2015, 05:25 PM
RE: Mob status - by LogicParrot - 05-28-2015, 05:53 PM
RE: Mob status - by bearbin - 05-28-2015, 05:59 PM
RE: Mob status - by LogicParrot - 05-28-2015, 06:00 PM
Skeleton diagnosis - by LogicParrot - 05-28-2015, 10:51 PM
RE: Mob status - by xoft - 05-29-2015, 12:58 AM
RE: Mob status - by worktycho - 05-29-2015, 01:37 AM
RE: Mob status - by LogicParrot - 05-29-2015, 02:03 AM
RE: Mob status - by worktycho - 05-29-2015, 02:26 AM
RE: Mob status - by LogicParrot - 05-29-2015, 02:28 AM
RE: Mob status - by LogicParrot - 05-29-2015, 02:47 AM
RE: Mob status - by worktycho - 05-29-2015, 03:00 AM
RE: Mob status - by jan64 - 05-29-2015, 04:53 AM
RE: Mob status - by LogicParrot - 05-29-2015, 05:21 AM
RE: Mob status - by Jammet - 05-29-2015, 05:35 AM
RE: Mob status - by LogicParrot - 05-29-2015, 05:43 AM
RE: Mob status - by xoft - 05-29-2015, 06:18 AM
RE: Mob status - by LogicParrot - 05-29-2015, 07:26 AM
RE: Mob status - by xoft - 05-29-2015, 04:34 PM
Dijkstra considerations - by LogicParrot - 05-29-2015, 06:37 PM
RE: Mob status - by LogicParrot - 05-29-2015, 06:49 PM
RE: Mob status - by xoft - 05-29-2015, 07:42 PM
RE: Mob status - by LogicParrot - 05-29-2015, 07:51 PM
RE: Mob status - by Jammet - 05-29-2015, 07:52 PM
RE: Mob status - by LogicParrot - 05-29-2015, 08:03 PM
RE: Mob status - by ReonBalisty - 05-30-2015, 05:27 AM
RE: Mob status - by LogicParrot - 05-30-2015, 08:17 AM
RE: Mob status - by LogicParrot - 05-30-2015, 08:44 PM
RE: Mob status - by Jammet - 05-30-2015, 08:58 PM
RE: Mob status - by warmist - 06-16-2015, 03:13 AM
Breeding implemented - by LogicParrot - 11-30-2015, 05:05 PM
RE: Mob status - by Jammet - 12-07-2015, 10:36 PM
RE: Mob status - by LogicParrot - 01-12-2016, 07:11 PM
RE: Mob status - by LogicParrot - 01-12-2016, 10:49 PM
Spawn distance - by LogicParrot - 01-13-2016, 12:55 AM
RE: Mob status - by Jammet - 01-13-2016, 01:49 AM
RE: Mob status - by xoft - 01-13-2016, 03:02 AM
Ball of Mud - by LogicParrot - 01-15-2016, 11:44 PM
RE: Mob status - by xoft - 01-16-2016, 12:13 AM
RE: Mob status - by LogicParrot - 01-16-2016, 03:37 AM
RE: Mob status - by xoft - 01-16-2016, 06:59 AM
RE: Mob status - by LogicParrot - 01-17-2016, 12:14 AM
Smart dogs and spiders - by LogicParrot - 01-23-2016, 05:31 AM
RE: Mob status - by Jammet - 01-23-2016, 11:02 AM
RE: Mob status - by warmist - 03-04-2016, 07:24 PM
RE: Mob status - by LogicParrot - 03-28-2016, 10:29 PM
RE: Mob status - by Jammet - 03-28-2016, 10:30 PM
RE: Mob status - by LogicParrot - 03-28-2016, 10:31 PM
RE: Mob status - by LogicParrot - 04-15-2016, 04:25 AM
RE: Mob status - by hangyas - 09-11-2016, 07:25 AM
RE: Mob status - by LogicParrot - 09-11-2016, 05:56 PM
RE: Mob status - by LogicParrot - 08-05-2017, 10:00 PM



Users browsing this thread: 1 Guest(s)