The following warnings occurred:
Warning [2] Undefined array key "fragment" - Line: 1492 - File: inc/class_parser.php PHP 8.1.34 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 1492 errorHandler->error_callback
/inc/class_parser.php 1638 postParser->mycode_parse_video
[PHP] postParser->mycode_parse_video_callback
/inc/class_parser.php 513 preg_replace_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 817 postParser->parse_message
/showthread.php 913 build_postbit
Warning [2] Undefined array key "query" - Line: 1503 - File: inc/class_parser.php PHP 8.1.34 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 1503 errorHandler->error_callback
/inc/class_parser.php 1638 postParser->mycode_parse_video
[PHP] postParser->mycode_parse_video_callback
/inc/class_parser.php 513 preg_replace_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 817 postParser->parse_message
/showthread.php 913 build_postbit
Warning [2] Undefined array key 1 - Line: 1508 - File: inc/class_parser.php PHP 8.1.34 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 1508 errorHandler->error_callback
/inc/class_parser.php 1638 postParser->mycode_parse_video
[PHP] postParser->mycode_parse_video_callback
/inc/class_parser.php 513 preg_replace_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 817 postParser->parse_message
/showthread.php 913 build_postbit
Warning [2] Undefined array key 0 - Line: 1585 - File: inc/class_parser.php PHP 8.1.34 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 1585 errorHandler->error_callback
/inc/class_parser.php 1638 postParser->mycode_parse_video
[PHP] postParser->mycode_parse_video_callback
/inc/class_parser.php 513 preg_replace_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 817 postParser->parse_message
/showthread.php 913 build_postbit
Warning [2] Undefined array key "v" - Line: 1589 - File: inc/class_parser.php PHP 8.1.34 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 1589 errorHandler->error_callback
/inc/class_parser.php 1638 postParser->mycode_parse_video
[PHP] postParser->mycode_parse_video_callback
/inc/class_parser.php 513 preg_replace_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 817 postParser->parse_message
/showthread.php 913 build_postbit




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Xenon 2 Megablast Port
#9


XENON (NGPC) how we got the frame rate stable
The big one: the emulator runs without wait states. NgpCraft can model them, but only if you ask it to. The core ships with Default cart_wait=0. Silicon-calibrated values, confirmed on our own hardware with the emulator author's calibration ROM: cart_wait 3, cart_data_wait 0, ldir_cost 14 (the datasheet's 7 is a floor), vram_wait 3.

That is a factor of 2.88 same scene, same build: 99,638 vs 286,958 cycles per frame. Code that reads a lot of instruction bytes is otherwise ~3.4x too cheap, which is exactly why plausible optimisations kept measuring "exactly zero" for us. It also explained our hardware readings: the 30 fps build needed 3.01 VBlanks per frame — the game never ran at 30 fps.

Two measurement traps. You cannot measure a block that creates work by switching it off: our enemy dispatch loop reported 11.9 % that way, the real figure is 1.3 % (the rest was "no enemies, so no drawing and no collisions"). And the test scene is part of the measurement  the same pass was worth 18 %, 8 % and 3 % in three different scenes. We optimised the wrong one for a full round and saw nothing of it on hardware.

What helped, 45 % together:

Skip off-screen objects entirely: 27 %. Ours had an animation tick running independently of their position, so the draw routine searched every frame for screen rows that didn't exist for them. But the guard must be cheaper than what it prevents — our first version used the same search as the guard and was 48 % slower than no guard at all.
Linear searches out of per-frame loops: 16 %. One ran per cell instead of per row; a one-entry cache was enough.
Function calls out of cell loops  two per cell, each re-deriving the same values.
Struct sizes to powers of two: 1–13 %. Otherwise cc900 emits a 16-bit multiply for every field[i].x (26 cycles vs 2 for a register move). It can backfire on small structs though: field displacements leave the 8-bit range and the code grows. Padding 18 → 32 bytes cost us 1.2 %.
Pointers instead of indices only where register pressure is low the same change: −2.5 % in a draw loop, +1.9 % in an update loop.
What didn't help: flicker multiplexing for player shots (+1.4 %), drawing every second frame (only pays as a whole; the separable parts are 1.7 % together), halving the enemy update (+9.6 %, enemies stop despawning).

Result: a constant 20 fps with headroom instead of a wobbly 20-to-15. That's as far as we got with this object count — a pro can probably squeeze out a bit more.

Sorry for the German comments ?

If you find anything else, that would be great, though I doubt it'll be possible to get the project running at a steady 30 fps.

I've updated GitHub
Reply


Messages In This Thread
Xenon 2 Megablast Port - by Napomex - 07-17-2026, 04:59 AM
RE: Xenon 2 Megablast Port - by Ahchay - 07-17-2026, 06:24 AM
RE: Xenon 2 Megablast Port - by sodthor - 07-17-2026, 06:45 PM
RE: Xenon 2 Megablast Port - by Ahchay - 07-17-2026, 07:28 PM
RE: Xenon 2 Megablast Port - by Napomex - 07-18-2026, 08:44 AM
RE: Xenon 2 Megablast Port - by Napomex - 07-31-2026, 06:24 AM
RE: Xenon 2 Megablast Port - by sodthor - 07-31-2026, 04:55 PM
RE: Xenon 2 Megablast Port - by sodthor - 08-01-2026, 06:30 AM
RE: Xenon 2 Megablast Port - by Napomex - 08-01-2026, 07:35 AM
RE: Xenon 2 Megablast Port - by sodthor - 08-02-2026, 03:27 AM
RE: Xenon 2 Megablast Port - by sodthor - 08-02-2026, 03:45 AM
RE: Xenon 2 Megablast Port - by Napomex - 08-02-2026, 07:19 AM
RE: Xenon 2 Megablast Port - by sodthor - 08-03-2026, 01:07 AM
RE: Xenon 2 Megablast Port - by Napomex - 08-03-2026, 05:43 AM
RE: Xenon 2 Megablast Port - by Napomex - 08-05-2026, 04:07 AM
RE: Xenon 2 Megablast Port - by sodthor - 08-05-2026, 06:10 AM
RE: Xenon 2 Megablast Port - by Ahchay - 08-05-2026, 05:24 PM
RE: Xenon 2 Megablast Port - by sodthor - 08-05-2026, 11:39 PM
RE: Xenon 2 Megablast Port - by Ahchay - 08-06-2026, 03:50 AM
RE: Xenon 2 Megablast Port - by Napomex - 08-08-2026, 06:17 AM
RE: Xenon 2 Megablast Port - by sodthor - 08-08-2026, 06:35 AM
RE: Xenon 2 Megablast Port - by sodthor - 08-08-2026, 07:45 AM
RE: Xenon 2 Megablast Port - by Ahchay - 08-08-2026, 08:13 AM
RE: Xenon 2 Megablast Port - by Napomex - 08-08-2026, 08:32 AM
RE: Xenon 2 Megablast Port - by sodthor - 08-10-2026, 05:20 AM
RE: Xenon 2 Megablast Port - by Ahchay - 08-10-2026, 06:41 AM
RE: Xenon 2 Megablast Port - by sodthor - 08-12-2026, 11:54 PM
RE: Xenon 2 Megablast Port - by Napomex - 09-20-2026, 10:21 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)