Jump to content
IGNORED

Smooth Vertical Scrolling from DATA (Want 4-way)


Gemintronic

Recommended Posts

If you want to see how I did horizontal scrolling in Princess Rescue, just go to Random Terrain's Batari site, and he has my source code for it there, along with added documentation. You can find how I did my scrolling in there with the ScrollLeft and ScrollRight routines. I did use pfhscroll, but with some added code. When new data needed to show up, it would look at the new data I had in the level data table, using a pointer, to pick up the 2 new bytes, and then it would compare bit by bit with what the var screen variables had on the edge of the screen. If it didn't match up, it would flip the bit, saving time so it didn't redraw every bit on the edge of the screen.

 

(I haven't looked at your code) (yet)

 

hmm.

 

I wonder if it would be useful to store the data as sort of a table of difs or deltas (or whatever you'ld call them)

then just flip a bit if necessary, depending on what's in the table

Link to comment
Share on other sites

 

(I haven't looked at your code) (yet)

 

hmm.

 

I wonder if it would be useful to store the data as sort of a table of difs or deltas (or whatever you'ld call them)

then just flip a bit if necessary, depending on what's in the table

 

I'm not sure what you mean by that exactly. The level data is simply like this. Every 2 bytes represent the playfield from the top to the bottom vertically. Since Batari's resolution is 11 rows (12 if you count the invisible one, that I don't use). This leaves 5 extra bits that I use for enemy/object spawn in information. So the first byte is row 0 to row 7. So if one of this bits is on, on the screen (held in the varxx variable), that playfield block will be on, and if that new data shows that one bit in that one row is off, then it'll flip it or vice versa (it's off on the screen and will be flipped to be on). If it's the same then don't do anything. There's no need to. The first 3 bits of the second byte represent rows 8-10 and you repeat the same checks.

  • Like 1
Link to comment
Share on other sites

 

I'm not sure what you mean by that exactly.

 

I'm not sure exactly what I mean either (and, again, I haven't had a chance to look at your code)

 

And I'm just sorta thinking out loud.

 

from your description:

 

 

When new data needed to show up, it would look at the new data I had in the level data table, using a pointer, to pick up the 2 new bytes, and then it would compare bit by bit with what the var screen variables had on the edge of the screen.

 

What I'm thinking is rather than doing a comparison just have the level data table indicate if a bit needs flipping (build the results of the comparison into the table)

I wouldn't bet that that would save you anything I'm just wondering if it could.

Link to comment
Share on other sites

 

I'm not sure exactly what I mean either (and, again, I haven't had a chance to look at your code)

 

And I'm just sorta thinking out loud.

 

from your description:

 

 

 

What I'm thinking is rather than doing a comparison just have the level data table indicate if a bit needs flipping (build the results of the comparison into the table)

I wouldn't bet that that would save you anything I'm just wondering if it could.

 

I think I see where you are going with this, and it might work well if it scrolled in one direction and didn't go back, but with my games they scroll in both directions, which would mean when the data going the other way would have to be different to compensate, which would probably add to the size of the tables, sacrificing ROM space to gain a few CPU cycles. I know this is a constant game you play with programming on the Atari 2600. Sometimes you need more CPU cycles, and since you got the ROM space, do some pre-calculations so the CPU doesn't have to. And sometimes you need more ROM space, so you let the CPU do a little more work to produce the data you need. I tend to do one or the other depending on what's on my plate. It's a very delicate balancing act, that's for sure!

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

Here's code for 32 byte x 32 byte world

Not sure it's really useful it, doesn't leave much room for code or time to run it

 

There's also a crude world editor

It runs in Opera and Firefox

I'd be curious if any one else can get it to run (and what browser you tried it with)

 

The clear button doesn't do anything

The flip button cycles through flip, on and off

The left arrow buttons move the cursor (there's no other indication where it is though)

The right arrows scroll the world data around

You can also click on the world canvas

The colors just set the colors and display a corresponding hex value (lifted from RT's page)

The little text box is the name for the data statements if you change it you'll have to change

lines 44, 45 in the code to match

There's no way to save the world data (I should probably fix it so you can put the data statements back in)

 

You should be able to just copy the data statements into the code and adjust lines 44, 45 if necessary

 

4way_3.bas

world_editor_32x32_01.html

  • Like 1
Link to comment
Share on other sites

Bogax,

Thanks I plan to give a try and see what I can learn and use.

 

***Edited***

 

Well I was (still am excited about the code). Assembly is way over what I know. But anyways I was trying to slow down the screen movement and have a sprite move around. I figure if you can do that then you can make something open world per say. Maybe Bogax can work his magic again. I did start to add remarks where I think they should go to explain what is going on to help other novice programmers like me.

20171120 - 4 Way Movment (Bogax Code).txt

4way_3.bas.bin

Edited by Lewis2907
Link to comment
Share on other sites

Here's an augmented version of the 32 x 32 world editor

 

You can paste data into the text box and put it in the editor

it looks for the first 1024 numbers in the form $xx where the xx are hex digits

and it pads with 0 if there aren't 1024

 

The clear button works.

 

There's a rudimentary undo. It saves the undo data when you click on the

canvas or input data but not if you're moving the cursor or the world with

the arrow buttons.

 

You can load a picture into the world canvas. So you can do your editing

in your favorite graphics editor and convert it to data statements.

It takes the upper left pixel as the background color, any other color

is a playfield pixel.

 

It seems to work in Opera, the picture loading doesn't work too well in

(an older version of) Firefox and it doesn't work at all in IE.

I haven't tryed it in Chrome yet.

world_editor_32x32_04.html

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

Bogax,

 

Thanks I plan to give a try and see what I can learn and use.

 

***Edited***

 

Well I was (still am excited about the code). Assembly is way over what I know. But anyways I was trying to slow down the screen movement and have a sprite move around. I figure if you can do that then you can make something open world per say. Maybe Bogax can work his magic again. I did start to add remarks where I think they should go to explain what is going on to help other novice programmers like me.

The World Editor works in Chrome, but stops at "data world_data27". I was able to get the sprite working / moving. Still working on slowing down the "movement of the screen".

 

I also tried to use bank switch from 8K to 32K and no luck. I think that is what Bogax was talking about "Not sure it's really useful it, doesn't leave much room for code or time to run it". Attached is where I made some progress, thanks.

 

***edited***

 

I was able to slow down the screen movement using the technique that Gemintronic used for his " RRatRace2.bas". Now I just have to figure out how to make this bank switch to have more data. If that is possible I think a gosub into another bank may work to add enemy AI, Sprites, and maybe more data for other worlds (other worlds maybe a stretch for now.)

20171128_4way_32_32.bas.bin

20171128 - 4 Way Movment (Bogax Code).txt

Edited by Lewis2907
Link to comment
Share on other sites

Bogax,

 

Thanks for the clarification. I did get it to work and I made something to show what I think can be done using your code and others in the forum. My coding style is to combine others and make it work the best I can. Someone once said I program in the old Basic style and that is true. The ASM and other stuff I see everyone do is above what I can do now. Anyways this is what I have so far. Tried to get it bank switch for 8k and up. 8kSC does some weird screen things. Any thoughts on how to make the other bank would be great. I maybe able to make something that is fun, thanks.

 

;```````````````````````````````````````````````````````````````
;
; Instructions:
;
; Use the joystick to move the sprite maze
; Use Reset Switch to Reboot game
; Player starts with 2000 points
; Navigate maze and don't touch ghost.
; Once you hit zero points game will reboot
;
;```````````````````````````````````````````````````````````````

 

***Edit***

 

I did try to compare Gemintronic's 4 Way as his code will bank switch. They are similar I think but vastly different as well.

20171128_4way_32_32.bas.bin

20171201 - 4way 32_32.txt

Edited by Lewis2907
Link to comment
Share on other sites

I didn't have too much trouble getting the scrolling code to run in a different bank

you have to make sure all the routines are present and not use a bank switching return

(both the bank switching and the scroll routines use the x register, I expect there's

interference there but I didn't try to figure out what/where)

 

in principle at least, you could fill all the banks with world data and scroll around

a 512 x 380 (pf)pixel world (or something, I'd keep x an integral factor of 256 bytes)

the coding might get a little hairy but it wouldn't be THAT bad

Edited by bogax
Link to comment
Share on other sites

I didn't have too much trouble getting the scrolling code to run in a different bank

you have to make sure all the routines are present and not use a bank switching return

(both the bank switching and the scroll routines use the x register, I expect there's

interference there but I didn't try to figure out what/where)

 

in principle at least, you could fill all the banks with world data and scroll around

a 512 x 380 (pf)pixel world (or something, I'd keep x an integral factor of 256 bytes)

the coding might get a little hairy but it wouldn't be THAT bad

Bogax,

 

Thanks again. I am trying what you stated. I did remove the bank switching. I have attached what I did, still not working. I am sure I missed the mark somewhere. I am not even sure what the "X Register" is to start. Are you able to fix the code attached for bank switching? Thanks in advance for any help you can provide.

 

My next attempt will be if this can port over to Multiprite or DPC. Not sure if that is possible, but it's worth a try.

20171128_4way_32_32.bas.bin

20171204 - 4way 32_32.txt

Link to comment
Share on other sites

Here I've moved the scroll routines (including the f_ind routine that the fwbyte macro uses)

to bank 2 and fixed the returns.

 

I did the pfread in bB so there wouldn't be a lot of bank switching going on.

 

Seems to work.

 

It could undoubtedly be cleaned up or streamlined some.

 

 

 

 

 

20171204_4way_32x32_mod.bas

20171204_4way_32x32_mod.bas.bin

Link to comment
Share on other sites

Here I've moved the scroll routines (including the f_ind routine that the fwbyte macro uses)

to bank 2 and fixed the returns.

 

I did the pfread in bB so there wouldn't be a lot of bank switching going on.

 

Seems to work.

 

It could undoubtedly be cleaned up or streamlined some.

 

 

 

 

 

Bogax,

 

Thanks for the code. Hopefully I can create something worth while to play on the FBP (Flashback Portable).

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