You must be registered to see the links
In this Dev Log I want to shed some light on why some of you experience lag when videos play and how I finally got around to integrating the videos in a way that they can't be skipped accidentally, but also allows you to immediately skip anything for those who got to go fast.
The new video integration:
First off all, sparked by a comment on the Discord, I took another look at the way I show videos in the game. In the past there were issues of people accidentally skipping them which made me put in a block at the beginning of every video that made it impossible to skip them on accident. But that block also made it hard to skip videos at all and was kinda annoying if you wanted to go fast. Previously I didn't have the knowledge to figure out a better solution, but now with a bit more knowledge of Ren'Py under my belt I found one.
So in 0.7 you will notice that you now have a skip button in the bottom right that allows you to immediately skip the video, while normal clicking and button pressing won't. No accidental skips, but also no waiting if you don't want to see the video. On top of that the code for it is actually a bit simpler than the weird blocks I put in before.
In my opinion the accidental skipping was a big problem. It made people miss really important content. Sadly Ren'Py doesn't have a good solution for that problem on it's own. Which is actually something that also contributes to the lag.
What causes the lag?
I know that for those of you aren't familiar with Ren'Py it might sound weird that a simple pre-rendered video could cause lag. At least that is how I thought in the beginning. Ren'Py is not made to show videos, it is for 2D images and has a lot of functions to properly display and manipulate those. When it comes to videos, that functionality is limited and there are two factors that might lead to lag because of that.
The first one is file size. The smaller the files are, the esier it is for Ren'Py to load them. Easy as that. Sadly, I can't really change anything here. I already use the smallest file size possible, without butchering the quality completely. This also depends on your hardware, that is why you will notice more lag on phones than on a pc, pretty obvious I guess. The second problem is different and I have a little bit of room to act.
How do I display the videos? This I am gonna explain very simplified, for those who don't know how Ren'py works. You basically have two methods of showing videos. With a built in cutscene function, or as a background image that constantly loops. The cutscene function is the best and uses noticeably less memory to display the videos. But, I can't use it.
Remember the problem with the skipping? This cutscene function is part of it. I can't find a way to implement it, without either making it unskippable or easy to accidentally miss. It is basically the worst of both worlds. So that rules the cutscene function out and we are left with the looping background image. And this one simply uses more memory to display. I don't know why, or if I could change that somehow. But no one online seems to have a solution either. So here we theoretically have a choice, but I still have to use the worse one because it gives me other functionalities that I need.
Conclusion:
So the file size and way the videos are displayed seem to be the important factors. Both of which I am already doing as good as I can. If you experience some occasional lag I am sorry, but currently I can't really change that. Even if it sounds silly, hardware still matters. Even for Ren'py. In the future I am gonna continue to look for solutions and better ways to display my videos, but I can't promise anything. At least 0.7 will come with a proper way to skip.
And that is it. I hope not too many of you have problems with lag and I wish you a good week, you'll hear from me next Monday!