Have an idea where this might go

developing/porting a new game or gaming framework? post in here!
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Have an idea where this might go

Post by Alexi »

Currently working on a scrolling routine and it's working fairly well though it's just wrapped around just now, and the bottom half of it'll be cut off when using it for a game. At the moment it's running on a BBC emulator but I'm going to move it over to an electron emulator at some point.
Got a few ideas of what I might use it for.

A demo of it running at the moment.

https://youtube.com/shorts/ZeoV1Q8p4jE?feature=share
User avatar
tricky
Posts: 7697
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Have an idea where this might go

Post by tricky »

Looks like a good start, but I don't think that the elk has that much flexibility in its ULA.
I've not seen anyone make a video by capturing Android before :)
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

Unfortunately as far as I know there's not an elk emulator for Android so I'm using this beeb-x to code on the go. This demo doesn't make use of any particular hardware features so should be ok on the electron except a bit slower but if I make a game out of this, the display is only going to be half the height so only got half as much to draw.
User avatar
Diminished
Posts: 1235
Joined: Fri Dec 08, 2017 9:47 pm
Contact:

Re: Have an idea where this might go

Post by Diminished »

Looks a lot better than any of my previous attempts at demos ...
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

It's not really meant as a demo as such, needs better artwork and some music. But now I need a way of drawing game level maps into it.
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

Running on electrem on the PC it runs at just over 13 FPS, or with just the top half its 24 FPS. That's including a couple of calculations for the position and calling the routine from basic each frame.

On the BBC emulator it's 42 for half screen height and 24 for full screen height.
User avatar
tricky
Posts: 7697
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: Have an idea where this might go

Post by tricky »

Sorry, I thought that you were using hardware scrolling.
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

No problem, I don't know much about the BBC's hardware, is it capable of hardware scrolling with position per pixel?

Is it possible to switch the ULA's display processing on and off, since I'm only wanting to display anything on the top half of the screen could I get faster ram access by switching it off on the bottom half?
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

This is it running on the Electrem emulator.

It's double buffered with vsync and half the screen being blanked. I've just put in wait for the vsync and a delay to get the blanking position in the right place (on electrem at least) so the frame rate is down to 16.67fps.

https://youtu.be/kuY20dXXdb8
User avatar
0xC0DE
Posts: 1300
Joined: Tue Mar 19, 2019 7:52 pm
Location: The Netherlands
Contact:

Re: Have an idea where this might go

Post by 0xC0DE »

Cool! =D>
0xC0DE
"I program my home computer / Beam myself into the future"
:arrow: Follow me on Twitter
:arrow: Visit my YouTube channel featuring my games and demos for Acorn Electron and BBC Micro
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

Just by setting the wait condition immediately after drawing is finished and placing the wait loop immediately before drawing starts it's up to 20fps now.

I'm a bit confused though, 20 doesn't go into 50, unless it's because of what I'm doing and it's alternating between 2 and 3 refreshes for each update or something.
User avatar
davidb
Posts: 3395
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: Have an idea where this might go

Post by davidb »

Nice work! It's impressive to see all that stuff move around so quickly - and quite smoothly, too! :D
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

Thanks, hopefully it'll be even better once I get the mapping working so it's not just a repeating pattern, but how much that'll slow it down remains to be seen.

Edit: with the main loop now in assembly the whole thing runs at 25fps!
User avatar
lovebug
Posts: 1740
Joined: Sun Jan 31, 2021 5:07 pm
Location: Magrathea
Contact:

Re: Have an idea where this might go

Post by lovebug »

nicey done =D>
Image Image Image Image
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

25 FPS scrolling at 1 pixel at a time.

https://youtu.be/Vk3ysrQ3SfQ
User avatar
davidb
Posts: 3395
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: Have an idea where this might go

Post by davidb »

Very good. :)

It will be interesting to see what you do with this next. Also, to see what you can do if you don't need to redraw everything.
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

I'm looking into if I can improve on this at all at the moment, there may be some ways but the improvements will only be very small and the solutions quite complex so probably time to move onto the other steps.
Maybe with less filling the entire screen full screen scrolling of levels could be possible, that's not what I'm aiming for right now but could be something to look into later.
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

Working out a few things so this is a bit of test code, it scrolls the whole mode 5 screen left by 1,2 or 3 pixels. It's pretty slow though and probably not really much use. But I'm looking for ways to fill in the new edges of my fast scrolling.

Code: Select all

10 MODE 5   
20 DIM Q% 1000   
30 FOR I%=0 TO 3 STEP 3   
40 P%=Q%   
50 [OPT I%   
60 .shlut EQUD&000B1116   
70 .sh EQUB0   
80 .temp EQUB0   
90 .init  
100 LDX #0:.lut STX temp:LDA #0  110LSR temp:BCC n0:CLC:ADC#1:.n0 LSR temp:BCC n1:CLC:ADC#16:.n1 LSR temp:BCC n2:CLC:ADC#2:.n2 LSR temp:BCC n3:CLC:ADC#32:.n3 LSR temp:BCC n4:CLC:ADC#4:.n4 LSR temp:BCC n5:CLC:ADC#64:.n5 LSR temp:BCC n6:CLC:ADC#8:.n6 LSR temp:BCC n7:CLC  
120 ADC #128:.n7:STA &3600,X:TAY:TXA:STA &3700,Y:INX:BNE lut  
130RTS  
140.scroll  
150LDA #&58:STA r0+2:STA r1+2:STA w+2  
160LDX sh:LDA shlut,X:STA jump+1  
170LDY #0:.loop  
180.r0 LDX &5808,Y:LDA &3700,X:STA &70  
190.r1 LDX &5800,Y:LDA &3700,X  
200CLC:.jump BCC jump  
210LSR A:ROR &70:LSR A:ROR &70  
220LDX &70:JMP done  
230ASL &70:ROL A:ASL &70:ROL A  
240ASL &70:ROL A:ASL &70:ROL A  
250TAX:.done LDA &3600,X  
260.w STA &5800,Y  
270INY:BNE loop  
280LDA r0+2:CLC:ADC #1  
290STA r0+2:STA r1+2:STA w+2  
300BPL loop:RTS  
310 ]:NEXT  
320 REM sh=pixels to scroll 0-3  
330 ?sh=1  
340 CALL init  
350 FOR I%=0 TO 20  
360 CALL scroll  
370 NEXT
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

This seems a lot better, does away with the lookup tables. Tidied up the code a bit too and it does a bit of self modifying.

Are there better ways of doing this, the byte shifting part is what I'm after.

Code: Select all

//Mode 5 shifting screen left by 1-3 pixels

 .mask EQUD &113377FF
 .setup1 EQUD &4A4A4A4A
 .setup0 EQUD &0AEAEAEA:EQUW &0A0A
 .shift EQUB 1 //No. Of pixels to shift (0-3)
 .scrollleft
  LDX shift
  LDA mask,X    :STA msk0+1
  EOR #&FF      :STA msk1+1
  LDA setup0,X  :STA msk0+2
  LDA setup0+1,X:STA msk0+3
  LDA setup0+2,X:STA msk0+4
  LDA setup1,X  :STA msk1+2
  LDA setup1+1,X:STA msk1+3
  LDA setup1+2,X:STA msk1+4
  LDY #0:LDX #&58
 .oloop
   STX r0+2
   STX r1+2
   STX w+2
 .iloop
.r1   LDA &5808,Y
.msk1 AND #0:NOP:NOP:NOP
      STA rhb+1
.r0   LDA &5800,Y
.msk0 AND #0:NOP:NOP:NOP
.rhb  ORA #0
.w    STA &5800,Y
  INY:BNE iloop
 INX:BPL oloop
RTS
User avatar
0xC0DE
Posts: 1300
Joined: Tue Mar 19, 2019 7:52 pm
Location: The Netherlands
Contact:

Re: Have an idea where this might go

Post by 0xC0DE »

If I were to write this I would unroll the loops at least a few times and write separate functions for each amount of pixels you want to move.
0xC0DE
"I program my home computer / Beam myself into the future"
:arrow: Follow me on Twitter
:arrow: Visit my YouTube channel featuring my games and demos for Acorn Electron and BBC Micro
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

Thanks, if it was for the full screen scrolling then yes, but the full screen thing is just for testing ideas on the shifting. When it's actually going to be used in the scrolling routine that I've posted videos of it'll only have to shift into 64 or 128 bytes depending on direction of scrolling, and used in the loop alongside code for reading the bytes from map/tile data.
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

This has been a bit of a pain to get working but finally got it, although it's still just wrapping vertically when scrolling up and down but the horizontal scrolling goes across the map.

https://youtu.be/X8iBoQdtV4g

Edit: just noticed I've left the pointer over the middle of it :(
And the video freezes at one point, that's something happening on YT, maybe it's still doing some processing.
User avatar
davidb
Posts: 3395
Joined: Sun Nov 11, 2007 10:11 pm
Contact:

Re: Have an idea where this might go

Post by davidb »

I can imagine a nice sideways-scrolling shooter based on this! :D
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

I've had a few ideas, platformer, something top down, shooter.
One good thing about it is that sprites don't have to be removed, but it might also be possible to draw something like damage or enemy remains onto the background and they'll stay there until they go off screen.
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

Running this in electrem I've been running out of space, as it is just now it runs but when I tried it in elkulator it couldn't get past assembling the code.
I've saved the assembled code to a file and written a short basic program which sets some things up, loads the code and runs it and it works fine.

Is this down to different versions of the OS?

Now because of running out of space, I'm going to have to start breaking up the assembled code and saving it probably over several files, going to take some thinking about the best way to go about this, anyone got any tips?
User avatar
0xC0DE
Posts: 1300
Joined: Tue Mar 19, 2019 7:52 pm
Location: The Netherlands
Contact:

Re: Have an idea where this might go

Post by 0xC0DE »

Switch to BeebAsm
0xC0DE
"I program my home computer / Beam myself into the future"
:arrow: Follow me on Twitter
:arrow: Visit my YouTube channel featuring my games and demos for Acorn Electron and BBC Micro
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

Thanks, I've downloaded that and had to get the msvcp100.dll but can't get it to run, "application failed to initialize properly" does it work on XP?
User avatar
0xC0DE
Posts: 1300
Joined: Tue Mar 19, 2019 7:52 pm
Location: The Netherlands
Contact:

Re: Have an idea where this might go

Post by 0xC0DE »

I haven't used XP in over a decade or more :lol:
I use Win 10 + VSCode + BeebAsm
0xC0DE
"I program my home computer / Beam myself into the future"
:arrow: Follow me on Twitter
:arrow: Visit my YouTube channel featuring my games and demos for Acorn Electron and BBC Micro
User avatar
fizgog
Posts: 618
Joined: Thu Jun 17, 2021 3:18 pm
Location: Nottinghamshire
Contact:

Re: Have an idea where this might go

Post by fizgog »

As 0xCODE said, definitely the way to go with coding.

I first started coding directly on a beeb, then switched to running Windows 10 + VSCode + BeebAsm through Parallels VMware.

NB I never seemed to get it running directly through a Mac
Pitfall, Gridrunner, Matrix: Gridrunner 2, LaserZone, AcornViewer, AcornPad
Alexi
Posts: 41
Joined: Sun Feb 21, 2010 12:46 pm
Contact:

Re: Have an idea where this might go

Post by Alexi »

Yep, looks much more convenient to code in but still can't get it running on XP laptop, tried several the dll's and now I don't get the dll missing or application failed messages but it still shuts down immediately without any messages now.
I've a win10 desktop that I can try it on but much prefer it on the laptop, are there any other similar options to beebasm?
Post Reply

Return to “new projects in development: games”