Two of my 3d games over the last decade (the recent one Conflict 3049 and the older one Star Dancer) have two intermittent bugs that I've never been able to pinpoint what causes them.
1. Conflict 3049: After playing 3+ missions in the same session, and only sometimes, on occasion, the game will start to stutter/lag/play like a slideshow midway through a mission but will rectify itself if you exit the mission and start another mission. It doesn't always happen, in fact I can leave the game running indefinitely in demo mode and it never happens, it only happens when the user is playing, and playing multiple missions in a row, and it corrects itself if the user restarts a mission. There's no while loops it gets stuck on, no resource loading, no long for loops, so I can't see how/where or why it sometimes gets stuck - on rare occasions.
2. Star Dancer: The beam weapons would sometimes, only sometimes, fire at odd angles - 90 degrees or more skewed from where they were supposed to be. It gave the game a weird look where the beam weapons would fire all over the place, and given it's just a simple matrix transformation or two to position a glowing cylinder at xyz and point it at x2,y2,z2 I was never able to figure out why the coordinates would sometimes be all over the place.
Both of these problems I can't figure out what is causing them, and therefore how to fix them.
The Conflict 3049 one is problematic because it happens randomly after you've been playing multiple missions. You can play a single mission for 30 minutes and it won't happen. But if you play multiple missions, it might happen five minutes in on the third or fourth mission, and then resolve itself if you restart the mission.
This is obviously just a shot in the dark, but for (1) I would be looking to either cache misses (ie the working memory footprint of the game means the CPU has to cross a cache boundary, either from L1 to L2 or L2 to L3 etc or even out to main mem) or fragmentation (if maybe you are using a managed language where being cache efficient is difficult in the first place and/or chucking everything in lists or something). Is there a hard limit on the number of units/objects that can exist in the game-world? If so are they pooled, or is memory initialised and freed ad-hoc during gameplay? If there is no hard limit can you introduce one and can you raise and lower it in order to profile performance under different levels of pressure?
In fact, any unbounded queues or lists where the amount of work per frame can become unreasonable?
Is there anything you're doing that would necessitate data transfer across the GPU buffer (eg updating model verts on the CPU, editing data for textures on the CPU etc)?
Those are the kinds of places my mind would go. If the culprit wasn't obvious I'd maybe start adding profiling code so I could identify which systems exhibited unusually poor performance when the issue reared its head.
For (2) I'd be thinking, is a numeric type overflowing and wrapping around? Is there a codepath where I would normally be doing a cos() where I occasionally, incorrectly, do a sin() instead (or visa versa)? Can I temporarily switch out the linear algebra for trig/longform in the hopes that maybe it will uncover an actual logic/maths error I'm making?
Any chance you can unit/feature test the system responsible for orienting the lasers so you can have confidence in the output for all the in-game circumstances that can arise?
We need a rubber duck (https://en.wikipedia.org/wiki/Rubber_duck_debugging) message icon!
Thanks.
Re 1. Everything is in a pool (static array that never changes size) and it's extremely intermittent - happened twice since February.
Re 2. I spent 3 years looking for the source of the error 2015 to 2017 and on and off after then, never found it. I don't use trig to do my calculations, just vector math.
What language have you written them in?
Star Dancer was Java, Conflict was C#
Quote from: Matty on Aug 19, 2025, 08:11 PMStar Dancer was Java, Conflict was C#
Is there any game engine libraries involved?
Edit: And I take it that you have run the code through a profiler.
Java game uses jpct-ae and c# uses eaylib
I've never heard of eaylib so you will need to supply links. And I do take it that you did run both the java and C# code through a application profiler to weed out any running issues.
I meant raylib. A typo, sorry.
@Matty You still didn't give me an answer to whether or not that you have profiled the applications with a Java profiler such as Java Flight Recorder, or running the C# application through Visual Studio's profiling tools, or the equivalent tools for the operating system being used.
I don't use Visual Studio or any IDE - just notepad++ to write all my code. All my profiling is with self built tools to do so .
Quote from: Matty on Aug 20, 2025, 12:40 AMI don't use Visual Studio or any IDE - just notepad++ to write all my code. All my profiling is with self built tools to do so .
How in the Hell do you do that!? :o
I very interested!
Baggey
Quote from: Matty on Aug 20, 2025, 12:40 AMAll my profiling is with self built tools to do so .
Do these tools monitor CPU usage, the time taken to inside a function, the allocation of memory and memory leaks, and how often the garbage collector is triggered?
If your tooling doesn't do all of that, then you are going to have a very hard time to pin down any issues.
Quote from: Baggey on Aug 20, 2025, 07:39 AMHow in the Hell do you do that!? :o
Easy. You use the command line. It's not that hard to set up a text editor and use the command line terminal. Especially if that text editor supports a simple project set up and the Language Server Protocol.
I think I've solved the problem, sort of.
My computer is dying. I get the same framerate/freeze issue with just notepad.exe open. The computer is 11-12 years old with neither hardware upgrade nor os reinstall in that time and I already know for the last 3 years I've been experiencing weird glitches like keyboard/mouse refusing input, usbs disconnecting randomly, non-boot after being off for a few days (so I leave it on instead), and occasional other glitches like videos hanging when playing back. It's simply been dying for 3 years and I've probably run out of time to replace it. (I got home today and had left notepad.exe open and the whole system had frozen and wouldn't reboot after switching it off).
Just discovered my cpu temperatures have often been at or above 100 degrees C. Thanks ChatGPT for telling me to check that. Might explain the random crashes in notepad.exe etc.
turns out it was 11 years of dust build up in the cpu fan....
The entire machine was literally choking in dust.
Temperatures now a healthy 20-30 degrees on idle, and 60-78 degrees under heavy 3d load. Not rising above 100 ...
Quote from: Matty on Aug 22, 2025, 07:02 PMturns out it was 11 years of dust build up in the cpu fan....
The entire machine was literally choking in dust.
Temperatures now a healthy 20-30 degrees on idle, and 60-78 degrees under heavy 3d load. Not rising above 100 ...
With the machine being that old. You should replace the thermal paste for all chips that require a heat sink.
..im wondering do we have some SBC's these days that are capable for serious 3D games..not top notch but still, high enough to be considered gaming platform?
Quote from: Naughty Alien on Aug 25, 2025, 05:00 AM..im wondering do we have some SBC's these days that are capable for serious 3D games..not top notch but still, high enough to be considered gaming platform?
None that I know of.