|
Post by lamptonworm on Sept 16, 2015 19:47:53 GMT
Hi everyone, For those more experienced with AGD, can you offer a newbie some advice? I've got a keen eye on "Memory:" and can see things eating it up; my question is that I want to leave enough memory free to be able to add a loading screen, a hud backdrop, and one or ideally two pieces of short looping music, and edit to continue basic edits of the game for bugs etc. I want to be sure I leave some space for this while mapping out the main game-play first. Loading screen may not matter as that data may get re-used once the game is loaded anyway (?), but any general tips on when to start scaling back? The manual indicates the memory is what is available to your app, do I have to take into account things like music into that quota also (perhaps not - that is what the 'unused' memory is for in misc.)? If it gets too low, will I be unable to make edits to events, as I've read in other posts? Cheers, LW.
|
|
|
Post by andrewvanbeck on Sept 17, 2015 7:27:39 GMT
Hopefully editing events won't be an issue in the next version, Jonathan has apparently got it working without relying on the free memory.
It can be a pain though, that 23k or so doesn't stretch far. I think a 16x16 sprite image needs 256 bytes, as it'll be pre-shifted 8 times for the sake of performance. An object should only use 32 bytes, because it isn't pre-shifted. So use an object for pickups whenever you can, consider that you can have 8 different objects per sprite frame.
The screen layout data can get a bit bulky if you use too many different blocks in a row. If you have 5 blocks in a row, all different, then it'll take up 10 bytes, if all the blocks are the same then it might just be 2 - because there's a repeat value along with the block. This will usually always work in our favour because all that blank space is compressed. Blocks themselves probably take 10 or 12 bytes each and tend not to have a huge impact on memory, in fact in most cases I'd say the extra memory you need to have a different block in the map data is probably more than the memory it takes for the block itself.
I usually leave the map editing till last, it's good to get your big events all tested and working fine before fill up the memory - when I run into issues I tend to just delete some sprite frames that I can replace, like mirrored copies of sprite images are the first to go when I'm short on memory and need to edit an event.
The equals sign in events can often be omitted, like:
IF A = 1 LET B = 2 ENDIF
Could be...
IF A 1 LET B 2 ENDIF
And that'll save 2 whole bytes! - might seem small but in a large event you might save a worthwhile bit of ram.
The loading screens don't take up 'game' ram, but music routines have to reside somewhere in ram, there are a few posts on the subject of music that you should read up on if you haven't already. I'm glad to probably be able to have a 'wait for key' intro tune, but some people are adding AY chip music during gameplay, which is awesome but well beyond my skillset. I think a loading screen will only take up screen ram, but an additional hud layout screen would have to be moved into screen ram, and it would have to be a whole screen because the ink and paper colour data is stored after the pixel data. Shame, might have been useful to have say, just the top 48 pixels stored as an image.
I don't know how memory mapping works on the speccy - but consider that AGD games are designed to work on any 48k speccy, maybe there's a whole world of free memory available if you restrict the game to 128k. That might allow us to move memory about with far less concerns, having screens and music routines loaded into the extended memory waiting to be called or moved.
|
|
|
Post by lamptonworm on Sept 17, 2015 8:18:51 GMT
Thanks for the detailed reply, its appreciated.
|
|
|
Post by alessandro on Sept 17, 2015 22:06:48 GMT
Another way of saving 2 bytes is using TO instead of FROM, for instance:
SUBTRACT 1 TO A instead of
SUBTRACT 1 FROM A Limiting frames in sprite animations will also help to consume less memory.
|
|