27 February 2018, 23:53 | #1 |
Pixel Vixen
Join Date: Feb 2018
Location: Mie, Japan
Posts: 219
|
First Blitz code in nearly 20 years - any good?
Hi all,
I used to code a lot with Blitz Basic 2 on the Amiga in the mid to late 90s and loved it but have long since moved away from it and the Amiga. A recent rekindling of my interest in old games made me think about possibly coding my own one, which may take years but no worries. I have been using Ultimate Blitz Basic on an emulated Amiga on my Mac which seems to work fine although I still have an A600 in my loft but no easy way to readily connect it to my display. My idea is to create a kind of puzzle / maze game but as a proof of concept I wrote the below code to see if I could code something that moved a character around the screen (which has multiple frames per movement), before moving on to some wider investigations. All it does it put a character on a red screen. The character is not mine, SNES JRPG fans may recognise him I intend to draw my own in DPaint III in time. My main questions are:
That'll do for now Thanks! Marle |
28 February 2018, 08:47 | #2 |
Moderator
Join Date: Jul 2004
Location: Norwich, Norfolk, UK
Age: 37
Posts: 11,167
|
Welcome aboard!
I haven't had any opportunity to look at or test your code yet but I think I can answer one of your questions... I think the Pop command does this, so using the line Pop For will exit the loop before it has completed. |
28 February 2018, 12:05 | #3 | |
Pixel Vixen
Join Date: Feb 2018
Location: Mie, Japan
Posts: 219
|
Quote:
One other question I have that I recall from my time of using BB2, was that you couldn't call a function (procedure? statement?) before it had appeared in the code, I remember this caused some problems sometimes, is this the case? I doubt I'll encounter is now as I'm not going to code Workbench apps with serious amounts of user interface logic etc. But it's just popped back into my memory! Thanks! Marle |
|
01 March 2018, 13:32 | #4 |
Registered User
Join Date: Jun 2009
Location: Dublin, then Glasgow
Posts: 6,334
|
Welcome along! I haven't run your code but have had a quick read through it. First thoughts:
- The display library is more versatile than the slices library so I would recommend reading about that and using it instead. - Generally it looks pretty good! The layout and comments give away the fact you've coded before Now, to answer some questions: - Yes, the Pop command is exactly what you're looking for, though it's not considered particularly great programming technique (from the same school as Goto and Gosub), so it would be preferable to work around it if possible. If needed though, Pop can get you out of any loop (For, While or Repeat), a Gosub, an If, or a Select (the Blitz equivalent of Switch). - Yes, the procedure must be in your code before it is called for the first time. This is a limitation of the compiler, but in practice makes very little difference and shouldn't cause you any problems. Basically they're just all put at the top of your code and you're sorted. They're still called Procedures in Blitz in general, but are also called Statements and Functions, based on whether they give a return value or not. - Without having run it, I'm not sure what the issue is with the character rendering. Does it flicker without the VWait 4? It sounds like it's just too slow to blit in a single frame if that's the case. If it doesn't flicker, but just animates or renders too quickly, you just need to remember that everything in Amigaland is timed to a frame, so for smooth animation you need to have 50 (or 60) frames per second. Double buffering won't help this, it just fixes flickering that happens when the rendering isn't finished before the next frame is due. The ways around this are typically: - Simply frameskip (using VWait as you're doing, or using the other frames to do other processing) - Run at 50FPS and add more animation frames - Run at 50FPS and only change the current animation frame every nth frame (I think a lot of games use this method) - A combination of above (e.g., run at 25FPS and update the animation frame every 2 frames for a total of 8 FPS of animation) |
02 March 2018, 21:15 | #5 |
Registered User
Join Date: Sep 2007
Location: Stockholm
Posts: 4,332
|
Since all your questions have already been answered, let me just warn you that your A600 may be slowly deteriorating in your loft because the capacitors start to leak after 20 years. Send it to Daedalus and he will fix it for you.
|
05 March 2018, 21:52 | #6 | |
Pixel Vixen
Join Date: Feb 2018
Location: Mie, Japan
Posts: 219
|
Quote:
I'll try to get it down this weekend and check it over (it's nothing special although it does have 2MB and Kickstart 3.1). |
|
05 March 2018, 21:53 | #7 | |||||
Pixel Vixen
Join Date: Feb 2018
Location: Mie, Japan
Posts: 219
|
Quote:
Quote:
Quote:
Quote:
Quote:
I will have to get somewhat more used to this kind of programming as pretty much everything I do these days is user interface related. Thanks! |
|||||
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Blitz Basic 2 source code | Retro1234 | Coders. Blitz Basic | 8 | 25 May 2016 05:07 |
Somebody teach me to code in Blitz Basic, please!!! | Toni Galvez | Coders. Blitz Basic | 18 | 21 May 2015 00:03 |
Source Code for finished games/demos in Blitz? | diablothe2nd | Coders. Blitz Basic | 15 | 14 November 2012 22:04 |
BlitzOut - new Breakout game - need help with Blitz code | Graham Humphrey | Coders. General | 29 | 27 June 2011 13:16 |
3D code and/or internet code for Blitz Basic 2.1 | EdzUp | Retrogaming General Discussion | 0 | 10 February 2002 11:40 |
|
|