Alright, so the general jobs structure:
- we check which available jobs the character agrees to do, and show only them at the assignment screen.
Fair enough.
- traits and some stats may affect the whole turn, and if they do, we show a line about it like in wm ex (it was one of my favorite parts
). I mean stuff when for example nymphomaniac trait with dice(50) gives a small bonus for whore job, like less vitality per act. Or adventurer gives small penalty to cleaning skill for cleaning job. It should be checked only once in the beginning of the turn, and work the whole turn for all checks during it.
"Whole turn" is what? A single job execution?
- we check general stat/skill level, then check how stratifying they were for every customer based on customers expectations.
I am not sure it's a good idea to handle multi-client jobs on per-client basis. We should do that for "private" jobs, no questions there, for Jobs like Stripclub it may not bean overkill, at least at first.
- in the very end, after all skills/stats checks, we calculate once fame and reputation changes.
Maybe...
That should be coded by you before I will be able to write actual lines and checks ![Smiley :)](https://www.pinkpetal.org/Smileys/DarkB/smiley.gif)
Yeah... ok. I wrote a bit about this before but prolly forgot to post it somehow
![Roll Eyes ::)](https://www.pinkpetal.org/Smileys/DarkB/rolleyes.gif)
====>>
SimPy is a simulation module that works with a concept of "processes" and sometimes resources. We are mainly using it for processes and automation that it allows in that area. It currently works more or less like this:
Clients list is stored at the moment, save files are larger but Next Day ("ND") is faster this way. If new clients are needed, they are generated at the very start of the ND on per building basis. Buildings have outside and inside space and can be expanded. One building can have a lot of different businesses. Buildings do not communicate with one another (yet), businesses can if so required.
So, what happens is this:
- ND calculations start!
- We iterate over the buildings one by one starting a new SimPy processes.
- Each ND turn is split in 100 logical units of "time".
- We start the MAIN process which will branch out into many dozen (possible hundreds or even thousands processes).
MAIN Process *(actually there are a couple of those but they run is succession without any interruptions are are just split for simpler code):
1) It will throw away all businesses that are not ready for work or are not workable (like living space for example).
2) It will launch a process for all businesses, some businesses will require client. other will not, they will be maintained until closing time (100) or they cannot be worked anymore.
3) After that is done, the MAIN process remains active and generates a stream of clients, right now it is using a fairly plain progression I came up with in a drunk state but in the future I want there to be a "rush hour (time interval)" for some businesses.
4) Several clients can come into the building at the same time.
5) MAIN Process is kept alive until timestamp of 100, unless there are no more businesses that can be active.
6) Each client becomes a process holding the client object.
===>> So now we have Businesses and Client processes running.
CLIENT Process:
1) Decides which business to visit, right now just picks one by one at random until none remain.
2) Checks if there are Resources available and possibly waits for them to become available.
3) Once Business is chosen, may negotiate some things (like checking for a worker with matching traits in Brothel).
4) Starts a new JOB Process (or Business Client Control Process "BCC") that handles the time client spends in a particular business.
5) After JOB process is finished for whatever reason, control is returned here, this will terminate when the client decided to leave.
6) Sends workers to in "public businesses" but it is not supposed to do that, I'll refactor it soon.
===>>
BUSINESS Process:
- This one is a bit tricky because I will prolly merge it Worker Control process. It doesn't do much except reporting to log every now and again and end clients turn which they should prolly be done in Business Client Control process.
===>>
BCC Process:
1) This one is for businesses like Club.
2) Settles cash payments.
3) Adds dirt.
4) Waits until client is ready to leave.
===>>
WORKER Process:
- Also only for the "public" businesses.
1) Handles tips
2) Takes off workers AP
3) Runs the JOB class to create the summary report.
===>>
JOB Process:
1) Mainly this just waits for the client to be done with the whatever he/she wants. This can be prolonged (like in the strip club if the client keeps getting the girls with decent traits/stats).
2) Sometimes this runs the Job CLASS! This what you (Dark) is usually working on. It logs in the final report, data from Processes is passed their through flags of workers and clients (which is not a very good design as I've mentioned earlier).
3) Sometimes this is also where the client pays for the services provided (or all the time, I don't remember atm).
4) There are some other checks here depending on business.
While it's working reasonably well, I am still trying to get the code straight and to split the processes in a logical chain that makes sense. This post was a nice exercise cause I often forget how this stuff works at any particular moment myself because I rewrite it all the time (as it should be) and will keep doing so until code makes sense and is easy to work with/understand/follow it's logic and design.