Author Topic: Bases and NPC crafting  (Read 2211 times)

Offline Theundyingcode

  • NPC
  • **
  • Posts: 157
  • Mutant Cyborg With a Nuclear Tank
    • View Profile
Bases and NPC crafting
« on: September 13, 2017, 02:48:35 AM »
The following link is the upper levels of my CURRENT outline for implementing bases and a "Base Mode" NPC AI to match for the community's perusal (Just the what's planned part not the implementation; I'm not ready to open that up).  At this point I am still very much in the planning stages and will gladly take any feedback, ideas or concerns people might have (not going to say anything in regards to considering it for longer than it takes to read though).  This is already rapidly turning into a major undertaking so I would appreciate comments being focused on the core framework rather than the extras as those can always be added at a later date. Also, don't expect me to be done with it in a week, I'm just starting and still want to do other things with my life like play CDDA.

It is a Microsoft Word Outline so it looks a little weird in google but i'm not bothered to change that.  Have a good read!

https://drive.google.com/open?id=0B7yArTwxOX4GbGlzaFZMQ3picWc

For you more code savvy people:
  • I basically kept adding layers to this outline until I got to individual methods.
  • The AI is going to work by making priorities from a bunch of maps.  It's very memory heavy (relatively, unless someone debugs hundreds of followers it won't matter much) but fast.  Also, it's very easy to tweak. (Probably could put every variable you could possibly want to tweak in one file)
  • Once I get the framework a little bit more solid I would be grateful for any collaborators especially because:
  • While I have worked in 6 or so languages C++ is not one of them (c is though). Probably going to write a bunch of sudo code and try and translate it when I'm done so I don't get bogged down in syntax
  • I have no friends... lol... ๐·°(৹˃̵﹏˂̵৹)°·๐ -determined not to cry
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 Theundyingcode

  • NPC
  • **
  • Posts: 157
  • Mutant Cyborg With a Nuclear Tank
    • View Profile
Re: Bases and NPC crafting
« Reply #1 on: September 13, 2017, 07:07:32 AM »
Probably should have started with this but...

SUMMERY OF MAIN PLANNED FEATURES:
  • Designate a building as "home base" by sticking a notice board on the wall through which you can post rules for the NPCs. (rationing of food, ammo and first aid; construction plans) Also, check status of base and NPC complaints
  • Mark lockers and other storage furniture as yours and NPCs won't touch anything there
  • They demand a place to sleep and put their own stuff though
  • Mark things as Communal and NPCs will feed, medicate, equip and reload themselves from there
  • Deposits unwanted stuff there as well causing NPCs to trade among themselves
  • NPCs WILL CRAFT STUFF THEMSELVES. Not just help you.
  • leave crafting priorities and basic construction plans for them to follow while your gone
  • Instruct each individual NPC to focus on crafting, construction, guarding or resting/recuperating
  • Base stays in sudo reality bubble and NPCs will craft, construct, guard, eat, drink, sleep and fight off the hoards while your away

I'm making a new "Base Mode AI" for the NPCs will get switched to when you tell them to stay at the base.  Some of but not all of my doings will be easily merged with the existing AI but probably not all. However, doing it this way makes things orders of magnitudes easier for me now.
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 CK_Kirbi

  • Zombie Food
  • *
  • Posts: 62
    • View Profile
Re: Bases and NPC crafting
« Reply #2 on: September 13, 2017, 09:35:19 AM »
I have no idea how any of the code for this will work so I cannot offer much in the way of help.But man, if you can do this, this will absolutely be my most favorite mod in this entire game. Best of luck to you in this endeavor!

Offline DemAvalon

  • NPC
  • **
  • Posts: 231
  • Through sheer magic I have registered on the forum
    • View Profile
Re: Bases and NPC crafting
« Reply #3 on: September 13, 2017, 10:05:25 AM »
  • Designate a building as "home base" by sticking a notice board on the wall through which you can post rules for the NPCs. (rationing of food, ammo and first aid; construction plans) Also, check status of base and NPC complaints

How large would this designation be? what will determine that?, if they are connected by walls?, currently I have a base in the center of a mall if I were to put that notice board would the whole mall become my "base"?

This is a mod I always wanted, can't wait to play Cataclysm Fortress: Slaves to Dark Days Ahead.
"Oh Master, I don't do THOSE sorts of things♪..."

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3839
    • View Profile
Re: Bases and NPC crafting
« Reply #4 on: September 13, 2017, 10:12:01 AM »
Start small and PR as soon as possible.
The sooner you present your code, the sooner we can help with it.

Don't start out with grand plans until you have a good feel of the NPC code. It can be convoluted and you need to understand what can be done and what is pretty much beyond reach.

Offline Theundyingcode

  • NPC
  • **
  • Posts: 157
  • Mutant Cyborg With a Nuclear Tank
    • View Profile
Re: Bases and NPC crafting
« Reply #5 on: September 13, 2017, 04:38:37 PM »
  • Designate a building as "home base" by sticking a notice board on the wall through which you can post rules for the NPCs. (rationing of food, ammo and first aid; construction plans) Also, check status of base and NPC complaints

How large would this designation be? what will determine that?, if they are connected by walls?, currently I have a base in the center of a mall if I were to put that notice board would the whole mall become my "base"?

This is a mod I always wanted, can't wait to play Cataclysm Fortress: Slaves to Dark Days Ahead.


I'm starting with a one map tile building designated by its walls. Eventually I want to get it to 2x2 map tiles max so you can set up in some of the bigger buildings.   Perimeter fences/ outer walls will also come later.

Start small and PR as soon as possible.
The sooner you present your code, the sooner we can help with it.

Don't start out with grand plans until you have a good feel of the NPC code. It can be convoluted and you need to understand what can be done and what is pretty much beyond reach.

Yeah I have a history of over whelming myself with projects that's why i'm spending so much time on planning so it won't happen this time.
  • I started by spending the entirety of a sixteen hour car ride reading the code to get an understanding of it.
  • Then whole bunch of brain storming and thinking
  • Created the outline I posted
  • Continued to break it up more and more until it became a sorted list of methods (still working on this)
  • BAM! TODO list broken up into small steps... i'll start with the base designation

Right now my biggest problems are figuring out git and vis.  Then syntax... can I put up a [CR][WIP] PR of sudo code?
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 Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3839
    • View Profile
Re: Bases and NPC crafting
« Reply #6 on: September 14, 2017, 11:54:39 AM »
Right now my biggest problems are figuring out git and vis.  Then syntax... can I put up a [CR][WIP] PR of sudo code?

PRs generally should contain code that is actually compilable. It doesn't need to be working - you can have stubs that do nothing (but have informative names), but it should be valid C++.

Keep the whole thing small. Any PR above 300 lines changed (300 added and 300 removed is pushing it) risks getting delayed heavily due to problems with reviews, anything above 1000 lines changed generally gets outright rejected unless it's all JSON because it's nearly impossible to find all the bugs in something of this size.

If your ideas require huge changes, break them up into smaller parts that can be tested individually.

Offline Theundyingcode

  • NPC
  • **
  • Posts: 157
  • Mutant Cyborg With a Nuclear Tank
    • View Profile
Re: Bases and NPC crafting
« Reply #7 on: September 14, 2017, 05:50:36 PM »
Right now my biggest problems are figuring out git and vis.  Then syntax... can I put up a [CR][WIP] PR of sudo code?

PRs generally should contain code that is actually compilable. It doesn't need to be working - you can have stubs that do nothing (but have informative names), but it should be valid C++.

Keep the whole thing small. Any PR above 300 lines changed (300 added and 300 removed is pushing it) risks getting delayed heavily due to problems with reviews, anything above 1000 lines changed generally gets outright rejected unless it's all JSON because it's nearly impossible to find all the bugs in something of this size.

If your ideas require huge changes, break them up into smaller parts that can be tested individually.

Cool thanks
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: 218
    • View Profile
Re: Bases and NPC crafting
« Reply #8 on: September 14, 2017, 09:43:20 PM »
PRs generally should contain code that is actually compilable. It doesn't need to be working - you can have stubs that do nothing (but have informative names), but it should be valid C++.

https://github.com/CleverRaven/Cataclysm-DDA/pull/6925#issuecomment-38744346

Quote from: KA101
Unfortunately we don't merge code that doesn't actually do anything.

;)

Offline Coolthulhu

  • Contributor
  • Survivor
  • ****
  • Posts: 3839
    • View Profile
Re: Bases and NPC crafting
« Reply #9 on: September 14, 2017, 09:50:25 PM »
Not merging doesn't imply not reviewing.

A great deal of the bugs and bad designs can be detected with just pseudocode.

Offline Theundyingcode

  • NPC
  • **
  • Posts: 157
  • Mutant Cyborg With a Nuclear Tank
    • View Profile
Re: Bases and NPC crafting
« Reply #10 on: September 14, 2017, 10:51:28 PM »
It's more a matter of since I haven't worked in C++ before I'll spend all my time buggering around with syntax and getting annoyed that i'm not getting anywhere.  If I write sudo code, I can just get all the implementation ideas down and be like "Look I do-ed something!" And then worry about translating it after I have a program and won't be rewriting everything.  Plus, you don't really need to understand all the ins and outs to translate it so on the off chance I burn out or something it might still be useful.
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: 218
    • View Profile
Re: Bases and NPC crafting
« Reply #11 on: September 15, 2017, 06:17:35 AM »
Not merging doesn't imply not reviewing.

A great deal of the bugs and bad designs can be detected with just pseudocode.
Yes, I know that well in my own case. :D

Offline Metalsoul112

  • Zombie Food
  • *
  • Posts: 4
    • View Profile
Re: Bases and NPC crafting
« Reply #12 on: September 16, 2017, 10:17:40 PM »
Very excited about this! I'm currently writing a lengthy guide on handling NPC followers and once features of this are implemented I'll update the guide. My guide won't include numbers from code or anything specific like that, but as you add features let me know and I'll make sure it's documented correctly! Also free to help test bugs and give ideas. It's your project so let me know what you think!

Offline Theundyingcode

  • NPC
  • **
  • Posts: 157
  • Mutant Cyborg With a Nuclear Tank
    • View Profile
Re: Bases and NPC crafting
« Reply #13 on: September 17, 2017, 12:26:28 AM »
Very excited about this! I'm currently writing a lengthy guide on handling NPC followers and once features of this are implemented I'll update the guide. My guide won't include numbers from code or anything specific like that, but as you add features let me know and I'll make sure it's documented correctly! Also free to help test bugs and give ideas. It's your project so let me know what you think!

Cool, thanks a lot. Understandable documentation is always really nice and something cataclysm lacks very much.
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 Metalsoul112

  • Zombie Food
  • *
  • Posts: 4
    • View Profile
Re: Bases and NPC crafting
« Reply #14 on: September 18, 2017, 05:21:43 PM »
I know currently the game has the the ability to "Manage Zones" with the default hotkey 'Y' I feel like a lot of your methods could benefit from expanding this feature! Currently it only allows you to prevent Autopick up in a zone and Prevent NPC pickup. But perhaps the framework is already there for many of your ideas!