Author Topic: Star Wars Galaxian  (Read 2343 times)

Gigatron

  • Sr. Member
  • ****
  • Posts: 433
  • Amiga Rulez !!
    • Gigatron Shader Network Demo
Re: Star Wars Galaxian
« Reply #15 on: August 08, 2026, 08:39:31 pm »
Hi

For me the cpu usage is near 1% . Ryzen 7 win10 X64.

Regards
Coding faster than Light ! Finishing 5 Java Projects , will come back soon ;
https://www.youtube.com/@gtrgtr9505

Scoops

  • Full Member
  • ***
  • Posts: 113
Re: Star Wars Galaxian
« Reply #16 on: August 08, 2026, 08:42:45 pm »
@flowCRANE,

uncomment line 307 of 'GalaxianWar.lpr'

 // SetConfigFlags(FLAG_VSYNC_HINT or FLAG_WINDOW_HIGHDPI);

to

 SetConfigFlags(FLAG_VSYNC_HINT or FLAG_WINDOW_HIGHDPI);

recompile and try again please. just a guess  :(

Guva

  • Full Member
  • ***
  • Posts: 248
  • 🌈 ZX-Spectrum !!!
Re: Star Wars Galaxian
« Reply #17 on: August 08, 2026, 09:02:45 pm »
@Scoops SetConfigFlags(FLAG_VSYNC_HINT or FLAG_WINDOW_HIGHDPI); was originally in the binaries that are on itch.io
I commented that out today and set an FPS limit with SetTargetFps(60)

Scoops

  • Full Member
  • ***
  • Posts: 113
Re: Star Wars Galaxian
« Reply #18 on: August 08, 2026, 09:09:16 pm »
??? That's the culprit! On Windows, SetTargetFps(60) without FLAG_VSYNC_HINT causes a busy-wait loop that maxes out a CPU core. You actually want both lines active together so the GPU handles timing while keeping a 60 FPS cap.

Guva

  • Full Member
  • ***
  • Posts: 248
  • 🌈 ZX-Spectrum !!!
Re: Star Wars Galaxian
« Reply #19 on: August 08, 2026, 09:15:18 pm »
??? That's the culprit! On Windows, SetTargetFps(60) without FLAG_VSYNC_HINT causes a busy-wait loop that maxes out a CPU core. You actually want both lines active together so the GPU handles timing while keeping a 60 FPS cap.

But there was no SetTargetFps(60) there. I just added that today after flowCRANE's messages about high load, trying to figure out what's going on.

flowCRANE

  • Hero Member
  • *****
  • Posts: 1009
Re: Star Wars Galaxian
« Reply #20 on: August 08, 2026, 09:16:48 pm »
The problem definitely has to do with frame generation, because cooking the CPU is the result of either generating thousands of frames (no fps/ups cap) or waiting between frames using spinlocks. Regardless of what the problem is in this demo, it should be fixed, because this game shouldn't use more than 2–3% of CPU time.

If the demo is fixed, I can test it again and provide feedback.
Lazarus 4.8 with FPC 3.2.2, Windows 11 — all 64-bit

Working solo on a top-down retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL3.

Scoops

  • Full Member
  • ***
  • Posts: 113
Re: Star Wars Galaxian
« Reply #21 on: August 08, 2026, 09:27:43 pm »
@guva

Makes sense! Running without VSync or SetTargetFps means the game renders as fast as possible, which cooks the CPU.

But using SetTargetFps alone forces Raylib to use a spin loop on Windows, which maxes out a full CPU core trying to hit exact frame timing (which explains the 16% on a 6-core chip).

If you combine both FLAG_VSYNC_HINT and SetTargetFps(60), VSync keeps the CPU usage near 0% while the FPS limit acts as a fallback.

Guva

  • Full Member
  • ***
  • Posts: 248
  • 🌈 ZX-Spectrum !!!
Re: Star Wars Galaxian
« Reply #22 on: August 08, 2026, 09:35:44 pm »
@flowCRANE, test these options if you can. Perhaps what @Scoops said makes sense.

https://github.com/GuvaCode/SWGalaxian/tree/main/bin

Paolo

  • Hero Member
  • *****
  • Posts: 805
Re: Star Wars Galaxian
« Reply #23 on: August 08, 2026, 09:37:10 pm »
@scoops, in your replay #16 the commented and uncommented line are the same. You can correct replay #16.

Thausand

  • Hero Member
  • *****
  • Posts: 618
Re: Star Wars Galaxian
« Reply #24 on: August 08, 2026, 09:38:27 pm »
@guva:
when test debian bookworm
Code: [Select]
./SWGalaxian: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.38' not found (required by ./SWGalaxian)
./SWGalaxian: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by ./SWGalaxian)

Bookworm is LTS support 2028 so can have user report this error
A docile goblin always follow HERMES.md

Guva

  • Full Member
  • ***
  • Posts: 248
  • 🌈 ZX-Spectrum !!!
Re: Star Wars Galaxian
« Reply #25 on: August 08, 2026, 09:42:11 pm »
@guva:
when test debian bookworm
Code: [Select]
./SWGalaxian: /lib/x86_64-linux-gnu/libm.so.6: version `GLIBC_2.38' not found (required by ./SWGalaxian)
./SWGalaxian: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by ./SWGalaxian)

Bookworm is LTS support 2028 so can have user report this error

Well, here you can either rebuild with your old GLIBC version or use a dynamic library.

olatov

  • Full Member
  • ***
  • Posts: 116
Re: Star Wars Galaxian
« Reply #26 on: August 08, 2026, 09:43:20 pm »
Worth noting that FLAG_VSYNC_HINT alone is indeed a hint, requesting the system to enable Vsync, yet there's no guarantee the request will be fulfilled in every setup. It may well be ignored depending on the configuration (OS / GPU / display / drivers / compositor etc). Maybe worth adding a keystroke to get an FPS counter (DrawFPS) onto screen (and possibly another one to toggle Vsync separately in runtime), that might help debugging.

Thausand

  • Hero Member
  • *****
  • Posts: 618
Re: Star Wars Galaxian
« Reply #27 on: August 08, 2026, 09:43:29 pm »
Well, here you can either rebuild with your old GLIBC version or use a dynamic library.
Yes, I can make. Can user itch understand and make ? That reason for write message  :)

PS: when raysan 6 library build dynamic when use header guva github then source want link static. I need have look why (dynamic is define commandline and .inc).
I make error so is not apply.
« Last Edit: August 09, 2026, 02:19:55 am by Thausand »
A docile goblin always follow HERMES.md

flowCRANE

  • Hero Member
  • *****
  • Posts: 1009
Re: Star Wars Galaxian
« Reply #28 on: August 08, 2026, 09:47:55 pm »
@flowCRANE, test these options if you can. Perhaps what @Scoops said makes sense.

Indeed makes sense — see attachments.

The SWGalaxian_fpsLock60.exe delivers the best performance, although it uses more RAM.
« Last Edit: August 08, 2026, 09:50:25 pm by flowCRANE »
Lazarus 4.8 with FPC 3.2.2, Windows 11 — all 64-bit

Working solo on a top-down retro-style action/adventure game (pixel art), programming the engine from scratch, using Free Pascal and SDL3.

Guva

  • Full Member
  • ***
  • Posts: 248
  • 🌈 ZX-Spectrum !!!
Re: Star Wars Galaxian
« Reply #29 on: August 08, 2026, 10:00:56 pm »
@flowCRANE, test these options if you can. Perhaps what @Scoops said makes sense.

Indeed makes sense — see attachments.

The SWGalaxian_fpsLock60.exe delivers the best performance, although it uses more RAM.

it looks like @Nimbus is right and vsync is not enabled. it may need to be enabled after initializing the window. although it works for me in both cases.

I collected two more files as it was, but with the fps indicator and with the activation after creating the window. Try them out.
 

 

TinyPortal © 2005-2018