So I did a small memory analysis on JFDuke3D latest release regarding memory consumption and found the following:
1. Started the game with valgrind's `massif`, tracking all memory allocations.
2. Booted up "Holywood Hollocaust"
3. played the game a little.
The heap profiler that I got shows that JFDuke3D on 320x200 8-bit software mode consumes 22.76 Mb of Heap space.
Backtrace of allocations:
70.29% (23.5Mb) is spent in loadpics (engine.c:38, called by engine.c:7832)
11.01% (2.67Mb) is spent in setvideomode (sdlayer2.c:1076) called by setgamemode (engine.c:7576)
10% (2.4Mb) is used by some SDL unknown stuff, which probably can be cut
5% (~1.5mb) used for untracked stuff (less than massif treshold)
700k for audio buffers.
The size of static allocated objects is concerning, though. Binary uses 11Mb only for static allocated objects. Size of 10 largest objects in bytes :
Id Address Size Type Visibility Link Name
372: 00000000006fda00 [B]65536[/B] OBJECT LOCAL DEFAULT 25 sdlappicon_pixels
444: 0000000000876000 [B]65536[/B] OBJECT LOCAL DEFAULT 27 olinbuf
1042: 00000000011431a0 [B]73728[/B] OBJECT GLOBAL DEFAULT 27 hicreplc
1781: 000000000103d320 [B]73728[/B] OBJECT GLOBAL DEFAULT 27 waloff
2483: 0000000000d64e00 [B]73728[/B] OBJECT GLOBAL DEFAULT 27 actorscrptr
2802: 000000000115d5c0 [B]110592[/B] OBJECT GLOBAL DEFAULT 27 tile2model
1879: 0000000000d18e40 [B]131136[/B] OBJECT GLOBAL DEFAULT 27 script
2117: 0000000000d3a040 [B]144000[/B] OBJECT GLOBAL DEFAULT 27 MusicPtr
2003: 00000000010540e0 [B]163840[/B] OBJECT GLOBAL DEFAULT 27 sector
2318: 000000000109ae80 [B]163840[/B] OBJECT GLOBAL DEFAULT 27 voxoff
669: 0000000000caa5e0 [B]163840[/B] OBJECT LOCAL DEFAULT 27 vsp
2734: 00000000011054a0 [B]199680[/B] OBJECT GLOBAL DEFAULT 27 spriteext
2758: 0000000000eb2c80 [B]221184[/B] OBJECT GLOBAL DEFAULT 27 cac
140: 0000000000810240 [B]262144[/B] OBJECT LOCAL DEFAULT 27 distrecip
2839: 00000000011785c0 [B]294912[/B] OBJECT GLOBAL DEFAULT 27 hudmem
1248: 0000000000fa11c0 [B]524288[/B] OBJECT GLOBAL DEFAULT 27 wall
1098: 0000000000ef0980 [B]720896[/B] OBJECT GLOBAL DEFAULT 27 sprite
53: 0000000000740f00 [B]737280[/B] OBJECT LOCAL DEFAULT 27 smost
2727: 0000000000d793e0 [B]1179648[/B] OBJECT GLOBAL DEFAULT 27 hittype
555: 000000000088fd20 [B]4194304[/B] OBJECT LOCAL DEFAULT 27 pakmem
This sums up to 8.3 Megabytes, so we definitively have to reduce that. `pakmem`, for instance, seems to be used for multiplayer and thus can be removed. I could not find any references of `hittype` in code so it probably come from some macro expansion. `smost` size seems deeply tied to the maximum number of sprites that can be drawn by the engine, so probably this can be tunned down. For instance, JFDuke3D allocates spaces for 16k sprites, whereas Duke3DS allocates space for 2k sprites. And so on...
So if the JFBuild engine is able to run with smaller sprite numbers and cache buffers I'd say a port of JFDuke3D to Nintendo DSi is definitively possible.
Since we have the Duke3DS sourcecode we could also check if the author did some tuning in those variables.