Calculator Community > Axe

Converting from Prgm to App

(1/4) > >>

Way way late, but thanks to both E37 and Zeda I was able to implement a working A* Algorithm in my game. The source for the project is on Github here:
I've been pretty inconsistent in working on it, but recently I started back up again. I've reached the point where I need to make the program into an app. I thought it would be as simple as change from compiling to No Shell to Compiling as an Application, but once I did it looked like the my appvars were somehow being corrupted. When I moved around the map random tiles would get changed when I left an area and came back to it. The attached gif illustrates what I mean.

You can also see a little confused slime walking outside the map. This is because the DistMap appvar I'm using to calculate the AI is somehow also being corrupted. It's initially spawned in the room that gets corrupted then wanders its way out ignoring collision. I even compiled an older working version to verify and it seems to confirm. Everything works as a program and not as an App. I would like any help in beginning to convert this project into an app. And any other advice/optimizations you may have. Thanks!

I don't see any overflow protection for A* pathfinding although I could have missed it in the complex logic. Right now you create appvFLOOR before appvDISTMAP. Try creating appvDISTMAP first (Just invert the order of the two GetCalc lines in main) If you are overflowing, that should change the overflow behavior. If you aren't then nothing should change. I noticed you used sign{ in quite a few places. I don't know what that is supposed to be, my best guess is the signed{} command. If it is nib{} then that would be the source of your problems. But, based on how you are using it, it looks like signed{} which is fine. The line 'Fill(^^oTargetX,400,0)' seems a little strange but it should be safe. I don't have any other suggestions, I took a hard look at it for over an hour and didn't see any red flags. Do you reset ram after every time you quit normally?

Also that is some beautifully optimized tile drawing code.

Thanks for taking the time to look it over and reply. I tried inverting it and the issue still persisted. I'm not sure what the problem could be. Can you try compiling and running it when you get a chance? If possible, uncomment the first AddMob so that you can also test the AI to see how it behaves on your calc. I open a new Wabbit when I compile and test, so the RAM is always clear. Here's a screenshot showing what's happening with both the tilemap and the AI.

I don't know how to proceed with trying to fix it.

Also I can't take full credit for the tile code. It's mostly Runer's from his GRAYPKMN source that I modified and repurposed for monochrome. Took a while to read and understand haha. I'm also considering possibly using Fullrene or Crabcake if converting to an app is somehow impossible. I'll keep trying to debug this. Also if you're willing to help me learn and optimize my code maybe we can work together sometime. Thanks again.

I'll take a look. I'm kinda busy at the moment so it may be a couple days until I find an hour or two to sit down and hunt through it. If you just want to have over 8811 bytes of executable code, fullrene is probably a better choice over an app (just because it compiles faster) Since the inversion didn't change anything, I think compiling as an app just brings an already existing problem to the surface. None of your code does anything that would matter if it was compiled as app.

You shouldn't try optimizing until you get your code working or have a real need for it. Also, you don't have very much code in total. Are you really running into the execution limit? You are limited to 8811 bytes of code, not data. Your data can go above that limit. I guess I will see when I actually sit down and compile it ;)

I think I am going to do a full and final rewrite of this project. I'm encountering issues that I do not understand and quite frankly it has been very frustrating. I feel so helpless not knowing why my code behaves the way it does. Things that used to work no longer do with little to no modification. And I don't know if it's because of mistakes I made as a programmer or something I don't know about the language/calculator. I really really wanted to create a good game but it feels like I've been fighting the language at each step.


[0] Message Index

[#] Next page

Go to full version