You seem fresh on CataDDA forums; navigate your way through Git Branch and share whatever insight with developers. One thing I know, they would appreciate it.
In 50 minutes Iâll basically be gone on Thanksgiving holiday stuff until this weekends, so it will be out of my thoughts until then, yeah, as I wonât be near my computer. I might end up doing some json stuff on someone elseâs, but real coding and stuff will wait.
But the plan right now is essentially to build them from scratch, and to try and get the new model to share a parent with the player model instead of repeating a bunch of code. Weâd like to have different AIâs that we can hook in, to get NPCs that have noticeably different behaviour. Beyond that, like I said, the last plan for doing that I came up with was overly ambitious and kind of garbage, so the immediate plan is just to create a parent class for the player character, an npc class that inherits from it, and to get those NPCs to appear on the map as dumb objects.
@vultures: thanks, but the link you gave me leads to Jenkins. you wouldnât happen to have a link to this particular discussion?
I guess Iâll just go through the discussion when I find it, and then maybe make a branch and give refactoring a go.
I suggest completely avoiding any kind of party behavior for now - no following the player, no taking orders. A good simple beginning would best best:
- believable hostile to player and hostile to mobs combat behavior.
- believable dialogue and neutral behavior to player
- quest givers and receivers
- trade
- insert into the game in stationary locations.
Iâd like to contribute to this. I have limited skill with C++, although I understand the basic structure, I would just need to look up a lot of the stuff weâre using to actually understand how the code works, as Iâve only ever done very basic C++.
Mmmm mmmm NPCs! I want them far far more than z-levels
Anyway, perhaps now may be the time to address the issue where NPCs seem invincible sometimes because the torso or head must be killed and repeated leg/arm shots when legs and arms are already 0hp doesnât harm them? Maybe the idea where a 0hp limb that gets hit gets dismembered could be a fix, but as it is right now player character is tied to the same ruleset the NPCs are, so its shared arm/leg invincibility
[quote=âmoist_zombie, post:46, topic:3188â]Mmmm mmmm NPCs! I want them far far more than z-levels
Anyway, perhaps now may be the time to address the issue where NPCs seem invincible sometimes because the torso or head must be killed and repeated leg/arm shots when legs and arms are already 0hp doesnât harm them? Maybe the idea where a 0hp limb that gets hit gets dismembered could be a fix, but as it is right now player character is tied to the same ruleset the NPCs are, so its shared arm/leg invincibility :D[/quote]
Well, this is a little off topic anyway, but we could use a negative HP system - or at least make the current threshold for a broken limb not be the lowest that limbâs health can go, because it seems a little ridiculous to be dismembered when you break an armâŚ
Yeah⌠Dismemberment is kind of traumatic Perhaps just pull torso hp when broken/0hp limbs take damage?? But with an entire rewrite npcs might not even be considered player-type constructs afterward, nullifying this whole issueâŚ
So! It may be ugly, it may depend on tons of technically nonfunctioning shims, and it may disable every technique and melee special effect currently in the game, but Iâve gotten players and monsters to use the same base class in melee combat! This is just the first step we need to take in order to unify everything together into one class hierarchy (which is itself just the first step to writing functioning NPCs), and it probably sucks, but hey, progress is progress.
Feast your eyes upon it here: https://github.com/swwu/Cataclysm-DDA/tree/creature-rework
Or donât, because itâs ugly as hell.
Stuff:
[ul][li]The new base class is called âcreatureâ (as discussed here and on dev IRC), in creature.cpp/h.[/li]
[li]Combat refers to creature instead of player/monster, cutting the melee combat loc in two.[/li]
[li]It compiles! In fact, it might even not segfault![/li]
[li]Thereâs tons of non-functioning function stubs all over the place to make the damn thing compile.[/li]
[li]As mentioned, basically every single technique and melee special effect is disabled in that code, because they rely on diseases or effects depending on player or monster, so weâll need to merge diseases and effects into a single system before those can be made to work again.[/li]
[li]Also, the playerâs armor is always set to 0 for melee attacks, because lazy stub function.[/li][/ul]
Iâve been working on the same thing today. However, I stumbled across some circular dependencies in the code. Though it is outside the scope of a NPC rework, Iâm gonna try to resolve these for overall code maintainability.
Heruedhel: I can give you push on my repo if you want and we can use that as the staging until Glyph gets back from his vacation? Not sure how extensive your changes will be but it might be nice to not have to merge them (twice).
Another possibility to consider is whether we should try to make NPCs actually function concerning all the Faction stuff thatâs already in-game from good olâ Whales days⌠Iâve always liked it, myself. Could be used as a roadmap of sortsâŚ
Iâm not sure itâs good to have factions immediately after cataclysm. They should arise after youâve played some.
What about making them spawn ONLY after a year of playing plus exploring a lot. They would have bases like the factions in Stalker or just groups of people?
We wonât even be thinking about factions and stuff just yet. This is just getting the foundations stable.
Thanks for all your work, guys - your code certainly IS ugly, swwu, but that doesnât stop it from being beautiful.
So now what we need is to create a base class for Player that is a child of Creature, but can also be a parent to the NPC.
So that we can collaborate more easily, would you guys want access to the CleverRaven repo, and then we can push up a dev branch for the NPC rewrite, but we can still all basically work with and stay up to date with the most recent branch?
Alternatively, we could just work off swwuâs repo, which would be fine.
are you going to json the npcs? I belive the discussion was in part around
- mob type monsters
- npc types that wear equipment and have interactions.
is that correct?
Either sounds fine to me. It might make more sense to have the new branch be on main repo (just so it will be easier to find for anyone who wanders in later) but itâs not super important to me, whicheverâs more convenient for you guys.
I should have shared effects/diseases for the base creature class in by tonight and then we can start planning out how to actually do NPC things after?
re: factions, yeah, from where Iâm looking at the code from here they are probably going to be a long ways off
I want to help! I just need to know what there is to be done.
i donât even know what this would mean, honestly? But at least some NPC definitions will end up existing in the JSON so I can fill the kickstarter rewards.
Okay, all monster effects now use the new effects system (although in name only, since their processing/whatever is still done in exactly the same way, and we wonât be able to really change that until player diseases get fully ported). Both players and monsters now also use the âdownâ and âstunâ effect (rather than disease) so some of the combat is back. The rest of the player diseases are still⌠being worked on - in general the handling of player diseases is a lot looser than the handling of monster effects, so theyâre more difficult to track down (some of them also hit bodyparts, which means effects will have to be bodypart-aware, even if most monsters wonât actually have multiple bodyparts).
Should be up on my repo now (https://github.com/swwu/Cataclysm-DDA/tree/creature-rework), I cheated my skills to 10 and managed to kill a few hundred Zs with various weapons without any segfaults, so hopefully itâs sorta stable.