Small update: 0.7.5.1 (Catch Me If You Pan) aka Swing is a Lazy Jerk
Hello everyone,
Small update today, as I fixed a visual bug that was really making the game hard to play.
I've referenced a problem where, when panning in certain ways, the terrain kinda flickers. The reason for this has to do with the interaction between Swing and my gameplay loop. For those interested, I'll go into detail here. For others, you may go to the change list and download at your leisure.
So in my engine, I have a gameloop set to 1. shift the camera as needed 2. update all entities 3. render everything every 17 milliseconds (60 FPS). It does so generally without fail, though I let the rendering step take the time it needs, and just drop frames if there's too much to do. I think this called a variable time step?
But there's a problem! When I need to render, I tell Java to repaint() the game panel, which Swing does without fail... when it feels like it. Sometimes outside of the render step. And especially sometimes during step 1 of the gameloop, when the camera position is changing. This is really bad, because if the camera position changes DURING a render, stuff will get redrawn oddly.
I've left version 0.7.5 (Glad, Tutorial Combat) up if you want to see the difference.
You may notice when panning with the mouse this doesn't happen. This is because when you pan this way, Swing's event loop triggers the change. The instant you pan with a mouse, it repaints, cuz that's when it's doing stuff. So it's only changes that happen directly in my gameloop that are affected.
What was my fix? A trick so clever that my brother, a computer engineer, described it as, and I'm quoting, "horrifying"?
When rendering, if you're panning with the keyboard, or if the game does a cinematic pan, I simply ask Swing to paintImmediately(0, 0, width, height) instead! Now the render is fully under my control! Muhahahaha!
Except, this means mouse panning now gets screwed up, because this panning happens in the event thread, not my loop. So I just tell it to repaint() as normal in that case.
So we have it. A terrible solution to a terrible problem, but no more flickering!
Changes:
- Fixed graphical glitch during all panning except mouse panning
- New PC portraits!
- Added ASWD back in as an alternative to mouse panning. Should not cause flickering.
- Fixed some AI problems with enemies
- Some art/positioning improvements
Cheers,
PajamaWolf
PS. Almost left this pretty amazing bug in after the AI update.
Files
Get This Godforsaken Rock - Combat Demo
This Godforsaken Rock - Combat Demo
Sci-fi squad-based tactical RPG
Status | In development |
Author | PajamaWolf |
Genre | Strategy |
Tags | 2D, Dark, Pixel Art, Sci-fi, Tactical RPG, Top-Down, Turn-based Strategy |
Languages | English |
More posts
- Minor Update: AI and Performance ImprovementsApr 01, 2024
- Feature-Complete version is out!Mar 01, 2024
- Penultimate Demo Update: 0.7.6.0 (My Smart is Broken)Feb 20, 2024
- New gameplay video, bug crushingFeb 11, 2024
- This Godforsaken Rock Update 0.7.5 (Glad, Tutorial Combat)Feb 08, 2024
- Oh Shit Moments (belated warning: profanity)Feb 03, 2024
- A Teeny Update - Sound issues, med suppliesJan 31, 2024
- This Godforsaken Rock 0.7.4 (The 'Pew Pew' Update)Jan 31, 2024
- Major update version 0.7.3 (Update loop, graphics, UI overhaul)Jan 26, 2024
Leave a comment
Log in with itch.io to leave a comment.