Sunday, 29 March 2020

NextBASIC - How to display a sprite (ZX Spectrum Next quick and easy guide)

You've just got your Next. You don't want to read through the large, very technical manual to get to the juicy bits...you just want to get right in there and put a hardware sprite on the screen. Here's how:

Preprep 

++SKIP THIS IF YOU KNOW HOW TO CREATE A DIRECTORY OR DON'T CARE++

First, go into the browser and make a new directory by pushing 'K'.

Name it binthis because I doubt you'll want to keep this test permanently.

Go into NextBASIC

type CD "binthis"

CD means 'Change Directory" and this is to make sure we save everything in here to keep things tidy.

Draw your sprite


in NextBASIC type: .spredit mysprite.spr

.spredit invokes the sprite editor.
mysprite.spr is the filename of your sprites (this doesn't actually create the file until you save it from the sprite editor. Also, don't put the name in quotes or it won't save).

The editor loads. Feel free to scribble over the top of the first sprite, or if you just want to get on with things, just hit Shift-S to save.

Exit the editor with Symbol Shift and Space.

Displaying the Sprite in NextBASIC


Here's the meat of it.

10 BANK NEW spritey

This tells the Spectrum to reserve a bank in memory to load your sprite data into. "spritey" is just a variable name created with this command.

20 LOAD "mysprite.spr" BANK spritey,0,256

OK so this loads the sprite file into a memory bank. In this case, the one called spritey.
The 0 is the where in the bank it loads the data - in this case 0 loads into the start of the bank.
The 256 is and amount of data to load. Each 16x16 sprite is 256 bytes. If you want to load in more than 1 sprite, just multiple the number by 256. We are loading just one.

30 SPRITE BANK spritey

This tells the Next to use the data in bank spritey for sprites.

40 SPRITE CLEAR: SPRITE PRINT 1

This clears the screen of any sprites that might be there from other programs, then it sets all sprites to visible. Setting the value to 0 makes all sprites invisible.

50 SPRITE 0,80,80,0,1

This is the command to draw a sprite onto the screen. The variables are:
0 (The number of the sprite...this is an identifier and has no bearing on what graphic is used)
80,80 (The x,y position of the sprite on screen)
0 (The image/frame/pattern to use. This corresponds to the actual graphic data you saved in the sprite editor. We loaded one image. Images always start at 0. If we loaded 4 sprites, this number could be 0-3)
1 (This makes sure the sprite is visible)

RUN the program.

That's it, simple as that.

Feel free to save this example with SAVE "spritetest.bas" (use .bas as an easy identifier for basic programs).

Also feel free to go back into the browser and erase the whole folder with 'E'.


*Note. It's good practice to have the command BANK spritey CLEAR at an exit point in your program, otherwise if you keep running it, the Next will keep allocating new areas and you'll get at Out of Memory error.


Friday, 30 November 2018

Grelox: Adding Fluff

Progress continues at a slow but steady pace:

All levels are built.
All levels are populated.

Here's a bit of extended gameplay from one of the first levels (each area consists of 2 selectable levels, both of which must be completed to progress).



I am currently adding 'fluff' elements to the levels. These are basically background features like cobwebs, hanging vines, stalagmites, crumbling rocks...non essential but little visual touches that add to the atmosphere.

One thing I have abandoned are boss levels. I went through various concepts for these. The first was just a fixed screen with standard gameplay and a big nasty to kill.



Next, I was thinking of a 3D into-the-screen section (like the tunnel sequence in Konami's ALIENS coin-op).


But in the end it was starting no feel like feature creep, and also would extend development time too much. With the current 7 levels, the game already feels like a good length and making it too long would just cause player fatigue. So boss battles are ditched. Maybe in a sequel?

The main thing left on the 'to do' list is the ending and the music. It does feel like the last stretch is ahead, so a release next year is looking almost definite now.

Wednesday, 18 July 2018

Grelox: Populating Levels

I've had a burst of activity on Grelox in the last week.

Levels 1-3 are now fully mapped, level 4 is part way through the mapping stage. The tileset for level 5 is complete, so I need to work out the overall structure of the level before starting to map it out.

The main progress has been enemies - I've coded a new bunch of enemies and have now populated the first 3 levels entirely. This gives me the first real glimpse of how the game truly plays and it's now a matter or balancing.



Difficulty is a hard thing to judge, especially when you're the author of a game. But for the most part I can see where the especially challenging (or potentially unfair) bits are, and also get a feel of how many hit points the player should have. I've still not locked down the overall structure...my current plans are to have each level quite challenging, but also implement an autosave feature meaning you don't have to wade through the same stages every time you play.

This is a fair option if I can add a sufficiently large number of levels to stop the game feeling too short. If not, I may have to return to the more traditional style, but maybe with a lot (or even infinite) continues with every play. Limiting continues is only something I would do with an overall easier game, but it does make the balance a lot harder to reach.

Alternatively, I could just add levels of difficulty based on player health. That may be the best route, although I have considered a hard setting that has additional enemies, for those who really want to push themselves.

Another thing I implemented is a simple player death animation which pushes you back to the map screen. I have come across a bug on occasion which I'm not sure if I've fixed, so it may be time soon to get external playtesters. There's also a minor jumping bug that happens rarely, but is easily reproducible. This one has me a bit stumped. Bugs like this are especially difficult when you're someone like me who isn't really a dedicated programmer, but I'm sure it will all sort itself out in the end.

Sunday, 29 April 2018

Grelox: New level art

The last few weeks have been about sorting out a lot of the old graphics for use in the game. I've got various versions of tiles from all the platform switching we did (first it was going to be NES style on PC, then it was for MSX, now back to PC but more Master System style).

Recolouring doesn't take an awful lot of time, but shuffling everything into individual level tilesets is more difficult. I want to have a nice variety of visuals with no two levels looking the same, so each area needs specific styles i.e. pillar/wall type, platform type, ground type. It's hard not to overdo things and allocate too many different tiles out of worry that it might all look samey, but in practice, you really don't need that much to be effective.

(Music is a WIP by Arkhan, written way back for the initial Win version)

The second area has had basic mapping completed, with most of the foreground tiles in place. I'm currently placing all the background wall tiles which is a less exciting job. I've decided that it would be easier to sort out the bulk of the backgrounds and mapping before I go back to the enemies. At least then my focus is on one thing at a time.

Thursday, 22 March 2018

Grelox: Flies!

Over the last few days I've been adding some minor enemies to test. There are small orbs that float about randomly and some lightbulb-shaped things that just go up and down for the moment. I might keep a few of these simpler enemies in as easy fodder. The lightbulbs currently have high hitpoints, perhaps this is a good way to tempt the player to risk just running under them rather than stand and hack away.

I've also implemented some spiky floor and ceiling runners.


I think it's important to have a selection of non-destroyable hazards like this to mix things up, allowing timing to be involved, especially if they are running across a terminal location while you are trying to hack it.

Speaking of terminals, the original idea was to have 4 terminals per room that have to be hacked to unlock the door (representative of the 4 numbers per room in Zillion). But I decided that this might be a bit tiresome, so I'm dropping it to 3. As I was looking through the maps, there was always one terminal that was easily redundant anyway - 3 is enough to ensure the player needs to explore the entire room before exiting.

The last thing I added are pods. These won't actually appear in the first level as they are visually out of place, and more fitting in the darker, more cave like areas. They can be stepped on (possible strategic advantage?) until burst, where they release a swarm of angry flies. I was planning to have small flies only, but I accidentally drew the first one way too big and liked it enough to keep it.



Sunday, 18 March 2018

Grelox: Creating explosions and animating Space Sharks

Drawing an interesting explosions take a bit of forethought. Most are just blobs of red, orange and yellow but I wanted something a bit different for the bigger enemies.

Firstly, I sketched out something very roughly. I've always liked the enemy explosions in Shadow Dancer on the Mega Drive, so I took that 'pillar of flame' look as the central idea, but surrounded it with chunks of standard exploding bits.

The circle in the centre was just for positioning, but when it came to the second pass, where I drew everything neater and clearer in one colour, I kinda liked it as it could represent some concentration of energy, or a small black hole or somesuch. The wispyness also reminds me of the Onibi Yokai which appeals to me.

The colouring was pretty simple. The red surround with blue interior should contrast against most background art. It's only a few frames, but they are over so quickly that the effect works well enough.

I've also updated the 'hit enemy' flash with some animation, changing the colour to pink to match the player sprite and not clash with the explosions.

The Space Sharks now have a walking animation, rather than sliding around. This was constructed with my usual method - I draw out everything in monochrome first. I find this is pretty important as it allows you to refine the look and positions because once you've shaded the whole set it's a royal pain to fix (saying that I did adjust a few minor areas after the fact).

All in all, they look nice and smooth. I maybe could have put more wobble in some areas, but I'm trying not to go too over the top with animation frames as I want to keep the feel of a certain era of gaming.

Saturday, 17 March 2018

Grelox, PC Engine and other plans for 2018

Here's the latest on my various projects, it's been a long time since the last update but hopefully I'll get into the habit of more regular updates.

Inferno is done and out, physical copies are due in the Aetherbyte store very soon. Some have already been dispatched to Beep.

Grelox is a continuing saga of changes, cancellations and delays ever since it started out as something called Apothecary for the PC Engine. But I'm back working on it now for Windows. Programming is an annoying distraction for me because I enjoy the graphics, game and level design much more. However, the main gameplay elements are all in place so the bulk of the heavy lifting is sorted. Tasks now involve coming up with all the enemies & hazards, mapping everything and converting a lot of the MSX style art into the new Master System style that I'm using. Here's one of the recoloured baddies.




I'm also in the early stages of another PC Engine related book. Not a second volume of Pixellence or PC Engine Gamer, but something more personal and unique. Details currently secret but I'll plod on with this as time allows. Ideally I'd like to have it released before the end of the year but it all depends on how things go.

We're between projects now at Aetherbyte. Of course we have plans (too many), but I cant reveal them. But to throw you a bone, here's a drawing of something.

Finally, I've got a new freshly styled issue of ZX Spectrum Gamer 90% complete and ready to go. This will be a special issue, containing an exclusive brand new game called Aeon. The game is split over several tapes and tells a story with the aid of illustrated cut scenes (well, lots of loading screens tied together but you get the idea). It was quite an ambitious project for me (being 4 games and lots of pictures) but I think it worked out well considering my rudimentary knowledge of AGD. I'm just waiting for the 128k music and it's good to go.