11 April 2020, 19:14 | #21 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
In an ideal world I would block the sprites on the screen and move them using hardware scrolling but without using a dual playfield, I don't know how to put the backgroud in unless it scrolled with the bars (which isn't what I want).
I can see why using AGA is easier... |
11 April 2020, 20:55 | #22 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
Right - have rewritten code with qblit but still slows down with 3 pipes?
Last edited by Havie; 13 April 2020 at 00:05. |
11 April 2020, 21:37 | #23 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
The time taken to blit is directly influenced by the size of the blit, so blitting large objects the full height of the screen is going to be slow - probably no faster than blitting the two halves. Are you using QBlit, BBlit, or how are you restoring the background image?
|
11 April 2020, 21:56 | #24 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
Followed Master's advice and tried QBlits. Works but slow.
Have retried sprites and it is much faster and smoother. The issue is that I need 6 sprites for the pipes as they are 26 pixels wide and need to work out how to put a space in them. Collision should be easy though... |
11 April 2020, 22:02 | #25 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
It adds to the complexity a bit, but you could always try a combination - blitting some of the pipes and using sprites for the others.
|
11 April 2020, 22:19 | #26 |
Banana
Join Date: Jul 2016
Location: Darmstadt
Posts: 1,213
|
There’s always the ol’ blit ahead and behind and hardware scroll trick for infinite scrolling, but that’s probably another rewrite in itself
|
11 April 2020, 22:30 | #27 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
Arghhh - I forgot that I can't have 6 16 colour sprites! Not going into multiplexing as my Doodle Jump game goes weird with multiplexing so would just confuse matters.
Could do a combination but am still concerned that might be a bit slow as blitting big shapes but... Never mind - they look fine as 4 colour sprites - just lose the black. So plan now is to have pipe on the screen at 0,0 so it doesn't show then everytime I need a new pipe, blit a black space to make the gap, grab shape from screen and copy to sprite. Surely this will be fast enough..? |
11 April 2020, 22:35 | #28 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
I'd like to use hardware scrolling but can't see how I can put pipes over background fast enough without using dual playfied and then I might struggle with colours (although if I'm splitting background and foreground colours then this might not be a problem) - I'll come back to this only if I need to! Although this method would mean that I only draw spaces every so often and could use a sprite for the bird (giving me more colours) and I could have more pipes if I needed and maybe even pipes at an angle...starting to talk myself into this!!!
|
11 April 2020, 23:59 | #29 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Might be worth knocking up a test case to see how it looks. If you use a sprite for the bird, you can use all 7 available foreground colours for the pipes, which might not be too bad. Some dithering could be used if needed too... You still then have 8 background colours and 16 to cover the bird and any other sprites you might use.
|
12 April 2020, 00:55 | #30 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
Adjusted my plan and put the pipe on a 4 colour screen of 32 width and 190 height. Adding holes and grabbing sprites as needed seems to work really well and using pokes shows colour bars but no flashing so guess the game is running at 50fps?
Got collision detection working as spriteshape detects the pipe even if it is the gap but then once collision has happened I can check to see if bird is within the gap. Need to fiddle with it slightly to make it fairer (maybe a smaller hit box?). My only other issue is the sprite colours for the pipes! I know that sprites take the top 16 colours of a 32 colour palette ie, 16-31 but the pipes are definitely taking colours form the 0-15 colours! I have drawn my pipe in 4 colours and then saved the pipe (in 4 colours. I have then saved a 32 colour palette which has the same four colours as colours 16,7,18,19. I then load the palette in bltz before displaying the pipe but this doesn't work and the colours are wrong. I remember having terrible trouble with colours with my Dinorun game (all sprites) so there must be something I am doing wrong??? |
12 April 2020, 00:56 | #31 | |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
Quote:
|
|
12 April 2020, 01:18 | #32 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
We have had the sprite colours discussion previously but have never fully got my head round it - help!
|
12 April 2020, 11:03 | #33 | |||
Registered User
Join Date: Nov 2015
Location: Vaasa, Finland
Posts: 524
|
Quote:
An alternative method could be to have the whole pipe (without the gap) in a Shape that you create before the main loop begins. And then during the game, you QBlit this pipe, and then create the gap into it by copying a rectangular area from the third bitmap using the "Scroll" command. But if you want to use sprites for the pipes, and want to have the ability to freely place the gap anywhere in the pipe, then I guess the GetaShape-GetaSprite combo can't be avoided. Quote:
Also make sure that you repeat the 4 sprite colors for all colors between 16-31, not just the first four. Sprites 0 and 1 take colors from 16-19, sprites 2 and 3 take colors from the 20-23, and so on. And if it still doesn't work, then try setting the colors 16-31 manually with the "PalRGB" command. It should work, OCE/ECS always takes sprite colors from 16-31, only in AGA this can be different. Quote:
First, turn cycle exact mode OFF, and start the game. Then, go to the WINUAE "Display" menu, where you have that "Refresh" slider. Try moving it one step to the right. And then check if this has any effect to your game. If movement now seems less smooth, then your game is running at 50 FPS. And if nothing seems to change, then it runs at 25 FPS or slower. And also try switching between cycle exact ON and cycle exact OFF. If the game runs at 50 FPS, you should see no difference between the two. --- Also are you printing the score to the screen every frame ? If so, then change it so that it updates the print only when the score changes. All print commands are slow, because every letter printed is separate blitter operation. |
|||
12 April 2020, 16:08 | #34 | |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
Sadly - in my tests. QBlitting was too slow as the pipes are too big! But I have kept the blit code for other shapes.
Quote:
I will try out your suggestion re: 50fps. Thanks and thanks for all your help. |
|
12 April 2020, 17:28 | #35 | |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
Quote:
Tried adding code to make pipes move but really slow: It is true that getashape and getasprite are too slow to do this every frame. Is there anyway to write to the sprite directly? The only other option I can see is if I use a sprite on top of a sprite to make the gap but I am down to 2 sprites and need 6 - 2 for each gap (damn OCS and it's 16 pixel sprite width). Maybe multiplexing is my only solution? IN fact, if I get this working then I don't need to do any getashapes at all! If so how using the new display library - help again! I have used vsprites in the past but seems a bit flakey? |
|
12 April 2020, 17:33 | #36 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
CustomSprites seems to be the solution but need help implementing it.
|
12 April 2020, 18:18 | #37 | ||
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Quote:
I don't know of a simple way of writing to a sprite's bitmap directly, but it's probably doable by using CludgeBitmap and the address of the sprite data from the struct. I haven't tried it but it's worth a go... Quote:
|
||
12 April 2020, 19:01 | #38 |
Registered User
Join Date: Jul 2015
Location: The Netherlands
Posts: 3,408
|
I've been trying to get my head around how you're drawing the pipes. If I understand your current method, you are using hardware sprites for the pipes and are trying to blit the different images/gaps as needed every frame.
Now, I am no Blitz expert, but that does seem like an inefficient way to go about it to me. What I'd probably do myself if I where to create something like this in assembly is having two large but pre-built sprite images in memory: one for the top and one for the bottom. These would end in whatever imagery is used for the top and bottom part of the gap. For maximum performance, I would probably copy these images so that I can simply assign them to all the sprite channels as needed. (i.e. such that all sprites could display a top and a bottom pipe segment without needing additional blits). Edit: I made a small error there... Because multiple sprite pointers can be set to the same image, you do not need more than a single top and bottom image this way. These would be as tall as they could possible need to be (my guess would be the height of the screen, but it depends on the game). For drawing them, I'd use the Copper (this is where I'm not sure if this is possible using Blitz, but let's at least look into it):
Thanks to the gap between the top and bottom pipe sections, the Copper timing required should be fairly loose, so you can probably get away with resetting a single pipe per Copper wait. Again, not sure if this is possible with Blitz, but the above way will cost virtually no raster time for displaying the pipes. Last edited by roondar; 12 April 2020 at 19:35. |
12 April 2020, 19:34 | #39 |
Registered User
Join Date: Mar 2012
Location: UK
Posts: 1,893
|
When you say 'overlap' do you literally mean overlap or be on the same scan line?
|
12 April 2020, 19:43 | #40 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
They can't be on the same scanline, so all 8 sprites must be above a certain line, and all 8 of the second set must be below that line. Now, there are ways of doing it that mean only the sprites on the same sprite channel need to be kept separate, but that's beyond the capabilities of the Blitz commands and so you'd have to handle that yourself.
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Ripping Sprites - Technique... | method | project.Sprites | 43 | 12 October 2021 16:17 |
Amazing New Retrobrighting Technique | Hewitson | Retrogaming General Discussion | 12 | 12 June 2019 09:27 |
Disable bob clipping at screen edges | adrazar | Coders. AMOS | 15 | 03 July 2017 13:57 |
Fastest way to blit things on screen | Shatterhand | Coders. Blitz Basic | 13 | 03 February 2016 10:12 |
Screen right edge clipping issue | mark_k | support.WinUAE | 0 | 05 January 2014 19:28 |
|
|