Author Topic: Back after a long brake with some mod plans...  (Read 459 times)

Offline Theundyingcode

  • NPC
  • **
  • Posts: 103
  • Mutant Cyborg With a Nuclear Tank
    • View Profile
Back after a long brake with some mod plans...
« on: September 05, 2017, 05:47:33 AM »
I have been playing CDDA on and off for a long time now (pre-kick-starter).  After coming back to it a week ago I have decided I want to put my mostly completed CS degree to use and take a real stab at improving cataclysm.  I have 2 mods partially planned out that I will (hopefully) be bringing to you soon.  The first is a content addition mod adding a bunch of items and other stuff I want and will allow me to familiarize myself with CDDA's code before moving on to my more complicated project: designating bases and a new @base AI for NPC followers.

Here is a brief overview of what i'm planning (Names subject to change).  I'll make new topics for each of them once I'm a little farther along but I wanted to go ahead and say hi and, let everyone know what I was thinking.

Personal Mobility Mod (Skates and Rollers)
(click to show/hide)

Bases Mod
(click to show/hide)
Mars is currently the only planet populated entirely by robots. Therefore Martian invasion is the same thing as the robots taking over.

Good judgement comes from experience.
And experience?
Well, that comes from poor judgement.

Offline darktoes

  • Zombie Food
  • *
  • Posts: 47
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #1 on: September 05, 2017, 09:28:25 AM »
You mentioned mobility oriented power armor, would there be a possibility of XCom style grappling hooks/jetpacks on that? Because that would be awesome. Especially if the grappling hook could be used as a weapon.

Offline pisskop

  • Survivor
  • ***
  • Posts: 3494
  • So Noble he farts Helium
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #2 on: September 05, 2017, 12:36:11 PM »
any improvement to the ai is welcome, I say

Offline Theundyingcode

  • NPC
  • **
  • Posts: 103
  • Mutant Cyborg With a Nuclear Tank
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #3 on: September 05, 2017, 09:38:23 PM »
You mentioned mobility oriented power armor, would there be a possibility of XCom style grappling hooks/jetpacks on that? Because that would be awesome. Especially if the grappling hook could be used as a weapon.

I agree that it would be awesome however, I would also be a lot of work since you would need to create the mechanics from scratch and I would much rather spend that time one the base AI.
Mars is currently the only planet populated entirely by robots. Therefore Martian invasion is the same thing as the robots taking over.

Good judgement comes from experience.
And experience?
Well, that comes from poor judgement.

Offline WIndburns

  • NPC
  • **
  • Posts: 189
  • I Squeeze Cats!
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #4 on: September 07, 2017, 12:11:10 AM »
some neat ideas :)
The main difference is we focus on content and internal systems

Offline Metalsoul112

  • Zombie Food
  • *
  • Posts: 4
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #5 on: September 07, 2017, 02:14:53 AM »
Pull off the a good AI and you will be a legend here, I for one can't stand how dumb NPCs are in the current version. Though they have gotten better in the past couple years!

Offline Theundyingcode

  • NPC
  • **
  • Posts: 103
  • Mutant Cyborg With a Nuclear Tank
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #6 on: September 07, 2017, 08:43:14 PM »
After spending a few hours reading the source code I have reached the conclusion that adding items that alter player movement speed requires direct modification of the actual calculation code and therefore is impossible (or at least annoyingly difficult) to do in the form of a mod.  (I haven't done more than minor edits in c++ or lua but I have worked in C and so many other languages I can read them just fine)  I have some ideas what to do but that is going to be a github discussion though.

On the other hand,  i'll have a project outline for the base AI in the next couple days. (assuming of course I stop actually playing cdda for a while and don't decide to change everything... again)
Mars is currently the only planet populated entirely by robots. Therefore Martian invasion is the same thing as the robots taking over.

Good judgement comes from experience.
And experience?
Well, that comes from poor judgement.

Offline NuG

  • NPC
  • **
  • Posts: 230
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #7 on: September 07, 2017, 09:44:00 PM »
I really like the idea of better NPC AI and base mechanics and am excited to see it get fleshed out, best of luck to you and thanks for contributing!

Offline darktoes

  • Zombie Food
  • *
  • Posts: 47
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #8 on: September 08, 2017, 10:22:14 AM »
You mentioned mobility oriented power armor, would there be a possibility of XCom style grappling hooks/jetpacks on that? Because that would be awesome. Especially if the grappling hook could be used as a weapon.

I agree that it would be awesome however, I would also be a lot of work since you would need to create the mechanics from scratch and I would much rather spend that time one the base AI.
Would it be possible to use the grabbing mechanic from those zombies that grab you from a few tiles away and pull you toward them? You could try using teleporting for the getting around part, but I dunno if it would be possible to limit it to only near walls.

Offline Theundyingcode

  • NPC
  • **
  • Posts: 103
  • Mutant Cyborg With a Nuclear Tank
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #9 on: September 08, 2017, 02:25:08 PM »
You mentioned mobility oriented power armor, would there be a possibility of XCom style grappling hooks/jetpacks on that? Because that would be awesome. Especially if the grappling hook could be used as a weapon.

I agree that it would be awesome however, I would also be a lot of work since you would need to create the mechanics from scratch and I would much rather spend that time one the base AI.
Would it be possible to use the grabbing mechanic from those zombies that grab you from a few tiles away and pull you toward them? You could try using teleporting for the getting around part, but I dunno if it would be possible to limit it to only near walls.

Personally, I would go the route of using the firing mechanic to shoot the grapple and than the vehicle's move mechanic for the pull.  This way, you don't need to worry about aiming as it will get auto updated (looking forward to z-level aiming... got my plans to build a tower) and you get the collision mechanic for all the Z's (or other stuff) in the move path.  A weight comparison possibly influence by terrain and MAYBE somewhat by strength would determine if you or the Z you shot the face moves.  Later, someone could go back and use the fire animation to draw the chain and if they want to be really fancy make it so you fire once to shoot it and fire again to reel so you can use it as a trip rope/ barricade.

Your welcome to add it i'm going to spend my time playing or working on the AI and possibly overhauling the movement calculation to make it more flexible and streamlined.
Mars is currently the only planet populated entirely by robots. Therefore Martian invasion is the same thing as the robots taking over.

Good judgement comes from experience.
And experience?
Well, that comes from poor judgement.

Offline darktoes

  • Zombie Food
  • *
  • Posts: 47
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #10 on: September 08, 2017, 10:46:17 PM »
You mentioned mobility oriented power armor, would there be a possibility of XCom style grappling hooks/jetpacks on that? Because that would be awesome. Especially if the grappling hook could be used as a weapon.

I agree that it would be awesome however, I would also be a lot of work since you would need to create the mechanics from scratch and I would much rather spend that time one the base AI.
Would it be possible to use the grabbing mechanic from those zombies that grab you from a few tiles away and pull you toward them? You could try using teleporting for the getting around part, but I dunno if it would be possible to limit it to only near walls.

Personally, I would go the route of using the firing mechanic to shoot the grapple and than the vehicle's move mechanic for the pull.  This way, you don't need to worry about aiming as it will get auto updated (looking forward to z-level aiming... got my plans to build a tower) and you get the collision mechanic for all the Z's (or other stuff) in the move path.  A weight comparison possibly influence by terrain and MAYBE somewhat by strength would determine if you or the Z you shot the face moves.  Later, someone could go back and use the fire animation to draw the chain and if they want to be really fancy make it so you fire once to shoot it and fire again to reel so you can use it as a trip rope/ barricade.

Your welcome to add it i'm going to spend my time playing or working on the AI and possibly overhauling the movement calculation to make it more flexible and streamlined.
I'm not a modder in the slightest, unfortunately. I was just helping to brainstorm.

Offline RedPine

  • Zombie Food
  • *
  • Posts: 71
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #11 on: September 10, 2017, 03:52:51 PM »
> Rollerpons

I want this so bad.  Switching between rollerskates and hiking boots is a time consuming process that can easily kill a skater that gets cocky (assuming they even have enough inventory space for spare shoes)

Suggestion: wearable shoes.  Tie shoes to your pack/belt using the laces.  This would effectively make carrying normal shoes cost encumbrance and weight but not cost any volume.  Vital, as a skater who doesn't have a backpack yet really, really needs an easy way to carry a spare set of shoes around.  This feature alone would add this mod to my must-haves list.

> Base AI

THIS is the way to make AI: divide, simplify, and conquer.  If you can accomplish the following you will be put on must have list:

NPCs defend base (and no zombies/wildlife spawn inside base)
NPCs are automatically hostile to hostile NPCs (and hostile NPCs cannot spawn within 2 overmap tiles of base)
NPCs automatically "defend" my base from NON hostile NPC looters (non hostile NPCs cannot spawn in base, and never path into the base)
NPCs feed themselves from communal stockpile
NPCs heal themselves from communal stockpile (ESPECIALLY disinfect, radiation, and other status effects)
NPCs rearm from communal stockpile (Only for grabbing ammo/throwables, they shouldn't grab weapons - I'll manually give them appropriate weapons.  There are MANY reasons they should use a weapon the AI considers "inferior" (ammo availability and ease of crafting, roleplay, weapons with special attributes like reach/range/block/martial arts, terrain, noise, common enemy types in current biome, and a dozen other variables that no AI could possibly take into account)).

The above is what I consider the bare minimum to make NPCs viable, and should be prioritized above everything else.  Making a populated home that feels safe and sustainable would be an incredibly luxury in the Cataclysm (until a horde of worms invade but let's try not to think about that...)

Secondary goals: NPCs repair/reinforce clothing, automatically crafting items as they run out (ex: if we have less than 200 arrows, craft more).  This would turn NPCs from being attention hogs to a glorious convenience.

Stretch goals: Jobs, like producing loot on simulated hunting/scavenging trips (especially tedious stuff like gathering rocks, foraging bushes, hunting small game, fishing, etc), simulate looting tiles that you designate with overmap notes, tell follower(s) to pick up everything on a specific tile, tell follower(s) to dump all non essential loot into communal storage, large scale raids on your base (ideally give 1-2 day warning that "a giant horde/gang is coming"), etc. 

Honestly, there are only two mistakes you can make here: Getting too ambitious and burning out, and trying to make the AI too smart instead of letting the player tell the NPCs what to do.

Offline Theundyingcode

  • NPC
  • **
  • Posts: 103
  • Mutant Cyborg With a Nuclear Tank
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #12 on: September 10, 2017, 09:52:16 PM »
> Rollerpons

I want this so bad.  Switching between rollerskates and hiking boots is a time consuming process that can easily kill a skater that gets cocky (assuming they even have enough inventory space for spare shoes)

I really do want them but I still can't figure out how the rollerskates/blades movement is implemented (it's not in the base move speed function or anywhere else logical).  Hard coding them into the move speed function would be very straight forward but than your just asking for conflicts to happen if you can't put all the movement items in one place.  Personally, i'd like to overhaul the movement stuff to have a movement speed modifier(s) instead of a bunch of if statements.  That way adding movement speed items would be easy, the game would run faster (take slightly more memory but eliminate need to redo calculation every turn) and most importantly, the @ screen could then show you, your action speed, movement speed and the base terrain movement cost so you can figure out if you will be able to run.  However, I am still not familiar enough with the code to try attempting it as it probably has dependencies all over the place(ugg trying to explain code changes... I can give a more technical code explanation of my thoughts elsewhere if anyone's interested)

Quote
Suggestion: wearable shoes.  Tie shoes to your pack/belt using the laces.  This would effectively make carrying normal shoes cost encumbrance and weight but not cost any volume.  Vital, as a skater who doesn't have a backpack yet really, really needs an easy way to carry a spare set of shoes around.  This feature alone would add this mod to my must-haves list.

That [SHOULD] be fairly straight forward as so many other things are wearable you just need to copy tags and what not.  Better yet, see if you can have them put onto backpacks (sheath mechanic) with a small increase in encumbrance rather than taking up you "strapped" slot.

Quote
THIS is the way to make AI: divide, simplify, and conquer.  If you can accomplish the following you will be put on must have list:

This is what i'm doing. I made an outline in word and kept adding layers until it reached methods and then copied them over as TODO methods.  I was thinking about posting the higher levels of it (idea parts not the implementation part) to get feed back...

Quote
NPCs defend base (and no zombies/wildlife spawn inside base)
NPCs are automatically hostile to hostile NPCs (and hostile NPCs cannot spawn within 2 overmap tiles of base)
NPCs automatically "defend" my base from NON hostile NPC looters (non hostile NPCs cannot spawn in base, and never path into the base)
Hadn't specifically included these.  Was just planning on copying IFF from normal npc AI. No spawning is a good Idea. Kill bandits as well. Kinda want to leave the personal issues hostility be though.

Quote
NPCs feed themselves from communal stockpile
NPCs heal themselves from communal stockpile (ESPECIALLY disinfect, radiation, and other status effects)
NPCs rearm from communal stockpile (Only for grabbing ammo/throwables, they shouldn't grab weapons - I'll manually give them appropriate weapons.  There are MANY reasons they should use a weapon the AI considers "inferior" (ammo availability and ease of crafting, roleplay, weapons with special attributes like reach/range/block/martial arts, terrain, noise, common enemy types in current biome, and a dozen other variables that no AI could possibly take into account)).

automatically crafting items as they run out
Already in the plan except, the way i'm planning it you will get a lot more input into their load out decisions (Please don't use X ammo, go for Y ammo if you can etc.) but at the end of the day, they are your followers, not your mind controlled drones.  They have a will of their own and should act as they believe is best for their survival. If you stock piled guns and than handed me a cudgel, I wouldn't try to beat down a Zombie Hulk, i'd pick up the biggest gun you had and shoot it in the face.  Why shouldn't the NPCs do the same?  Maybe as a future goal have loyalty determine their willingness to follow orders/ increase weight of player wishes?
Mars is currently the only planet populated entirely by robots. Therefore Martian invasion is the same thing as the robots taking over.

Good judgement comes from experience.
And experience?
Well, that comes from poor judgement.

Offline Zhilkin

  • NPC
  • **
  • Posts: 167
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #13 on: September 11, 2017, 08:16:41 PM »
https://github.com/CleverRaven/Cataclysm-DDA/blob/44d7c843ff59601d058180700b7ae2058ceb09cd/src/player.cpp#L2009-L2024

Code: [Select]
    if( is_wearing( "roller_blades" ) ) {
        if( on_road ) {
            movecost *= 0.5f;
        } else {
            movecost *= 1.5f;
        }
    }
    // Quad skates might be more stable than inlines,
    // but that also translates into a slower speed when on good surfaces.
    if( is_wearing( "rollerskates" ) ) {
        if( on_road ) {
            movecost *= 0.7f;
        } else {
            movecost *= 1.3f;
        }
    }

Offline darktoes

  • Zombie Food
  • *
  • Posts: 47
    • View Profile
Re: Back after a long brake with some mod plans...
« Reply #14 on: September 12, 2017, 03:23:18 AM »
Speaking on NPCs, I'd like to add something if you haven't already thought of it: I'd really like to be able to leave a pile of books somewhere and have NPCs automatically learn skills from them. Especially if I could separate NPCs into fighters (learn dodge, gun skills and melee skills), scavengers (Learn mechanics for lockpicking, survival, driving and some combat skills) and crafters (learn the crafting skills). This would let NPCs prioritise what you want them to learn and stop Steve the 13 strength 6 intelligence juggernaut from trying to learn electronics.

Once they've got their skills up, it'd be nice to give a set of stockpile instructions for crafters. For example, I want 10 poppy painkillers, 10 Prussian blues and 10 first aid kits at all times. Crafters would fulfill these instructions, scavengers could focus on raiding areas with these things and fighters might go to the effort of looting corpses for them.