123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|548|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> BlitzAmiga - Quite a Learning Curve

Page : 1 2 Next
Prev
Mon, 04 Apr 2022, 07:38
Jayenkai

BlitzAmiga - Quite a Learning Curve


Currently using BlitzBasic 2.1, as available here.
I know there are later versions of Blitz available, but this is the version that I bought back in the 90s, and I'm damned if I'm never going to learn how to use the sodding thing!

-=-=-

Images are loaded into Bitmaps, then Bitmap are split into Shapes, then Shapes are either "Blit"ed to the current Bitmap, or can be assigned to a hardware Sprite.
Hardware Sprites are all a specific square size (16,32 or 64), as defined at the top of your code.

Each sprite only has 4 colours, one of which is transparent, and they have such a bloody odd way of picking colours.
Sprite 1 and 2 use colour 17,18,19
3 and 4 use 21,22,23
and so on.
!!

-=-=-

Statements and Functions must be declared before use, and you have to use Squiggly brackets { } instead of rounded brackets, and don't forget or it'll whinge about Dims not being declared.
To access an external variable from within a function, you need to share it inside the function. (Like how PHP does it)
SHARED MyVariable makes an external variable useable inside the function/statement.
I haven't yet worked out how to SHARE an array..!

-=-=-

Blit is the command used to draw a "Shape" (pre-saved image tile) to the current Bitmap
Gosubs (unless I'm doing something very very wrong) don't appear to be able to actually draw anything to the buffer, clear the buffer, or... really, much of anything. Not sure why this is. Maybe I'm doing something wrong, but I can't fathom any rhyme/reason for this behaviour.

If, on the other hand, I create a "DrawImage" function/statement, with the Blit command inside it, and call my DrawImage statement from inside the Gosub segment, then it draws without any issues.
Most odd.

-=-=-
''Load, Next List!''
Tue, 05 Apr 2022, 03:14
cyangames
Seems like quite a unique language there!
Wed, 06 Apr 2022, 04:59
Jayenkai
Things "Include"d also have this odd quirk..
It's as if, when in Blitz mode, the graphics screen exists only within the Stack that it's created in.
If I gosub, creating an additional stack, then print, it crashes.

Functions don't appear to add stacks.. So Function>Print>End Function works fine.

HOWEVER....
Today I figured I oughta neaten things up with an include or two, and now THOSE are behaving in exactly the same way..

If I set up the bitmap/screen/etc from a function inside an include, then ONLY functions within that include can draw to that screen/bitmap.
Truly the most baffling methodology I've ever encountered!!

Guess I'll just plough ahead and dump everything into one giant sprawling mass of code!

-=-=-
''Load, Next List!''
Wed, 06 Apr 2022, 06:47
AndyH
namespaces and scope issues perhaps?
Wed, 06 Apr 2022, 06:51
Jayenkai
I don't "think" so. I mean, the bitmaps and screens are numerical.

-=-=-
''Load, Next List!''
Wed, 06 Apr 2022, 15:43
Jayenkai
LOL.. Oh my god, it's so slow!!!

for x=0 to 128:for y=0 to 128:for n=0 to 10:grid(x,y,n)=0:next:next:next

Aaaahahahhaa!!!

No..

-=-=-
''Load, Next List!''
Wed, 06 Apr 2022, 22:13
Pakz
In the early days on blitz pc I tried once to put all those variables in a array. Looping through those. Kind of like those sin tables I read about in demo coding.

7mhz and a few hundred kb of free memory is something else
Thu, 07 Apr 2022, 08:05
Jayenkai
Aw, nuts, I need to account for NTSC, too!!
320x200!! Aargh!!!

-=-=-
''Load, Next List!''
Thu, 07 Apr 2022, 08:08
cyangames
I know them feels (hugs) Just been PAL proofing bee happy from the NTSC version.

Gameboy dev though, much easier, just the one screen resolution!

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Thu, 07 Apr 2022, 09:17
Jayenkai


\o/yeay\o/... .. Though kinda bland looking.

(Scores do indeed load and save, but you need to quit or it can't access the file system to do it!!)

-=-=-
''Load, Next List!''
Thu, 07 Apr 2022, 09:52
cyangames
You can always make refinements later on should you feel the need. I prefer to use the term functional

Shame there's not way to save / load data though.

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Thu, 07 Apr 2022, 11:56
steve_ancell
Fuck! You can some some super smooth wormage with Blitz Basic 2.


View on YouTube
Thu, 07 Apr 2022, 12:14
Jayenkai
Or even Worms. Or Skidmarks. Or many more.
Wed, 13 Apr 2022, 04:02
Jayenkai


Slowly getting the hang of things.
If you put ALL of your drawing calls inside functions, inside the exact same include, then it works.
Annoyingly the default code editor can't handle two files at once, so you end up having to piss about with multiple Amiga Screens to work on multiple files at once, so it's a bit of a pain in the arse. But it's functional enough.

Framework Functionality


So far the menu is displayed, and you can use Button A to go into the game, and Button B to come back out. I'll have to avoid Button B though, since Amiga joysticks don't have a Button B! Eeek!
You can hit Escape to quite back to the menu, then hit Escape again to quit outright.
It handles the scores, high scores, last scores, etc.
The main menu lets you choose from as many difficulty levels as I can be arsed to code, and hitting Escape from the main menu will quit back to Workbench.

Joystick, WASD+K or Cursors+Z all work for control methods. Though I'm not sure how Blitz handles different keyboard layouts. Are those button scancodes? They sure do seem like they are, but who knows..

Next step, working out how I can do an ingame GUI bar at the top.
Hmmm....
Not sure I can toggle "slices" off and on in an effective way.

Also.. Yes, I'm well aware that the image doesn't look too much different to how it did last week.
It's been all groundwork and learning, I'm afraid, and that doesn't really show up onscreen very well

-=-=-
''Load, Next List!''
Wed, 13 Apr 2022, 04:18
cyangames
Good progress ether way, sometimes it isan't visual progress on the result but it still gets you closer to your goal!

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Fri, 15 Apr 2022, 15:58
Jayenkai

Playing a MED file


LoadMed n,"MyMed.med"
where n = the memory slot you're going to load the Med mod into. .. 0 to "Max Modules"

To start the mod
StartMedModule n (the same n you loaded into, earlier)

BUT.. That doesn't actually keep the mod active.

To do that, you need to trigger a PlayMed every frame.
The easiest way to do this is to create an Interval



The MusicMask defines which of the four Amiga channels should be filled with the mod.
1+2+4+8 where 1 is the first channel (left speaker), 2 is the second (right speaker), 4 is the third (right speaker) and 8 is the fourth (left speaker)

So if you set the mask to 1+2 = 3, then the first two channels will be music, and you still have the last two channels for your sounds.

This seems to work just fine. So far.. Though it took me a while to get that working without it glitching to hell and back!!

Also, I can't seem to change the tempo of the tune. I *think* it's locked to how often the PlayMed is called.
It registers a change in "9-0x" parameter, so I can more or less double/halve the speed it plays with that, but actual finer tempo commands seems to get ignored completely.

Not sure what that's about..
Hmmm..

I'm also worried what happens in NTSC mode. I think that'll impact the tempo, too.

-=-=-
''Load, Next List!''
Fri, 15 Apr 2022, 22:49
Pakz
I think there was a expansion for amiblitz with a more advanced player library. There were a whole bunch of expansions. I have no idea where to find these. I think there were also some on the blitz user magazine's that Acid software distributed.
Sat, 16 Apr 2022, 03:23
cyangames
aye, NTSC - PAL differences sure are fun! 60Hz to 50Hz can be a bit of a bitch.

You can resort to cycle counting in ASM assuming the CPUs are clocked differently based upon region, which the NES is although I'm not sure about the Amiga, but it still leaves the question as to how to best handle the difference in refresh rate.

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Sat, 16 Apr 2022, 03:32
Jayenkai
Gameplay wise, I think I'm ok.. Having the game feel a little faster/slower shouldn't be "too" big of an issue.
I also don't think the music should be too bad of an issue, either. I mean, you get used to what you hear first, right!?
Hmmm..

The biggest issue is the staggering 40 pixels in height that get lost when played in NTSC.. (240 PAL vs 200 NTSC)
40!!!
That's a whopping 16% of the screen.. Missing!!!
SpikeDislike's fine...I think.. The bottom of the screen should still be the bottom of the screen, and I'm fairly sure I took the height into account..
..

... Didn't I?! Hmm...

The Framework takes NTSC into account properly, and reduces my "jscrh" to fit.
Games like Flappadiddle will likely end up with two different sets of layouts depending on which system you play it on, and I can imagine a lot of other games will just wind up with chopped off bottoms!!

-=-=-
''Load, Next List!''
Mon, 18 Apr 2022, 07:48
Jayenkai
Lesson learned today.
When drawing images to the bitmap, instead of using the command Blit, use the command ClipBlit, which is the same as Blit but won't crash your game every damn time you're 1 pixel over the edge of the bitmap!!

I'm still trying to find the best way to generate a Flappadiddle level in the background. Speed is of the essence, here.
I've whittled it down to something that can happen over on "screen b" whilst "screen a" is playing the game.
Drawing all those spikes to the buffer is REALLY slow. I can do about 5 or 6 at a time, before I hit framerate slowdown.
As such, I've got it so that for the first 800 (800!!) frames of a level, the game's wizzing away in the background, building up and drawing the next level.

This appears to works well enough, but with one ever so slight issue..

.. Level 1..

Quite how I'm going to achieve that, I've no idea..
Might have to resort to having a loading screen.. ... eeeuuuwww!!!




Oh yeah, and with no sprite rotation, or even basic sprite mirroring, all these sprites have to be duplicated!

-=-=-
''Load, Next List!''
Mon, 18 Apr 2022, 14:44
Jayenkai

View on YouTube

That seems to be working alright..

The physics are working (but I think need tweaked a bit) and levels are somewhat happening, though not in a playable way yet.
Oh yeah, and it scrolls. Woohoo!!
Did NOT think that was going to be a thing, but I'm glad it is.

If you can see it on the top left of the screen (during level 2), there's a little counter that counts up to 732. That's the level generator whizzing away in the background to make the next level.
Before it reaches 732, the current level won't end, but hopefully "gameplay" will get in the way, there.

There's still the issue of the first level. I think I'll stick some "tutorial" platforms on the first screen. I can do that fast enough, and it'll give the player a nice simple first level to play with.

.. But, yeah. it's coming along well enough, I think.

-=-=-
''Load, Next List!''
Tue, 19 Apr 2022, 06:44
Jayenkai


The gameplay mechanics are coming together well enough.
5 platforms, hop in order, next level, rinse repeat.

Next I need to find a decent way to carve out the paths that flow in a nice way between all the points, without it being too obvious a path.

I have about 40 frames to do it, so that's 1 frame per x-grid position!!
Should be simple, right!?!

-=-=-
''Load, Next List!''
Tue, 19 Apr 2022, 07:58
cyangames
I imagine that Blitz is major buffer here, I had similar issues with the NES and had to switch off the screen in between loading levels which takes a few frames to run through, access to VRAM is limited to in-between frames otherwise and you've got ~ 2k CPU cycles to do everything there)

If there's a way to switch the screen off, you might find you can load the levels in quicker perhaps as I believe the amiga uses a processor in the same family to the NES, SNES, etc?

Not sure if that's possible but felt it might help out.

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Tue, 19 Apr 2022, 08:21
Jayenkai
Nah, It's almost working at the minute, though it does get a little bit jittery at points where it's doing a little bit "too" much maths stuff.
Just a case of optimising it every which way that I can, and it'll happily run along in the background.
(a+ instead of a=a+1... I'm SO bad at remembering to do simple things like that!)

Also, my lookups are currently way off when it's trying to find a path, due to how I randomised the X co-ordinates.
I mean, really, this is just taking the piss!!!



-=-=-
''Load, Next List!''
Tue, 19 Apr 2022, 08:27
cyangames
Yeah little optimisations like that can make a big difference with older hardware

In particular Bitshifting with << and >> (in C anyway) to multiply or divide by factors of 2 can really help reduce CPU usage also as it's just one command as opposed to calling a separate subroutine.

Looks like it's really coming along quickly mind It's making me want to head home early to get some NES dev done!

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Wed, 20 Apr 2022, 09:06
Jayenkai
Having to use Octamed to do the music. Main, I forgot about that one little quirk.
It "cleans up" the mod when you save it, and any samples left unused get DELETED, so when you go to load it up an hour or so later, all your spare instruments have smegging well vanished.
Grrr..

Got a 3-channel tune going (from 4 channels) with all the drums in channel 3. This plays on loop in the menu, but also I can mute the drum channel, too, when ingame. (Pinched that from you, Rychan!!!!)
This gives me one channel for menu beeps, and then 2 channels for ingame sounds.
Seems to work alright.

Now to extend the choon so it doesn't keep monotonously looping all the time.

-=-=-
''Load, Next List!''
Page : 1 2 Next
Prev