English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. Blitz Basic

 
 
Thread Tools
Old 18 January 2021, 17:44   #1
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
Spaces Invaders with a moon background

I've started a new thread as this is a different technique I am looking at rather than just Space Invaders.

So, currently my Space Invaders game uses on one screen and no double buffering and Blits to the screen with a black border or trailing edge (for shots) for maximum speed.

But now have a copy of the moon/planet background and have rewritten the code to be dual playfield so moon is behind. Of course, this doesn't work as the black borders are not transparent so you end up with black boxes around the sprites against the background. Solution, was to remove borders and using Blitz Erasemode to delete bob and then redraw. As I only move a maximum 5 per loop not a problem or so I thought! Unfortunately, this is causing me a headache as anything animate needs to use previous animation to erase before drawing new animation plus this messes up the invaders moving down routine as they all have to be aligned before moving down so they don get out of shape. I'm sure I can crack it but then I had another idea!

If I don't use dual playfield mode but have a second screen with a copy of the moon on and have the moon on the screen you see all the time, I can use sections of the second screen to erase the bob on the first screen and then Blit in a new position - therefore keeping everything virtually the same and not breaking my moving down routine. I'm sure this would work but not sure if there will be a speed issue as each loop I'd:

-> copy up to 5 sections of screen 2
-> Blit up to 5 sections on to screen1
-> Blit bobs in new positions

So assuming copy works at a similar speed to a simple Blit, I am doing up to 15 things instead of 5.

The advantage would be - if it were quick enough that instead of an 8 colour background, I could make it 14 or even 30 (minus colour 0 and invader colour)

Any thoughts on this would be most welcome!

It does look nice with a background!!!
Havie is offline  
Old 18 January 2021, 22:49   #2
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,003
You can use QBlit with a separate bitmap supplied as an extra argument. That bitmap will be used as a source for restoring what was previously erased.
idrougge is offline  
Old 18 January 2021, 23:01   #3
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
Ah - basically what I want but simpler?
Havie is offline  
Old 18 January 2021, 23:28   #4
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
Thinking about it, not sure qblit wont work, as I cycle through the invaders and shots one at a time so each loop I move on to the next one whereas qblit restores previous ones.
Havie is offline  
Old 19 January 2021, 21:55   #5
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,003
You can have several queues, but perhaps several dozens is overdoing it.
idrougge is offline  
Old 19 January 2021, 22:57   #6
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,003
Looks like what you need is BBlit.
idrougge is offline  
Old 20 January 2021, 00:07   #7
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
Quote:
Originally Posted by idrougge View Post
Looks like what you need is BBlit.
Probably and I may be over-complicating things but once I have drawn a bob, it doesn't get erased for 55 loops so I can't just erase using a unbuffer command as all the bobs in the buffer will get erased - that's my problem.

Hence, if I get the x,y for the current Invader, I can erase using a 2nd screen by copying the exact section from screen 1 to screen 0 and then happy blit to the empty space. No worries about calculating which animation frame was there - Bob's (good pun) your uncle!

Had a quick test and it works - just need to see if it is fast enough!

Last edited by Havie; 20 January 2021 at 00:13.
Havie is offline  
Old 20 January 2021, 13:00   #8
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
Righto - so using getashape seems to slow the game down?

Adding a background shouldn't be so hard but I didn't plan this from the start...

New plan that will definitely work:

Use dual playfield so background is on second and always behind, mimicking a real machine. Blank the moving bob by blitting an appropriately size black rectangle (no transparent), then blit bob with full transparency the same size! Thus I have only one additional blit per bob and do not have to worry about which animation frame ... much simpler.

This has the added benefit that I don't have to spend hours trying to remap colours in background with 4 colour invader palette.

Will try and get this working later...
Havie is offline  
Old 20 January 2021, 13:54   #9
Cobe
Registered User

 
Join Date: Jan 2014
Location: Belgrade / Serbia
Age: 38
Posts: 822
Around the new year I messed around a bit with your code and I was almost satisfied with the result but since then some wonderfull things happened to me and now I barely sleep and dont have time to mess a bit more with it.

Years ago I made a simple hack of Nes Space invaders
[ Show youtube player ]

So I thought this is the right opportunity to "hack" one for the Amiga


The way I sorted your blitting problem was to point shapes masks to fake blank(not "black") mask.

I could write more later or upload everything here. Or maybe you could try a bit more to find your way cause you have some unconventional methods but in the end you get it right.
Attached Thumbnails
Click image for larger version

Name:	InvaderV114_004.png
Views:	71
Size:	14.0 KB
ID:	70503  
Cobe is offline  
Old 20 January 2021, 21:11   #10
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
Quote:
Originally Posted by Cobe View Post
The way I sorted your blitting problem was to point shapes masks to fake blank(not "black") mask.
You're going to need to explain this and yes I would like to see you update running! As surely fake blank is either not transparent or doesn't blit out what's underneath? I must be missing something...

Plus - your update! Someone did a similar thing to my Dinorun game. It's nice to share and inspire others to have fun.

Unconventional - I call it exploring and learning!!!

Last edited by Havie; 20 January 2021 at 21:49.
Havie is offline  
Old 20 January 2021, 21:57   #11
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
Just read the chapter on Blitting Commands and I am completely clueless so will have a go with mu way and wait for you to explain the conventional way.

If I had to guess - maybe something to do with BBlitMode?
Havie is offline  
Old 20 January 2021, 23:20   #12
Cobe
Registered User

 
Join Date: Jan 2014
Location: Belgrade / Serbia
Age: 38
Posts: 822
Spade Invaders "hack" in the zone.

I didnt mean anything bad with unconventional. If it works then it was the right way and that counts.
Actually I didnt do anything conventional. I continued down your road.
By shape mask I actually meant cookie cut.
Take a look at the source code in adf I uploaded and write if you cant figure out what I did. I mainly didnt touch your code, just added what I needed.
Cobe is offline  
Old 21 January 2021, 01:16   #13
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
It's ok - I was only joking! I quite like being unconventional.

Actually, I had a play and you put me back to where I had moved to using erasemode and cookie cut so think we are working along the same lines. My main issue was that I couldn't workout where to erase bobs in the program but with a bit of clarity I sorted it out just! Just need to sort some flicker, redo all the text and numbers and it'll be ok.

Will have a look at your code to see how we compare.

A few bugs to sort, some options and a secret score screen that gives you your real score if you go over 9999 and it'll be ready for release.

Thanks for your help!
Havie is offline  
Old 21 January 2021, 01:38   #14
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
Had a quick look at your hack and it's excellent! Loads of code you'll need to explain - I'm guessing that some of it is just standard code you use for all your games?

I think there is a bit of code or Copper background?

And I have no idea what you are doing with the shapes and cookie cuts!

Help please.
Havie is offline  
Old 21 January 2021, 05:22   #15
Cobe
Registered User

 
Join Date: Jan 2014
Location: Belgrade / Serbia
Age: 38
Posts: 822
Well its not just standard but I use it when needed.

This shape thing actually I tried for the first time.

You have that your "erase by blitting" method that works well for the single playfield but if used in dualplayfield it blits black squares above back playfield. So I had to change "bkg" color of the shapes to color 0. With that set there's no erasing cause the cookie cut is now the exact shape as the shape. I didnt feel like going through your code and change all your blits with qblits. I made that "blank" shape thats actually square filled with non transparent color so its cookie cut is the whole square. Then I changed all the relevant shapes cookie cut pointers to that square cookie cut so I could get back that erase by blitting method of yours working again without need to change your actuall code beneath.

Copper bkg is made the same as you did with displayrgb.
Cobe is offline  
Old 21 January 2021, 10:27   #16
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
Yes - that's where my meandering has finally led me...

I just do Blitmode erasemode - then blilt shape and then Blitmode cookiemode to allow bliting.

Unanimated shapes I can just eraseblit the shape but animated ones I uses a blank square.

My whole focus to have the least blits possible to try and keep FPS at 50.
Havie is offline  
Old 26 January 2021, 01:11   #17
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
Background added and game seems to be running ok. See Game Factory for download!
Havie is offline  
Old 11 February 2021, 02:18   #18
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
Extra background now added, bugs squashed and speed optimised!

https://eab.abime.net/zone/Space%20Invaders.adf
Havie is offline  
Old 11 February 2021, 10:33   #19
hitm4n
Registered User
hitm4n's Avatar
 
Join Date: Nov 2006
Location: Lincoln, UK
Posts: 274
Hey Havie. Just grabbed this, looks very cool with the background added. Gonna try it later Cheers.
hitm4n is online now  
Old 11 February 2021, 14:13   #20
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,044
Quote:
Originally Posted by hitm4n View Post
Hey Havie. Just grabbed this, looks very cool with the background added. Gonna try it later Cheers.
Long tine no see Hitty!

Thanks - let me know what you think. I realised that it was too slow on unaccelerated Amiga and frankly shouldn't have been so after a but of optimisation it should be running at 60FPS (as I poke the Amiga in 60hz mode which gives a better aspect ratio - and I think speeds up the game slightly).
Havie is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
AmFTP cannot retrieve files with spaces in the name DopPie support.Apps 17 22 September 2016 22:32
How to pass filenames with spaces to CRMData? BarryB support.Apps 10 30 December 2011 01:07
Atari St Invaders Kitty request.Old Rare Games 9 29 October 2009 23:51
[Found: Mr Wobbly Leg Versus The Invaders From Space] Space-Invaders game? Dindel Looking for a game name ? 5 06 March 2008 11:05
AmigaDOS directories with spaces in? boomtopper support.Apps 14 11 May 2007 13:57

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 18:41.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Page generated in 0.09768 seconds with 16 queries