MausGames Posted December 24, 2015 Share Posted December 24, 2015 (edited) I'm giving the DPC+ kernel a try, but since there is no way to track cycles and I have no way to test on real hardware - I was wondering if any of you code wizards would be willing to take a look and see if there is anything in my code that can be done another way to use less cycles? I have a lot of the game mechanics done, and I have a feeling I'm already going way over on cycles. Edited to add dingy1c.bas which is the latest version with comments, and descriptive variables. dingy.bin dingy1c.bas Edited December 24, 2015 by MausGames 2 Quote Link to comment Share on other sites More sharing options...
MausGames Posted December 24, 2015 Author Share Posted December 24, 2015 I know by posting this I'm being lazy, and maybe kind of a jerk saying "please clean up my awful mess for me.", but this is what always happens. I think I have a good idea, but my code turns into garbage that gives me a headache and makes me abandon ship. Some of you might think "Well, if you can't get past that you aren't really a good programmer and don't deserve to complete a project." That's probably true, but it's been a dream for over 30 years, and I'm not really much closer than when I started with this, so why not ask for help? I'd definitely want to give credit for any teamwork with it, and I'm determined to finish this one - it's the perfect game for me to power through and see to the end. If I have to trim it down to almost nothing, that's what I'll do. Since this is a screen-at-a-time game, if I can just get a clean, efficient version of the code I already have done, my chances will be better than with anything I've tried before. and I know at some point I'm going to have to get a Harmony so I can test things myself. Here's hoping I get that far this time! Quote Link to comment Share on other sites More sharing options...
+splendidnut Posted December 24, 2015 Share Posted December 24, 2015 The most useful piece of advise I can give you would be: Comment your Code. Learning to/being able to comment your code will help you out in the long run. After walking away from a project, just for a little bit, we tend to lose context of what code does what. Commenting as you go will help give yourself hints in the future as well as help you think more about what you are doing... and actually improve your skills in the long run. AND It would be immensely helpful to the rest of us, and probably lead to more people stepping up to help. You know your code way better than the rest of us. Tell us what it does. At the very least, indicate where you handle the different player conditions of grabbing the vine, jumping, shooting, etc. After a quick glance, my first question is: What are the variables b, c, and d used for? 1 Quote Link to comment Share on other sites More sharing options...
+splendidnut Posted December 24, 2015 Share Posted December 24, 2015 (edited) Example of simple code commenting that is quite helpful: http://atariage.com/forums/topic/247017-help-with-1st-game/ Edited December 24, 2015 by splendidnut Quote Link to comment Share on other sites More sharing options...
MausGames Posted December 24, 2015 Author Share Posted December 24, 2015 (edited) Ok I cleaned it up a bit and added some comments. New version attached in OP. Thank you for the advice. Edited December 24, 2015 by MausGames Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted December 24, 2015 Share Posted December 24, 2015 If you need a self-esteem boost, just post that you're thinking about deleting your account. I jumped through a few flaming hoops and got the Harmony cart software working on my new computer. I downloaded your .bin file to the Harmony cart and the only problem I see so far is that the screen jumps when the program restarts. A drawscreen at the time of restarting should fix that. Quote Link to comment Share on other sites More sharing options...
MausGames Posted December 24, 2015 Author Share Posted December 24, 2015 Thank you so much RT, that is great news! I could tell that I needed to add a drawscreen right after defining the PF, just hadn't done it yet. I'm honestly surprised the main loop runs properly though, there is so much going on. I'm still hoping for help optimizing though because for this screen I still have to: Animate both flying enemies. Set collisions for flying enemies, potion, gold, and the rock near the hole. Make lives/health bar functional. Finish adding and debugging sound fx. Add scoring. Add code to move on to next screen when reaching edge of current screen. This screen is about as busy as any will get, so if I can get those things to fit with what I already have, I'll be pretty confident in this working. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted December 24, 2015 Share Posted December 24, 2015 Besides having useful comments, it helps to use aliases instead of plain old variable names. Meaningful variable names help you know at a glance what a variable is for. Check out the dims in Princess Rescue on the bB page. Quote Link to comment Share on other sites More sharing options...
MausGames Posted December 24, 2015 Author Share Posted December 24, 2015 I know. I'd planned to do that as well, I just wanted to see how much of what I had planned I could get into the cycles available (before realizing I had no way to know how many I'm even using) before I made the code any longer than it already is. Scrolling through multiple pages from top to bottom really slows me down. It's on the to-do, and yeah I probably should have done that before asking for help. I'm just excited about this project. Quote Link to comment Share on other sites More sharing options...
MausGames Posted December 24, 2015 Author Share Posted December 24, 2015 Example of simple code commenting that is quite helpful: http://atariage.com/forums/topic/247017-help-with-1st-game/ Ok, I've gone through and added proper comments that should clear things up quite a bit. Thank you a lot for the advice, it is already much easier to follow what's going on. Quote Link to comment Share on other sites More sharing options...
MausGames Posted December 24, 2015 Author Share Posted December 24, 2015 RT, I think you refer to me sometimes as an example of what not to do with bB, especially in reference to talking crap about finishing projects instead of actually finishing them. I hope you have faith in me finishing this one. I really think I can, and it will make all of my previous attempts worthwhile as practice. This game is going to be absolutely huge, possibly the biggest platformer of all time for the 2600, and once I'm past this initial cycle-cram it will almost all be doing, not figuring out how to do. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted December 24, 2015 Share Posted December 24, 2015 RT, I think you refer to me sometimes as an example of what not to do with bB, especially in reference to talking crap about finishing projects instead of actually finishing them. I hope you have faith in me finishing this one. I really think I can, and it will make all of my previous attempts worthwhile as practice. This game is going to be absolutely huge, possibly the biggest platformer of all time for the 2600, and once I'm past this initial cycle-cram it will almost all be doing, not figuring out how to do. Yep, the best laid plans of mice and men often go awry: en.wiktionary.org/wiki/best_laid_plans A proverbial expression used to signify the futility of making detailed plans when the ability to fully or even partially execute them is uncertain. It's better to speak softly and program with a big stick or something like that. I stink at programming, I'm lazy, and I have a crappy memory, so I try not to post a bunch of stuff that I plan to do. I just need to focus on one thing and try to get it done, but I manage to get punched in the face by distractions, procrastination, or writer's block sooner or later. That's one reason why I made these pages: randomterrain.com/rt-motivation-and-creativity-page-for-programmers.html randomterrain.com/rt-free-game-making-ideas.html Quote Link to comment Share on other sites More sharing options...
RevEng Posted December 24, 2015 Share Posted December 24, 2015 After a quick glance, my first question is: What are the variables b, c, and d used for? This. Maus, my bare-minimum requirement for checking other people's code is they use descriptive variables. Life is too short to slog through someone else's code and try to figure out what context all of the variables are meant to have. For your own sake, you need to take some time and ensure your code is self-documenting. Give your variables descriptive names. Create subroutines with well-defined purpose and descriptive names. This is most of the battle in creating a program you won't get lost in weeks later. Code comments should be there only to make up for deficiencies in self-documentation, when something isn't blindingly obvious despite the descriptive names. Quote Link to comment Share on other sites More sharing options...
MausGames Posted December 24, 2015 Author Share Posted December 24, 2015 This. Maus, my bare-minimum requirement for checking other people's code is they use descriptive variables. Life is too short to slog through someone else's code and try to figure out what context all of the variables are meant to have. For your own sake, you need to take some time and ensure your code is self-documenting. Give your variables descriptive names. Create subroutines with well-defined purpose and descriptive names. This is most of the battle in creating a program you won't get lost in weeks later. Code comments should be there only to make up for deficiencies in self-documentation, when something isn't blindingly obvious despite the descriptive names. Ok, I will do that right now. Thank you! 1 Quote Link to comment Share on other sites More sharing options...
MausGames Posted December 24, 2015 Author Share Posted December 24, 2015 I've added descriptive variables and commented code - So things have already greatly improved with this project since posting the files this morning. The newest bas has been added to the OP. Now here's hoping some cycle-saving can be had! Quote Link to comment Share on other sites More sharing options...
MausGames Posted January 7, 2016 Author Share Posted January 7, 2016 I've animated the enemies, and am now working on the lives/hp code. This really is very hard without a way to test on hardware - I'm going to have to invest in a Harmony if I want to see this through. Latest version attached. dingy1d.bin 3 Quote Link to comment Share on other sites More sharing options...
+splendidnut Posted January 7, 2016 Share Posted January 7, 2016 @MausGames Pretty awesome looking so far! I'm not too familiar with bBasic but, after taking a quick look in Stella, it appears that you have plenty of time for more logic. Also... the Stella emulator perfectly emulates an actual Atari 2600. There are only a few minor differences so you should be fine in regards to this running on actual hardware. Quote Link to comment Share on other sites More sharing options...
MausGames Posted January 8, 2016 Author Share Posted January 8, 2016 (edited) How do you tell in Stella? I've Googled, searched here, read the Stella documentation, and I still have no idea. Thank you, by the way. I appreciate you taking the time to check it out. Edited January 8, 2016 by MausGames Quote Link to comment Share on other sites More sharing options...
+splendidnut Posted January 8, 2016 Share Posted January 8, 2016 How do you tell in Stella? I've Googled, searched here, read the Stella documentation, and I still have no idea. Thank you, by the way. I appreciate you taking the time to check it out. It's a bit of a trick and requires a basic understanding of 6502 assembler and the internal workings of the Atari 2600... I switched into the debugger and stepped thru the code using the [+ Scan] button until after the display was done rendering, found where a timer (TIM64T) was setup at (Address 1B07) and then I watched the code until it hit the loop which waits until the timer runs out which is at (Address 1957). I'd say you only used about 50% of your available cycles. That's just an educated guess though... Quote Link to comment Share on other sites More sharing options...
RevEng Posted January 8, 2016 Share Posted January 8, 2016 Unless something has changed very recently, don't trust stella with regards to ARM cycles. To stella, any DPC+ functions like collision detection and scrolling happen instantly, which isn't accurate. A few programmers have been caught by this so far, and have had to rework their games to be more efficient to stop the screen from bouncing. It's best to cycle check on real hardware. Quote Link to comment Share on other sites More sharing options...
+splendidnut Posted January 8, 2016 Share Posted January 8, 2016 To start off with, I am not a bBasic programmer. Unless something has changed very recently, don't trust stella with regards to ARM cycles. To stella, any DPC+ functions like collision detection and scrolling happen instantly, which isn't accurate.A few programmers have been caught by this so far, and have had to rework their games to be more efficient to stop the screen from bouncing. It's best to cycle check on real hardware. But I am a bit confused by this. I was only looking at the 6507 code. Is there a way to even see the ARM code in Stella? From what I've read on DPC+ itself, there appears to be no collision detection or scrolling features. Unless you are talking specifically about the DPC+ kernel in bBasic. Does bBasic add upon the features of DPC+... and if so... is there documentation or source code? Could you please elaborate on this more and provide references to places where programmers have been caught off guard? How do you cycle check on real hardware beyond just checking for a stable picture? I apologize for the tangent but I wanted to clear up any confusion I or anyone else may have. Quote Link to comment Share on other sites More sharing options...
Jinroh Posted January 8, 2016 Share Posted January 8, 2016 Wow! Looking really cool! I love Screen->Screen games like Pitfall and this! Looking forward to your next update! Quote Link to comment Share on other sites More sharing options...
RevEng Posted January 8, 2016 Share Posted January 8, 2016 [...]But I am a bit confused by this. I was only looking at the 6507 code. Is there a way to even see the ARM code in Stella?[...] Not that I'm aware of. From what I've read on DPC+ itself, there appears to be no collision detection or scrolling features. Unless you are talking specifically about the DPC+ kernel in bBasic. Does bBasic add upon the features of DPC+... and if so... is there documentation or source code? Could you please elaborate on this more[...] DPC+ has a few simple built-in ARM functions that Stella won't accurately capture cycle usage for - 0:Parameter Pointer Reset, 1:Copy ROM to Fetcher, 2:Copy Value to Fetcher. bB extends that with the functions mentioned and a few other simple ones. The source code for the additional functions is part of the most recent bB distribution, in includes/custom. DPC+ itself is closed, except for the Stella implementation. [...] and provide references to places where programmers have been caught off guard? How do you cycle check on real hardware beyond just checking for a stable picture? jrok ran into it winkdot ran into it. There are more, but these were brought to my attention in PMs. Checking that the frame is stable on real hardware is the only method available right now. 1 Quote Link to comment Share on other sites More sharing options...
+splendidnut Posted January 8, 2016 Share Posted January 8, 2016 (edited) @RevEng Thanks for clarifying. Edited January 8, 2016 by splendidnut Quote Link to comment Share on other sites More sharing options...
Papa Posted January 11, 2016 Share Posted January 11, 2016 (edited) Cool Pitfall clone! I like the bad guys and the level art is excellent. Nice use of DPC+ so far! The new character graphics are a nice addition, too. Edited January 11, 2016 by Papa Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.