I broke it...

posted in Beals Software
Published October 19, 2012
Advertisement
Well, if anyone downloaded v1.0.7, you'll probably notice quite a few issues. The whole 'not serializing node links' issue that I fixed...wasn't completely implemented. I added the code to load the nodes, but never added the code to save the nodes. So, if you saved and then tried to load it would crash.

I also managed to make it so you can't start a game, save, exit to main menu and start a new game.

Both of these issues have been fixed. I've also located the issue with the lag; it's the same bug that I thought I fixed back in May. Coroutines are getting caught in the system and it is causing XNA to start calling update or draw in fast succession. I'm working on fixing this now.

I'm working on the lag issue now. Once I have that resolved I'll upload a new installer. A big thanks to Raymond Jacobs for trying the game out and helping me identify these new issues.

[edit]
It looks like the loading of scenes is taking just long enough to screw with XNA, causing it to call multiple update and draws to catch up. I have two options:
1) Disabling the fixed timestep seems to fix the issue.
2) Off-load this some so that it is done asynchronously. If it starts to take too long, I can have a loading message/screen pop up.

The latter seems like the better choice, but honestly it would be more of a nuisance in my opinion. Basically the loading screen would pop up for literally a second at points.

I'll think it over and see what I can come up with.
[/edit]

[edit]
Ok, I think I have it fixed. I've completely rewritten the coroutine system. I'm not sure if you remember me posting it earlier this year, but it was very very naive. Most of it was handled via runtime script generation and I really just cobbled it together to get it working. I have completely removed the script generation and implemented a nice new class-based implementation that uses variable arguments and unpack. It is still using my CoroutineTable C# class, but I'm thinking tomorrow I can quickly remove that completely since there is no longer any script generation. Then I can just add some extension methods to Lua and I'll be good to go.

I've also figured out a new bug that I've been seeing pop up here and there, but absolutely could not figure out. Every now and then I'd hold down the mouse button to select my verb and I would be selecting a verb for some other object. I do it quite quickly, so I couldn't really catch what the object actually was. Turns out, I'm apparently forgetting to nullify the object that you're hovering over at some point. So, if you hover over an object, move off of it, hold down the mouse button and then move it over a different object, you'll be selecting a verb for the original object.

I'm off to bed now; I'll test some more to see if the lag issue is resolved and I'll post an updated installer once I have the bugs I've found cleaned up.
[/edit]
1 likes 6 comments

Comments

Programming020195BRook
How did you find the slow down issue??? I know when I played the game I couldn't even detect any delay or FPS drop.
October 20, 2012 02:52 AM
Programmer16
[quote name='Black-Rook' timestamp='1350701566']
How did you find the slow down issue??? I know when I played the game I couldn't even detect any delay or FPS drop.
[/quote]
It wasn't easy lol. I was originally thinking it wasn't much of an issue since I was the only one that seemed to be having the problem. However, Raymond played through and had issues as soon as he climbed out of the bathroom window. He also said it basically just kept getting worse.

Since it only happened to me if I did a full play through I had to play through it about 30 times in a row, stepping through different parts with the debugger XD. In the end, I added some debug output at a few different locations:
1) Each Update() call
2) Each Draw() call
3) Each coroutine resume call

I then waited for the lag and read through the log and I realized that it was calling Update() or Draw() multiple times in a row (skipping one or the other.) I'm looking through the loading code to see where the bottleneck is; there really isn't that much being loaded.

I'm thinking that setting up a loading screen and popping the loading code into a thread would be the best way to go. Still doing some troubleshooting though.
October 20, 2012 03:17 AM
Programmer16
Strike that, it's not the loading code. The scene that I get the lag on actually takes considerably less time than the rest. Now I'm completely baffled lol.

I think it may have something to do with the coroutines. I've altered the engine so that it stops all coroutines when changing a scene and the lag (at least for me) is basically gone; the cursor hangs for literally less than a second now. The funny party is that I don't see any extraneous coroutine updates during the lag. Maybe it is something in the Lua state that is causing it...
October 20, 2012 03:45 AM
arthursouza
Have you used a profiler to actually analyze what parts of the code are taking more time / more cpu?
October 20, 2012 03:47 AM
Programmer16
[quote name='Arthur Souza' timestamp='1350704842']
Have you used a profiler to actually analyze what parts of the code are taking more time / more cpu?
[/quote]
Yup; the problem is that is coming from within my Lua scripts which aren't getting properly profiled. I've narrowed it down pretty far now; it has something to do with my coroutines and how I'm managing them.
October 20, 2012 04:50 AM
Programmer16
I think I have it resolved; I've rewritten how the coroutines are handled and I'm no longer getting the lag. I'm going to test tomorrow and see if Raymond can test again.

Thanks for the comments and input guys!
October 20, 2012 08:47 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement