About this blog
I have a few step to go before presentation looks good
Entries in this blog
Hello reader, My name is Laurent Star Vinn and I have a special project I would like to share with you. See all the struggles and triumphs of my game's development and maybe learn something new along the way. Let's get started.
THE VIRTUAL FUNCTION DILEMMA
Recently I've started using a new tool call virtual functions and a polymorphic base class. Setting this up was very difficult to do but after a week I was using virtual functions. The real problem is that my computer is old and I do mean so old It runs Windows XP. The performance has finally started to lag and I need to find a way to call less virtual functions and make them do more work. My game known as SFNV Flare was so laggy it was like watching a 0.5 frame per second picture show. I don't want to go back to the old way of doing stuff. It was faster but harder to maintain and now after redesigning the code only 2 weeks ago everything looks sleek, and simple. I can't go back to that so I have only one option and that is to optimize or buy a modern computer.
Never giving up, I always find a way to brain storm a few wild ideas that sometimes are viewed as the worst. The advice given to me over the years has me in very tough spot where I must actively decide what is important and what is not through very intense research. The new solution I'm debating right now might be yet another conflicting problem. Should I not be able to solve my problem by myself will I call out for help hopeful of not pitching a bad idea for my problem.
After doing a bit of research I learn virtual function are slower than regular function. I was also told that they aren't too much slower. This was to key to discovering my program ran slowly due to calling virtual function because it was accumulative. In the old code I could easily do a few calculation and render everything on screen but now with virtual functions that's not plausible. If my problem is simply calling virtual functions then I might be able to perform a. work around. This explains why I didn't encounter the lag issue until rendering. I didn't call as many functions to calculate them.
SOLUTION SO FAR....
I need to call less virtual functions only then might I get back to normal speed. When I calculated my physics I called virtual functions to define a few things but after this was done most of the work was done by what I defined. Because of this my game ran fine, but when I tried to finalize my rendering process I call a lot of virtual functions in nested for loops. My old code was designed like this so I thought nothing of it until I ran it. It been very difficult to do , but I'm going to try to define variables at the beginning of levels before they load, this should release my need to call virtual functions and allow my game to get back to normal. The physics part of my game pushed me to the extreme to create it this way, but I'm starting to see the benefits of working with internal variables. My desire for convenient at the time of programming physics is a blue print for the future.