English Amiga Board


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

 
 
Thread Tools
Old 09 January 2016, 19:42   #1
Shatterhand
Warhasneverbeensomuchfun

Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 38
Posts: 3,437
Bitmap... "shaking" when blitting shapes on it - Also problems with Display Library

Ok, I need help... again.


I am, very slowly, working on an Amiga game using blitz. I didn't want to show you guys anything before because, frankly, there's not much to show so far.

But I had gone this far without major trouble:
[ Show youtube player ]

This is running on dual playfield mode, I did this so I could blit the enemies on the foreground without having to redraw background graphics. I also am using the display library instead of slices, as someone suggested me before, and I am using Amiblitz 2. And the main character is a HW sprite.

So far, so good.

Now when I try to blit anything on that bitmap, both bitmaps on background and foreground change position at random frames, like this:

[ Show youtube player ] (sorry about the low quality of the video, but I think you can see the problem well)

I thought about implementing the Double Buffer trick shown in the Blitz 2 manual.. so I took a look at the DoubleBuffer example that comes with the Blitz installation.. its using slices, not the display library.. BUT THE VERY SAME THING HAPPENS.

I thought this could be some problem with amiblitz 2, since when I tested blitting stuff with Blitz 2 on my real hardware, this didnt happen.

I ran the same example code on Blitz 2 and.. no weird graphics teletransporting. Yeah, so I though "Ok, I'll just test on Blitz 2 and, if it works, I'll keep development there"

But then I try to run the code on Blitz 2 (the same that produced the above video on Amiblitz), and all I get is this:



I removed all code and left just the initialize display and create/show bitmap stuff to see if there was anything wrong with my code.. still same results.

So.. I am asking for help.

A) Is there anything needed by Blitz 2 to make the Display Library work that's not necessary with Amiblitz 2? (I really need this, because I have to create executable with BLitz 2, since I want the game to work with classic amigas)

B) Why is the bitmap "shaking" on amiblitz2 ???

Thank you a lot in advance.
Shatterhand is offline  
Old 09 January 2016, 20:49   #2
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,113
I have been writing a game over the last few months and I have been having exactly the same issue only using Bobs. Are you are programming and testing on Winuae? I have not discovered what the problem is but when I run my game on a real Amiga 1200 there is no issue but screen shakes when run on Winuae - so it seems to be a problem with Winuae. Can you test your code on a real Amiga? if not, I would be happy to try it out for you if you would like to send it to me. Just send me a PM.
Havie is offline  
Old 09 January 2016, 22:02   #3
Shatterhand
Warhasneverbeensomuchfun

Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 38
Posts: 3,437
I can't test it right now, but I'll be able to test on real hardware soon. But I have just a vanilla A600 with 2mb chip ram. Problem is, as I am using Amiblitz 2 and not Blitz 2, every executable I created with Ami2 gave me a guru on my real A600...

.. and on Blitz 2 using Display is not working as I mentioned above.

Edit: I think it has something to do with the lack of FPU. Is there anyway to create an executable on Amiblitz 2 NOT requiring an FPU ?
Shatterhand is offline  
Old 09 January 2016, 22:56   #4
Lonewolf10
AMOS Extensions Developer
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 41
Posts: 1,924
Screen shaking on WinUAE can be down to the auto-centering of the screen when switching between different screens. Try turning off the auto-centering and see if that makes a difference.


Edit:Alternatively, make sure that both screens are using the same Diwstrt/Diwend values, bitplane modulo's etc. (NB: Not a Blitz programmer, so not entirely sure how much control you have over the setting up of screens)
Lonewolf10 is offline  
Old 09 January 2016, 23:20   #5
Shatterhand
Warhasneverbeensomuchfun

Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 38
Posts: 3,437
Quote:
Originally Posted by Lonewolf10 View Post
Screen shaking on WinUAE can be down to the auto-centering of the screen when switching between different screens. Try turning off the auto-centering and see if that makes a difference.


Edit:Alternatively, make sure that both screens are using the same Diwstrt/Diwend values, bitplane modulo's etc. (NB: Not a Blitz programmer, so not entirely sure how much control you have over the setting up of screens)
It's not the screen shaking, it's just the bitmap that "shakes".. it doesn't really shake, it just changes its position randomly then gets back to the correct position.. it happens randomly when I am blitting something on it.

Have no idea of what the hell is diwstry/Diwend. And Blitz manual makes no reference of it.
Shatterhand is offline  
Old 10 January 2016, 05:31   #6
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,004
I had the same problem a while back. http://eab.abime.net/showthread.php?t=77950
idrougge is offline  
Old 10 January 2016, 11:33   #7
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 5,196
Quote:
Originally Posted by Shatterhand View Post
I think it has something to do with the lack of FPU. Is there anyway to create an executable on Amiblitz 2 NOT requiring an FPU ?
Not really the changes to the compiler brought in mean that FPU opcodes are inserted in some places even if the Optimize is set to 0 (integer only), and the devs give more priority to other features than this as they aim for higher-spec machines with AmiBlitz. There are some ways to avoid it however, for example, the Val() function uses the FPU in Amiblitz whereas it didn't in old Blitz Basic 2.1. You can use the Vallong() function instead, which doesn't use the FPU but only works for integers.
Daedalus is online now  
Old 10 January 2016, 14:30   #8
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 49
Posts: 1,176
The scrolling type and main character remind me a bit of KungFu Master.

When you say "using graphics library" you mean you are creating and scrolling the screen with the OS graphics.library?

This issue could be related to the weird jittering bug experienced by idrougge but as the YouTube comment on your video suggest I would first double check which values you are feeding to the scrolling routine. Once you can verify that jittering occurs even when the scrolling is perfectly controlled can you be certain that it is not a bug on your side.

From the idrougge thread it looks like the issue was the emulation of an Amiga configuration which is not supported in an actual physical Amiga so maybe you should also make sure your UAE config matches existing hardware?
ReadOnlyCat is offline  
Old 10 January 2016, 15:37   #9
Shatterhand
Warhasneverbeensomuchfun

Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 38
Posts: 3,437
It was indeed the Z3 ram memory problem mentioned in idrouge thread. Thank you idrougge.

I was configuring Winuae with 512 mb of Z3 Fast Ram. I dropped to 8mb, the jittering went away. Now there's some garbage showing on screen, but I am pretty sure this is me blitting the bitmap at the wrong position (too tired to check the code right now, I'll do it later).

Now I need to make this code work on Blitz 2.

Quote:
When you say "using graphics library" you mean you are creating and scrolling the screen with the OS graphics.library?
Blitz has two ways to create graphics, one is using "Slices", the other one is using its Display library. It's something from Blitz, not from the OS. Display is newer and slices is considered deprecated from what I gather. Display *should* work on Blitz 2 (it's on Blitz 2 manual), but for some reason, all I get is an empty CLI screen when I try to use it on Blitz 2.

Quote:
The scrolling type and main character remind me a bit of KungFu Master.
I indeed began coding this as some kind of port/remake of Kung-Fu Master The main sprite is heavily inspired by the sprite of the NES version of it, but it has more frames and more moves too.

But then, as it has happened once before when I was thinking about remaking an MSX game for PC, I just thought "What the hell, why not make a full new game out of this?". The game I plan to do has a lot more of features than Kung-fu Master

I still could use the base code for a full fledged port of Kung-Fu Master, I guess
Shatterhand is offline  
Old 10 January 2016, 16:17   #10
TurboCrash
Registered User

 
Join Date: Dec 2015
Location: Lisbon/Portugal
Posts: 51
I'm learning Blitz Basic 2 too. Most of the bb2 source code available out there won't compile in Amiblitz2.43, for example Leathered's FF wip code compiles but there's no characters displayed in game.

In BUI5 there's an example using the Display mode instead of Amiga mode or Blitz mode (well still blitz mode but with display library instead of slice)

Code:
; Simple fading for the AGA Amiga by

; David Worswick

; Press left mouse button to Quit  . . . ..


path$="DH1:Blitz2/Examples/BUI5/fading/jcs_watergirl.iff"   ; path to the IFF picture, you may
                                                  ; need to chnge this !!!.



  BitMap 0,320,256,7       ; Allocate a 128 colour bitmap

  InitCopList 0,44,256,$13407,8,128,0   ; setup our copper list for a lores 128 colour display

  InitPalette 1,128       ; allocate a spare 128 colour palette for fading purposes..

  LoadBitMap 0,path$      ; load in the picture

  LoadPalette 0,path$     ; and its palette

  VWait 50        ; wait for all disk activity to stop

  BLITZ           ; go in to blitz mode



;*********************** AGA Palette Fading Routines ****************************


Statement AGA_FADE_IN{clist.w,source.w,destination.w,speed.w,offset.w}

For a.q=0 To 1 Step 1/speed.w
  VWait
  FadePalette source.w,destination.w,a.q
  DisplayPalette clist.w,destination.w,offset.w
Next

End Statement



Statement AGA_FADE_OUT{clist.w,source.w,destination.w,speed.w,offset.w}

For a.q= 1 To 0 Step -1/speed.w
  VWait
  FadePalette source.w,destination.w,a.q
  DisplayPalette clist.w,destination.w,offset.w
Next
End Statement


;***********************************************************************************************


  DisplayBitMap 0,0   ; display bitmap 0 in our copperlist

  DisplayPalette 0,0  ; display palette 0

  AGA_FADE_OUT{0,0,1,0,0}  ; before we display the picture we fade the palette out.

  CreateDisplay 0     ; create a display using our copperlist

  AGA_FADE_IN{0,0,1,200,0}    ; fade in the at a speed of 200

  MouseWait           ; wait for mouse button

  AGA_FADE_OUT{0,0,1,400,0}     ; fade out the display at a speed of 400

  End



; NOTES

;   Both the fade routines take the same parameters, which are :

;   clist       :=    the copperlist where the fade is to take place.

;   source      :=    the palette number to fade.

;   destination :=    a spare palette to hold the faded colours.

;   speed       :=    the speed of the fade. Increase this for longer fade fades.

;   offset      :=    normally set to 0 but can be changed if you need to display the faded
;                     palette at a different colour offset.
As stated in the manual: For displays on non-AGA machines only #fmode0 and #loressprites are allowed

Last edited by TurboCrash; 10 January 2016 at 16:23.
TurboCrash is offline  
Old 10 January 2016, 16:49   #11
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,004
Try to save your AB2 source as ascii and import it into BB2.
idrougge is offline  
Old 10 January 2016, 21:56   #12
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,113
Sadly - still haven't solved my jittering in game!
Havie is offline  
Old 11 January 2016, 01:40   #13
ReadOnlyCat
Code Kitten

 
Join Date: Aug 2015
Location: Montreal/Canadia
Age: 49
Posts: 1,176
Quote:
Originally Posted by Shatterhand View Post
Blitz has two ways to create graphics, one is using "Slices", the other one is using its Display library. It's something from Blitz, not from the OS. Display is newer and slices is considered deprecated from what I gather. Display *should* work on Blitz 2 (it's on Blitz 2 manual), but for some reason, all I get is an empty CLI screen when I try to use it on Blitz 2.
Oh, I see.
I thought you were using the OS to manage the game graphics and that got me wonder if graphics.library support horizontal scrolling, which I doubt it does as I seem to recall from my experiments with it in the 90s that it only supports fixed bitmaps but it is so long ago that I would not be surprised if I was wrong.
As you can see I know very little about Blitz's libraries.

Quote:
Originally Posted by Shatterhand View Post
I indeed began coding this as some kind of port/remake of Kung-Fu Master The main sprite is heavily inspired by the sprite of the NES version of it, but it has more frames and more moves too.

But then, as it has happened once before when I was thinking about remaking an MSX game for PC, I just thought "What the hell, why not make a full new game out of this?". The game I plan to do has a lot more of features than Kung-fu Master
Ah! One can definitely feel the inspiration.

There are positive aspects to making a port: no need to worry about graphics, audio and gameplay as they already exist and only require some adaptation. It is a good way to train technical skills before enlarging one's skill set to what is needed for a full-fledged game.

I think I am ok as a coder but I feel I would probably make a crappy game if I started from scratch but if you feel confident and want to experiment with gameplay and tech aspects at the same time then it is all good as well. As long as you enjoy it and learn in the process I can only encourage you to continue.

Quote:
Originally Posted by Shatterhand View Post
I still could use the base code for a full fledged port of Kung-Fu Master, I guess
Please don't.
It is already in my list of ports to write.
ReadOnlyCat is offline  
Old 11 January 2016, 11:24   #14
Shatterhand
Warhasneverbeensomuchfun

Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 38
Posts: 3,437
For me the big challenge right now is to cope with Blitz Basic and the Amiga Hardware, hehe

I've coded for PC for years now, Have made some money making games and everything. For some time I've been wanting to try to code for an old machine, just for the challenge and fun of doing it. The Amiga was the most obvious choice, since I knew I could code without having to learning assembly, and it was one my "childhood machines" ( the other one being the MSX )
Shatterhand is offline  
Old 12 January 2016, 06:10   #15
Daedalus
Registered User

Daedalus's Avatar
 
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 5,196
Quote:
Originally Posted by Shatterhand View Post
Blitz has two ways to create graphics, one is using "Slices", the other one is using its Display library. It's something from Blitz, not from the OS. Display is newer and slices is considered deprecated from what I gather. Display *should* work on Blitz 2 (it's on Blitz 2 manual), but for some reason, all I get is an empty CLI screen when I try to use it on Blitz 2.
But it works in AmiBlitz? Hmmmm, I can confirm that the Display Library does indeed work under Blitz 2.1, and Worms / Worms: DC is living proof since that uses the display library too. There must be something funny that has changed between Blitz and AmiBlitz - some variable being initialised differently perhaps? Or the NULL keyword behaving differently? Is it actually crashing or just not showing the graphics? Can you play a sound for example?

(By the way, there's a third way of doing graphics in Blitz - actually using graphics.library and intuition.library, but that's both more complicated and slower than using the two Blitz methods.)
Daedalus is online now  
Old 16 January 2016, 17:59   #16
idrougge
Registered User
 
Join Date: Sep 2007
Location: Stockholm
Posts: 4,004
Shatterhand, are you running AB and BB in parallel? Perhaps the library assigns are colliding.
idrougge is offline  
Old 16 January 2016, 18:36   #17
Shatterhand
Warhasneverbeensomuchfun

Shatterhand's Avatar
 
Join Date: Jun 2001
Location: Rio de Janeiro / Brazil
Age: 38
Posts: 3,437
Not on the same config. They also aren't on the same folder, BB is in a folder inside AB... I have a winuae config for AB, and another for BB where I have to manually do the Blitz2: assign.

I still hadn't the time to test anything you guys suggested about trying to make the code work on BB2, since this is a small project done at free time, which haven't been a lot lately, but it's not forgotten

BTW thank you all guys for all the help. I was afraid I would never get any help about Blitz Basic but I was very far from the truth
Shatterhand is offline  
Old 19 June 2016, 23:33   #18
Havie
Registered User
Havie's Avatar
 
Join Date: Mar 2012
Location: UK
Posts: 1,113
Installed the latest version of Winuae and lo and behold the jittery screen shake is gone! Looks like the latest version has solved it...

Game is coming on slowly!
Havie is offline  
Old 20 June 2016, 19:26   #19
Lonewolf10
AMOS Extensions Developer
Lonewolf10's Avatar
 
Join Date: Jun 2007
Location: near Cambridge, UK
Age: 41
Posts: 1,924
Excellent!
Lonewolf10 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
Hard Blits under intuition & Gif To "struct BitMap" converter krabob Coders. Asm / Hardware 2 15 September 2014 17:25
"Invalid resident library" Amiga OS3.9 install (A1200) Kenan support.Apps 5 14 June 2013 15:53
[Solved] 8100 0005 Guru in "exec.library" tygre support.Hardware 11 21 June 2012 22:17
Message "(emukx10.audio) - unable to openpci.library version 1" bbsteal support.Apps 4 08 June 2011 00:28
Problems with "Thespywholovedme", "Flood", "Shinobi" sareks support.Games 12 03 May 2006 14:52

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 10:12.


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