Jump to content
IGNORED

Platformer WIP - Help Needed


MausGames

Recommended Posts

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.

post-9377-0-58004600-1450959708_thumb.gif

dingy.bin

dingy1c.bas

Edited by MausGames
  • Like 2
Link to comment
Share on other sites

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!

Link to comment
Share on other sites

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?

  • Like 1
Link to comment
Share on other sites

If you need a self-esteem boost, just post that you're thinking about deleting your account. :D

 

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. :D

 

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

@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.

Link to comment
Share on other sites

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... :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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. :)

Link to comment
Share on other sites

[...]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.

  • Like 1
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...