Author Topic: Star Wars Galaxian  (Read 1846 times)

Guva

  • Full Member
  • ***
  • Posts: 243
  • 🌈 ZX-Spectrum !!!
Re: Star Wars Galaxian
« Reply #30 on: August 08, 2026, 10:04:31 pm »
Yes, I can make. Can user itch understand and make ? That reason for write message  :)

If the user uses pure Debian, then I think he will definitely be able to

Scoops

  • Full Member
  • ***
  • Posts: 113
Re: Star Wars Galaxian
« Reply #31 on: August 08, 2026, 10:10:20 pm »
Good luck with the engine updates Guva, seems its sorted for flowCRANE, nice to see low cpu usage.

Guva

  • Full Member
  • ***
  • Posts: 243
  • 🌈 ZX-Spectrum !!!
Re: Star Wars Galaxian
« Reply #32 on: August 08, 2026, 10:21:31 pm »
Well, this isn't quite a victory yet — we need to figure out why Vsync isn't enabling for @flowCRANE. Whether it's Windows 11 behavior or an initialization bug. I've uploaded two versions with the FPS display enabled, hopefully @flowCRANE will test this.

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

Scoops

  • Full Member
  • ***
  • Posts: 113
Re: Star Wars Galaxian
« Reply #33 on: August 08, 2026, 10:47:46 pm »
Graphics Panel Overrides
Code Order: SetConfigFlags was called after InitWindow instead of before it
Windows 11 Windowed Mode: Win 11 can be picky about frame syncing in windowed mode

anyway good luck



flowCRANE

  • Hero Member
  • *****
  • Posts: 1009
Re: Star Wars Galaxian
« Reply #34 on: August 08, 2026, 10:48:48 pm »
SWGalaxian.exe — runs at ~2200fps and tries to murder my GPU.
SWGalaxianVsyncFPSDraw.exe — runs at 60fps but tries to boil a CPU core.

I'd like to add that the game I'm currently developing using SDL3 has no problems at all with enabling VSync, also dynamically at runtime. Everything works perfectly — in windowed mode, desktop fullscreen and exclusive fullscreen (any monitor, any resolution and any refresh rate). So I think that my CPU is not a problem here.
« Last Edit: August 08, 2026, 10:57:17 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.

Scoops

  • Full Member
  • ***
  • Posts: 113
Re: Star Wars Galaxian
« Reply #35 on: August 08, 2026, 11:01:46 pm »
@flowCRANE, Your Intel driver is just bypassing VSync entirely on Win 11. Going back to the SWGalaxian_fpsLock60.exe build seems like the best fix since that one was already running smoothly for you.

Guva

  • Full Member
  • ***
  • Posts: 243
  • 🌈 ZX-Spectrum !!!
Re: Star Wars Galaxian
« Reply #36 on: August 08, 2026, 11:06:41 pm »
SWGalaxian.exe — runs at ~2200fps and tries to murder my GPU.
SWGalaxianVsyncFPSDraw.exe — runs at 60fps but tries to boil a CPU core.

I'd like to add that the game I'm currently developing using SDL3 has no problems at all with enabling VSync, also dynamically at runtime. Everything works perfectly — in windowed mode, desktop fullscreen and exclusive fullscreen (any monitor, any resolution and any refresh rate). So I think that my CPU is not a problem here.

Hmm. Okay, thanks to everyone who helped. Maybe some kind of regression in raylib. I'll talk to Ramon Santamaria tomorrow, maybe something will be decided.

flowCRANE

  • Hero Member
  • *****
  • Posts: 1009
Re: Star Wars Galaxian
« Reply #37 on: August 08, 2026, 11:17:15 pm »
Well, for my game, I'm using the latest version of SDL3 and the basic 2D renderer, which is created by specifying gpu as the backend name in the SDL_CreateRenderer function (internally, it uses the Direct3D 12 backend on my system by default). And I can enable and disable VSync at runtime using the SDL_SetRenderVSync function without any problems.

Given that, I don't think the Intel driver is bypassing anything—it just works as it should.
« Last Edit: August 08, 2026, 11:20:19 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.

Scoops

  • Full Member
  • ***
  • Posts: 113
Re: Star Wars Galaxian
« Reply #38 on: August 08, 2026, 11:37:35 pm »
That's because SDL3 defaults to Direct3D 12 on Win 11, while Raylib uses OpenGL 3.3. They use completely different driver paths, so comparing VSync between them doesn't really apply here. Guva taking it up with Ramon is definitely the best way to sort out the Raylib side!

flowCRANE

  • Hero Member
  • *****
  • Posts: 1009
Re: Star Wars Galaxian
« Reply #39 on: August 09, 2026, 12:28:35 am »
That's because SDL3 defaults to Direct3D 12 on Win 11, while Raylib uses OpenGL 3.3. They use completely different driver paths, so comparing VSync between them doesn't really apply here.

I understand, but that doesn't apply to a situation where I create a renderer by specifying OpenGL as the target backend. When I change the following line in my game from this:

Code: Pascal  [Select][+][-]
  1. Renderer.Handle := SDL_CreateRenderer(Window.Handle, 'gpu');

to this:

Code: Pascal  [Select][+][-]
  1. Renderer.Handle := SDL_CreateRenderer(Window.Handle, 'opengl');
  2. //                                                or 'direct3d11'
  3. //                                                or 'direct3d12'
  4. //                                                or 'vulkan'
  5. //                                                or 'software'

the renderer is also created successfully, and there are still no issues with VSync support—I can use the SDL_SetRenderVSync function at any time during runtime, switch the vertical synchronization on and off.

Quote
Guva taking it up with Ramon is definitely the best way to sort out the Raylib side!

Sure, it's worth looking into this topic. Good luck!
« Last Edit: August 09, 2026, 12:31:25 am 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.

olatov

  • Full Member
  • ***
  • Posts: 110
Re: Star Wars Galaxian
« Reply #40 on: August 09, 2026, 12:53:42 am »
Just one more note - while raylib defaults to GLFW (which may be the culprit of this thread) as its OpenGL backend, there are other supported backends - SDL2 and SDL3 are amongst them; yet switching the backend requires recompiling the library. I am not saying that is worth the effort for end-user (although it is not too complicated), just saying it is a valid option.

Thausand

  • Hero Member
  • *****
  • Posts: 613
Re: Star Wars Galaxian
« Reply #41 on: August 09, 2026, 02:21:48 am »
@guva

OS:  Debian bookworm LTS
CPU: AMD
GFX: igpu
FPS: ~8000 - ~45000
CPU: 98% (1 thread)
FPC: 3.2.2
RAYLIB: version 6.0 tag release
GalaxianWar: version commit 38eed53

Have same cpu effect user flowCrane

and have small warnings and when exit have AV:
Code: [Select]
./GalaxianWar
INFO: Initializing raylib 6.0
INFO: Platform backend: DESKTOP (GLFW)
INFO: Supported raylib modules:
INFO:     > rcore:..... loaded (mandatory)
INFO:     > rlgl:...... loaded (mandatory)
INFO:     > rshapes:... loaded (optional)
INFO:     > rtextures:. loaded (optional)
INFO:     > rtext:..... loaded (optional)
INFO:     > rmodels:... loaded (optional)
INFO:     > raudio:.... loaded (optional)
INFO: DISPLAY: Device initialized successfully
INFO:     > Display size: 1920 x 1080
INFO:     > Screen size:  800 x 600
INFO:     > Render size:  800 x 600
INFO:     > Viewport offsets: 0, 0
INFO: GLAD: OpenGL extensions loaded successfully
INFO: GL: Supported extensions count: 233
INFO: GL: OpenGL device information:
INFO:     > Vendor:   AMD
INFO:     > Renderer: AMD Radeon Graphics (renoir, LLVM 15.0.6, DRM 3.49, 6.1.0-51-amd64)
INFO:     > Version:  4.6 (Core Profile) Mesa 22.3.6
INFO:     > GLSL:     4.60
INFO: GL: VAO extension detected, VAO functions loaded successfully
INFO: GL: NPOT textures extension detected, full NPOT textures supported
INFO: GL: DXT compressed textures supported
INFO: GL: ETC2/EAC compressed textures supported
INFO: PLATFORM: DESKTOP (GLFW - X11): Initialized successfully
INFO: TEXTURE: [ID 1] Texture loaded successfully (1x1 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 1] Default texture loaded successfully
INFO: SHADER: [ID 1] Vertex shader compiled successfully
INFO: SHADER: [ID 2] Fragment shader compiled successfully
INFO: SHADER: [ID 3] Program shader loaded successfully
INFO: SHADER: [ID 3] Default shader loaded successfully
INFO: RLGL: Render batch vertex buffers loaded successfully in RAM (CPU)
INFO: RLGL: Render batch vertex buffers loaded successfully in VRAM (GPU)
INFO: RLGL: Default OpenGL state initialized successfully
INFO: TEXTURE: [ID 2] Texture loaded successfully (128x128 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Default font loaded successfully (224 glyphs)
INFO: SYSTEM: Working Directory: /media/ramdisk/work/bin
WARNING: WINDOW: SetConfigFlags called after window initialization, Use "SetWindowState" to set flags instead
INFO: FILEIO: [data/art.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (128x128 | R8G8B8A8 | 1 mipmaps)
INFO: AUDIO: Device initialized successfully
INFO:     > Backend:       miniaudio | PulseAudio
INFO:     > Format:        32-bit IEEE Floating Point -> 16-bit Signed Integer
INFO:     > Channels:      2 -> 2
INFO:     > Sample rate:   48000 -> 48000
INFO:     > Periods size:  3600
INFO: TEXTURE: [ID 3] Texture loaded successfully (256x1024 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [data/bomb.wav] File loaded successfully
INFO: WAVE: Data loaded successfully (22050 Hz, 16 bit, 1 channels)
INFO: FILEIO: [data/zap.wav] File loaded successfully
INFO: WAVE: Data loaded successfully (22050 Hz, 16 bit, 1 channels)
INFO: FILEIO: [data/expl1.wav] File loaded successfully
INFO: WAVE: Data loaded successfully (22050 Hz, 16 bit, 1 channels)
INFO: FILEIO: [data/blip.wav] File loaded successfully
INFO: WAVE: Data loaded successfully (22050 Hz, 16 bit, 1 channels)
INFO: FILEIO: [data/damage.wav] File loaded successfully
INFO: WAVE: Data loaded successfully (22050 Hz, 16 bit, 1 channels)
INFO: FILEIO: [data/xwingshot1.wav] File loaded successfully
INFO: WAVE: Data loaded successfully (22050 Hz, 16 bit, 1 channels)
INFO: FILEIO: [data/xwingshot2.wav] File loaded successfully
INFO: WAVE: Data loaded successfully (22050 Hz, 16 bit, 1 channels)
INFO: FILEIO: [data/tieshot2.wav] File loaded successfully
INFO: WAVE: Data loaded successfully (22050 Hz, 16 bit, 1 channels)
INFO: FILEIO: [data/tiefly0.wav] File loaded successfully
INFO: WAVE: Data loaded successfully (22050 Hz, 16 bit, 1 channels)
INFO: FILEIO: [data/tiefly1.wav] File loaded successfully
INFO: WAVE: Data loaded successfully (22050 Hz, 16 bit, 1 channels)
INFO: FILEIO: [data/r2d2-1.wav] File loaded successfully
INFO: WAVE: Data loaded successfully (22050 Hz, 16 bit, 1 channels)
INFO: FILEIO: [data/swlogo.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (256x128 | R8G8B8 | 1 mipmaps)
INFO: TEXTURE: [ID 4] Texture loaded successfully (256x128 | R8G8B8 | 1 mipmaps)
INFO: FILEIO: [data/xwing.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (64x64 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 5] Texture loaded successfully (64x64 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [data/exhaust1.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (32x32 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 6] Texture loaded successfully (32x32 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [data/shot1.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (4x8 | R8G8B8 | 1 mipmaps)
INFO: TEXTURE: [ID 7] Texture loaded successfully (4x8 | R8G8B8 | 1 mipmaps)
INFO: FILEIO: [data/lives.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (32x32 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 8] Texture loaded successfully (32x32 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [data/rpm.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (32x32 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 9] Texture loaded successfully (32x32 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [data/multishot.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (32x32 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 10] Texture loaded successfully (32x32 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [data/bomb1.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (8x8 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 11] Texture loaded successfully (8x8 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [data/enter.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (32x32 | R8G8B8 | 1 mipmaps)
INFO: TEXTURE: [ID 12] Texture loaded successfully (32x32 | R8G8B8 | 1 mipmaps)
INFO: FILEIO: [data/esc.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (32x32 | R8G8B8 | 1 mipmaps)
INFO: TEXTURE: [ID 13] Texture loaded successfully (32x32 | R8G8B8 | 1 mipmaps)
INFO: FILEIO: [data/tief_strip.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (576x32 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 14] Texture loaded successfully (576x32 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [data/tiei_strip.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (576x32 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 15] Texture loaded successfully (576x32 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [data/tieb_strip.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (576x32 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 16] Texture loaded successfully (576x32 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [data/spark_strip.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (512x64 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 17] Texture loaded successfully (512x64 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [data/bomexpl_strip.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (16384x256 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 18] Texture loaded successfully (16384x256 | R8G8B8A8 | 1 mipmaps)
INFO: FILEIO: [data/expl_strip.png] File loaded successfully
INFO: IMAGE: Data loaded successfully (2304x64 | R8G8B8A8 | 1 mipmaps)
INFO: TEXTURE: [ID 19] Texture loaded successfully (2304x64 | R8G8B8A8 | 1 mipmaps)
INFO: STREAM: Initialized successfully (48000 Hz, 16 bit, Stereo)
INFO: FILEIO: [data/crazy.mod] Music file loaded successfully
INFO:     > Sample rate:   48000 Hz
INFO:     > Sample size:   16 bits
INFO:     > Channels:      2 (Stereo)
INFO:     > Total frames:  10645423
INFO: STREAM: Initialized successfully (48000 Hz, 32 bit, Stereo)
INFO: FILEIO: [data/intro.compat.xm] Music file loaded successfully
INFO:     > Sample rate:   48000 Hz
INFO:     > Sample size:   32 bits
INFO:     > Channels:      2 (Stereo)
INFO:     > Total frames:  9013440
INFO: FILEIO: [data/SFDistantGalaxy.ttf] File loaded successfully
WARNING: FONT: [0x0024] Glyph height is bigger than requested font size: 49 > 48
WARNING: FONT: [0x0028] Glyph height is bigger than requested font size: 49 > 48
WARNING: FONT: [0x0029] Glyph height is bigger than requested font size: 49 > 48
WARNING: FONT: [0x002f] Glyph height is bigger than requested font size: 49 > 48
WARNING: FONT: [0x004a] Glyph height is bigger than requested font size: 49 > 48
WARNING: FONT: [0x005b] Glyph height is bigger than requested font size: 49 > 48
WARNING: FONT: [0x005c] Glyph height is bigger than requested font size: 49 > 48
WARNING: FONT: [0x005d] Glyph height is bigger than requested font size: 49 > 48
WARNING: FONT: [0x006a] Glyph height is bigger than requested font size: 49 > 48
WARNING: FONT: [0x007b] Glyph height is bigger than requested font size: 49 > 48
WARNING: FONT: [0x007c] Glyph height is bigger than requested font size: 49 > 48
WARNING: FONT: [0x007d] Glyph height is bigger than requested font size: 49 > 48
INFO: TEXTURE: [ID 20] Texture loaded successfully (1024x512 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Data loaded successfully (48 pixel size | 95 glyphs)
INFO: FILEIO: [data/SFDistantGalaxy.ttf] File loaded successfully
WARNING: FONT: [0x0024] Glyph height is bigger than requested font size: 25 > 24
WARNING: FONT: [0x0028] Glyph height is bigger than requested font size: 25 > 24
WARNING: FONT: [0x0029] Glyph height is bigger than requested font size: 25 > 24
WARNING: FONT: [0x002f] Glyph height is bigger than requested font size: 25 > 24
WARNING: FONT: [0x004a] Glyph height is bigger than requested font size: 25 > 24
WARNING: FONT: [0x005b] Glyph height is bigger than requested font size: 25 > 24
WARNING: FONT: [0x005c] Glyph height is bigger than requested font size: 25 > 24
WARNING: FONT: [0x005d] Glyph height is bigger than requested font size: 25 > 24
WARNING: FONT: [0x006a] Glyph height is bigger than requested font size: 25 > 24
WARNING: FONT: [0x007b] Glyph height is bigger than requested font size: 25 > 24
WARNING: FONT: [0x007c] Glyph height is bigger than requested font size: 25 > 24
WARNING: FONT: [0x007d] Glyph height is bigger than requested font size: 25 > 24
INFO: TEXTURE: [ID 21] Texture loaded successfully (512x256 | GRAY_ALPHA | 1 mipmaps)
INFO: FONT: Data loaded successfully (24 pixel size | 95 glyphs)
INFO: TEXTURE: [ID 2] Unloaded texture data from VRAM (GPU)
INFO: SHADER: [ID 3] Default shader unloaded successfully
INFO: TEXTURE: [ID 1] Default texture unloaded successfully
INFO: Window closed successfully
WARNING: GLFW: Error: 65537 Description: The GLFW library is not initialized
An unhandled exception occurred at $00007EFEBE5C487D:
EAccessViolation: Access violation
  $00007EFEBE5C487D

fpc build option:
Code: [Select]
-B
 -Mobjfpc
 -Sh
 -dRAY_DYNAMIC
 -FE"$HERE/bin"
 -Fl"$HERE/lib"
 -Fu"$HERE/src/*"
 -FU"$HERE/units"
 "$HERE/src/galaxian/GalaxianWar.lpr"

fwiw: link error I report my other message when build raylib 6 when use you header that my error (I make mistake)

Have thank for raylib header and game. Is fun retro game.
A docile goblin always follow HERMES.md

paweld

  • Hero Member
  • *****
  • Posts: 1733
Re: Star Wars Galaxian
« Reply #42 on: August 09, 2026, 08:16:22 am »
Win 10 x64, Lazarus trunk / FPC 3.2.3-x86_64, raylib 6.0 win64 minigw
Best regards / Pozdrawiam
paweld

olatov

  • Full Member
  • ***
  • Posts: 110
Re: Star Wars Galaxian
« Reply #43 on: August 09, 2026, 09:59:49 am »
The latest version just has a mistake
Code: Pascal  [Select][+][-]
  1.   InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, 'SWGalaxian');
  2.   SetConfigFlags(FLAG_VSYNC_HINT);

As SetConfigFlags sets init configuration, it has no effect after InitWindow. It has to either go before InitWindow (as it was previously), or be replaced with SetWindowState to toggle the flag after the window is created.


paweld

  • Hero Member
  • *****
  • Posts: 1733
Re: Star Wars Galaxian
« Reply #44 on: August 09, 2026, 11:09:28 am »
@Nimbus - thanks for the explanation.
After setting the correct order, the FPS drops to 59–60, and resource usage is indeed lower—the GPU usage is around 1.5%, and the CPU load is also lower, but still above 10%.
Best regards / Pozdrawiam
paweld

 

TinyPortal © 2005-2018