Anatomy of a Bug
Added 2017-04-17 05:48:29 +0000 UTCv0.6.0 is out! And, of course, there's a bug in it already. I've fixed it, and a patched version will be posted in a couple of hours when it finishes uploading. A big thank you to everyone who posted bug reports, it made tracking the issue down much easier than it might otherwise have been!
Bugs are nothing new, but I thought this one was interesting enough to take some time and look at it. This bug in particular was in a new section of code that displays information about how many times a major scene has been triggered, so you can make an informed decision. In theory, it's a pretty simple piece of code looking something like this:
"You've been in this situation [the_scene.get_level_count()] times before, and expect an increase of [the_scene.get_resist_change()] to their resistance after."
Bonus points if you can spot the error already. It took me a few minutes of poking around to figure it out.
Ren'py allows you to insert python variables inside a text line by surrounding the variable name with square brackets. That's used multiple times throughout the game for things like quoting the date. "It is day [day]" would appear on the screen as "It is day 12" on day 12, and "It is day 84" on day 84, with no additional effort from me. It's a smooth, elegant system. So when I call the_scene.get_resist_change(0) inside a set of square brackets, it should display the expected resistance gain.
Except it doesn't.
The value inside of the square brackets isn't exactly resolved as code (despite properly allowing calls on object variables). It's taken as a string and a variable with that name is searched for. So rather than performing the function get_resist_change(0), it is looking for a variable called "get_resist_change(0)", which obviously doesn't exist. The trace (which lists the order in which commands were executed leading up to an error) looks even more confusing because this missing variable still looks like a function call.
All this has been resolved now. The values needed are calculated outside of the text now and stored in a temporary variable. This variable can then be called by name directly without any issues. I hope you enjoyed reading about this particular bug, it was certainly an interesting one for me to figure out.
EDIT: Patched version is now up, enjoy!
Comments
Here are the plans for the next few updates: <a href="https://www.patreon.com/posts/forward-planning-8536394">https://www.patreon.com/posts/forward-planning-8536394</a>
Vren
2017-04-20 02:47:44 +0000 UTCNo plans on a second project yet. For now, development of Lab Rats is scheduled to continue for a number of updates (Three are planned in order, and there are a bunch of other things I want to add after that).
Vren
2017-04-20 02:36:20 +0000 UTCHi! Played through 6.0 over the last couple days and rather enjoyed it. However, as it stands now the game overall feels rather feature complete. Would you care to give us a rough outline of what kind of mechanics and content that you have planned for the future of the game?
2017-04-20 00:58:09 +0000 UTCSorry on the phone, but does anyone know sadly what his next creation will be? I really happy how this turned out. Will it be corruption (Love those kind of games)
Justanx
2017-04-19 13:07:43 +0000 UTCOh, that's great!
SexBook _____ ADULT PHOTO AND VIDEO SIGNATURES
2017-04-18 14:13:16 +0000 UTCLove this game. Just curious, these are honey select models correct? How did you get the images to be usable in a format suitable for ren'py? Did you just use the honeystudio UI?
Chef
2017-04-18 13:07:50 +0000 UTCThank you!
Kravenar Games
2017-04-17 18:32:56 +0000 UTCsince its not here i would expect that he just removed and changed the link on the original launch post try and re download that one first and se if it works
frederik wøhliche
2017-04-17 15:40:25 +0000 UTCSo where's the link?
Chef
2017-04-17 10:57:32 +0000 UTCInteresting. Thanks for sharing. I like seeing how coding bugs occur and why.
Mr_Ice
2017-04-17 06:25:42 +0000 UTC