Last Minute Performance Improvements
Added 2020-04-30 10:16:34 +0000 UTCThe release of v0.28.0 is nearly here (24 hours away!) and I'm still busy finishing off the last few bits of content, bug fixes, and improvements before it's time to test and ship it. Tonight I was finally in the right state of mind to sit down and finish a feature I had experimented with at the beginning of the month: Multithreading.
First, a quick course in program execution and multithreading. You can imagine a program to be like a list of instructions you give to a friend. This list might tell your friend how to bake a cake, and include steps for gathering the ingredients in one place, mixing them together, heating the oven, and so on. A single person (for computers, a "thread") reading through the instructions is the simplest way to write a program. Everything happens in a predictable order. Unfortunately it's also the hardest to speed up; the only way to make it go faster is to get a faster friend. The obvious thing to do is get several friends and have them all work together. One person mixes the dry ingredients, another the wet ingredients, and a final friend pre-heats the oven. When you split up a program onto multiple CPU cores it is called multithreading.
For the most part Lab Rats 2 operates perfectly fine as a sequential program. The game logic is so simple a modern CPU could likely process dozens of turns a second. Where the game slows down is when it needs to display character images. Clothing images need to be loaded, coloured, layered, and (coming in v0.28.0) constrained, placed on top of a person and scaled. If animations are being used the whole thing needs to be processed as a .png and then run through a shader before being displayed. This is usually done in less than second, but that's a noticeable delay if you are scrolling through a list of people and viewing previews. To avoid this delay I have split the character display code in menus into it's own thread. Now when you hover over a character button the menu remains responsive while their preview is created. I have experimented with a similar approach for all character display calls and have had good results, but it will need more work to mesh smoothly with the animation system.
While looking through the display code I have also made some incidental improvements and bug fixes. I think I have fixed the character scaling issues with Macs (thank you to everyone who filled out a bug report, especially if you had some insight into the cause!) and character animation should be slightly faster now.
There are a few more things for me to finish off, so I'm going to get back to work! Lab Rats 2 v0.28.0 will be out this time tomorrow to $5 patrons for bug testing!
Comments
Also mad props for helping the Mac fixes. I want to play on just my laptop without needing a separate monitor. Can't wait!
Yellowcake Uranium
2020-04-30 14:07:13 +0000 UTCThe easiest way to deal with multithreading (which is a royal pain to debug) is to use the pooling/worker thread pattern. It also helps to use the observer pattern to watch over the threads and kill any zombies and such, especially when an error or crash occurs.
Yellowcake Uranium
2020-04-30 14:06:35 +0000 UTCOne other balance note: it is a _lot_ easier to max out your business skills and attributes than it is your sex skills at present. For example in my current game I'm still 4 points short in the latter but I have something like 20 unspent points on each of the other two (and could easily have more, I just got bored completing them). I'm not bothered about the fact that you can max out since again I assume eventually there'll be a time limit on that sort of thing, but I suspect a lot of players would prefer to be able to concentrate on the sex side rather than the business side. Again, this may be working as intended - but I thought I'd mention it.
GAZZA
2020-04-30 10:45:47 +0000 UTCJust a couple of other bugs I found while you're "under the hood" so to speak: 1. Paramours and "Leave your significant other". 1a (bug): While it does correctly change their status to Girlfriend, it does _not_ make the player the new significant other and keeps the existing SO. Mainly this affects dialogue (e.g. they'll still say that their husband will have to deal with pregnancy and so on). 1b (possible bug): Telling them to leave their significant other gives them +10 Love. However, you need 100 Love to get them to do this, and 100 is the cap, so +10 Love doesn't actually do anything. (I say this as a possible bug because perhaps you intend some later mechanism to break the cap, or whatever). 2. Mother Friday Night actions: With 100 energy she does not in fact have enough energy to "close the deal", so to speak - you'll get to 99 arousal - if you choose "Suck me off". You can of course get around this by feeding her an energy drug prior to Friday evening, but you can get these actions very early in the game and you may not have access yet. (But not necessarily a bug, just an observation). 3. Lily Web Cam: It is surprisingly difficult to get Lily an outfit she will accept; anything I've tried that conceals her "bits" she claims is too conservative, while anything slutty enough to get her interest she will refuse to wear because of "exposure". I could of course dig into the code to see exactly what the rules are here but generally LR2 is pretty well designed to lead you along without needing to do that. Of course it might just be that my fashion sense sucks. :) 4. "Strip Naked" option bugs. 4a. It appears that the actual Obedience value required to get someone to strip in public is 170 (or thereabouts; I have not looked at the code). The tooltip says it is 140, which is definitely incorrect (both because that's the minimum to get them to do it even in private, and also because it is greyed out if you have less than 170 or so). This looks like a tool tip bug. 4b. Certain outfits appear to count as "naked enough" that this option isn't presented. I'm not sure of the exact conditions, but I _think_ it is if they are wearing a Full Outfit that doesn't include any underwear. This isn't a serious bug (you can still get them to strip it off during the sex menu) but nonetheless is incorrect. The "Strip for me" option isn't present at all in such cases. 5. Feature Request: Would it be possible to moderately increase the percentage chance of being "caught by the husband" on a Friday night paramour date? Since you can only have 1 of these per week, and since presumably at some point LR2 will have a concluding storyline/ending/time limit, you could easily never see this event in the entire game even if you have a date with a paramour every single Friday. Of course this may be working as intended, I just thought I'd ask. :)
GAZZA
2020-04-30 10:31:29 +0000 UTCYou look very dedicated to your craft, every progress report is very pleasant to read
Minimoy
2020-04-30 10:20:26 +0000 UTC