|
Post by landeel on Oct 10, 2015 16:26:41 GMT -5
It's a platformer, but the map changes as the player collects items, and some special items will create new bricks. My maps are 256x64 of integers (32 KB). The 2d array is working fine so far, but the size in memory could be cut by half if I could do an array of bytes.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Oct 10, 2015 16:38:57 GMT -5
It's a platformer, but the map changes as the player collects items, and some special items will create new bricks. Items ( generally ) only concern the player ( and not the enemies ) .. but how do the "special items that create new bricks" work? Similar to a P-Switch in Super Mario World ( as-in it creates bricks at pre-defined locations )? Or is it more like Minecraft? My maps are 256x64 of integers (32 KB). The 2d array is working fine so far, but the size in memory could be cut by half if I could do an array of bytes. Well, if your code fits within the VBlank and you've got RAM to spare it doesn't really matter that you're using a 2D array of integers. But otherwise, i'd recommend against it
|
|
|
Post by landeel on Oct 10, 2015 20:46:22 GMT -5
More like Mario. To be more clear, my game will be an enhanced remake of this one that I made for PC: cmcgames.darkphear.com/2012/01/yagac.htmlThe code is very optimized, it uses the scroll and when the player moves it only redraws a single line or column of tiles, all done offscreen. I just hope I can fit all the other stuff in the remaining memory. I'll post a small demo when I have more to show.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Oct 11, 2015 5:23:09 GMT -5
In that case you don't need to have your map in RAM. Instead of updating tiles in RAM when the map changes ( after hitting a P-Switch ), update a value that you use as a bit-mask when checking ( your map in ROM ) for collision.
|
|
|
Post by landeel on Oct 11, 2015 8:11:33 GMT -5
Good idea, if I run out of memory I'll give it a try.
|
|
|
Post by landeel on Oct 12, 2015 15:22:09 GMT -5
From my experiments, it looks like the error is caused by the IFs, not by accessing the array.
|
|
|
Post by vetea on Oct 12, 2015 15:42:58 GMT -5
Delete all FUNCTION and replace it by SUB ! My last project, Papi Commando ( I'm still working on it ... ), the code reach 19 000 lines of code ! And it compiles perfectly. I've just removed all the FUNCTION I use.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Oct 12, 2015 16:54:24 GMT -5
From my experiments, it looks like the error is caused by the IFs, not by accessing the array. Impossible. Delete all FUNCTION and replace it by SUB ! Another ( ugly ) workaround is calling functions using the subroutine syntax and collecting the result from the according register yourself. For example .. This has some side-effects / downsides though .. so be warned!
|
|
|
Post by landeel on Oct 12, 2015 16:59:58 GMT -5
Mine has 3314 lines so far, and with a few adjustments it still compiles. I'll try removing the functions. Are asm functions ok?
|
|
|
Post by vetea on Oct 12, 2015 18:03:34 GMT -5
ASM functions cause me an ' BSR Allign_Heap2' when I call them. Like Titan say, you can modify the function by many ways ... As I do in this ASM Function : Original : declare asm function xgm_isPlayingPCM(d0.w as integer) move.w #$100,($A11100) ; Send the Z80 a bus request move.w #$100,($A11200) NOP NOP NOP NOP NOP
and.b ($A00102),d0 ; get channel playing status move.w #$000,($A11100) ; release the Z80 bus end function code here
Modified by SUB : declare asm sub xgm_isPlayingPCM(d0.w as integer) move.w #$100,($A11100) ; Send the Z80 a bus request move.w #$100,($A11200) NOP NOP NOP NOP NOP
and.b ($A00102),d0 ; get channel playing status move.w #$000,($A11100) ; release the Z80 bus move.w d0,(__INTEGER_Playsound) end sub code here
I've just used a Variable to return the result of a d0 Data Register. After all, it's just my little contribution .. I'm not a Master Bex's Coder. Good luck.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Oct 12, 2015 19:47:18 GMT -5
If you're using Stef's driver, you can also remove the functions you aren't ever going to use. Not all projects will need to check to see if music is already playing (you should know that anyway, based on your program flow ), though there are some exceptions.
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Oct 12, 2015 21:02:41 GMT -5
Because I've run into this error quite a few times after using Stef's XGM driver (sorry Stef! ), and instead of wasting time by using BEX Extractor, then manually modifying the files to compile everything, I just made a program to fix the BSR commands on the fly, and will still let you compile through BEX without any issues. www.second-dimension.com/BSRFix.zipPlease read the readme.txt file and adjust the BSRFix.ini file as necessary. Application requires a few DLL's that are not included, but if anyone has any issues with finding them, I'll make an installer to set everything up. Cheers!
|
|
|
Post by vetea on Oct 13, 2015 2:13:10 GMT -5
Unfortunatly, it's the only function I use ! Thanks Elusive for this wonderful tool !!
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Oct 13, 2015 7:57:26 GMT -5
Unfortunatly, it's the only function I use ! Thanks Elusive for this wonderful tool !! That function was just an example you can remove the other functions you don't use, though (as long as they aren't referenced by another routine), which will save space and reduce the risk of running into this error. Hopefully the little tool will solve this issue for everyone until I can write my next computer application
|
|
|
Post by landeel on Oct 13, 2015 9:05:57 GMT -5
elusive's program didn't work with wine. I have replaced all functions for subs, and it looks like the problem is gone. Thanks.
|
|