Introducing the GroupDisplayManager Class (Patreon)
Content
I have a relatively technically post for today, to detail the strides that have been made towards supporting displaying multiple characters at once.
tl;dr - Girls can now be put into a group. The whole group can be displayed, with one person as the "primary" and all other girls drawn behind and smaller than her image.
Now for the details, which I hope will be helpful for any modders and interesting to everyone else (everyone else who is still reading this, at least). A new class has been introduced to support the easy drawing of multiple characters at once, GroupDisplayManager. At the start of an event that should include multiple girls an instance of this class can be created, handing a list of girls and, optionally, which one should start as the primary speaker.
An instance of GroupDisplayManager can be told to draw a person in a similar way to a solo Person, with the exception that the person to be updated is handed as the first parameter. When given a draw GroupDisplayManager checks to see where that person is in the group of girls as well as how far away they are from the primary speaker. The draw parameters are then updated to put the displayable into the correct position on the screen relative to all of the other characters, as well as set the zorder of the character so they appear behind the primary speaker (as well as all other characters closer to the primary speaker). Note that a single character can be drawn and redrawn without the entire character stack having to be updated. For almost all draw calls in scenes involving groups code has gone from looking like:
$ a_person.draw_person(position = "blowjob")
to:
$ the_group.draw_person(a_person, position = "blowjob")
which satisfies my goal of keeping the interface as identical as possible.
GroupDisplayManager has a few other functions that make it especially useful. First, it stores the last set of draw commands that were given for each character in the group. This allows for characters to be redrawn at will without compromising the character display state of the scene. This comes up often when the primary speaker in a conversation is changing often, as the primary must be redrawn at a larger scale and the old primary must be redrawn at a smaller scale. It is also possible with a single command to draw every person in the group, for quick setup at the start of an event.
I have started updating old events that contained multiple characters to use this new group display. I'm happy with how much more smoothly conversations seem to flow and how much easier it is to convey group activities. Scenes where multiple girls are stripping down at once have been particularly improved, as you no longer need to arbitrarily pick who to focus on (potentially missing out on the "interesting" clothing choices of otherwise unassuming girls.)
Performance wise the work I have done so far is working fantastically with animations disabled, and somewhere between poor and acceptable with animations enabled. With two characters on screen the game maintains an acceptable frame rate, but frame rate suffers when more than two girls are being animated or when girls are removing clothing (internally each clothing removal requires two different draws that are faded between). Some initial testing has shown that the slowdown is independent of the actual animation work and is all overhead from the Renpy displayable that enables openGL shader support. If I can find the time I am going to poke around and see if I can improve things; if not, I will likely limit animation to the primary character only.
Once all of the existing events are updated to use the new system I want to write some new ones to show off the new functionality. If you have any ideas for interesting random events that would involve multiple girls leave a comment and let me know!