Fast scrolling game howto, anyone?

Want to talks about games you like, would like to see developed on the Oric, it's here.
User avatar
Chema
Game master
Posts: 2840
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema »

Hi all, thanks for your input.

Barnsey, I am not sure what to say. Your ideas are fantastic, really, and I thank you very much for your suggestions, but they diverge too much from the idea I have about the game.

Adding a 3D display on the top is nice, but I won't be able to keep the current speed of 25fps if I have to update that. Besides I even think it would be a bit confusing for the player, who would need to look at two screens (and a radar!) at the same time.

I wanted a simple shooter with a puzzle twist, maybe you expect too much from me :)

What I wanted to do was a simple score panel where lives, equipment, score, etc.. could be placed. Something nice looking but simple and clean, so it does not distract the player too much.

Problem with the bottom part is that, though I also thought about putting the lives and equipment there, it is now quite empty. Also it is text mode, so no AIC, and attributes cannot be hidden so well. Your idea about a timer is quite a good one. I had not though about imposing a time limit/bonus, but I can reconsider that :)

Cheers

User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: Fast scrolling game howto, anyone?

Post by barnsey123 »

I know I can get a bit carried away sometimes...I keep forgetting the hardware is still living in 1983! :D
My ideas often exceed my abilities!

How about this? It's cleaner but still with AIC on the TV screens. The AIC effect will be more effective then as it'll look like a fuzzy TV display.

The middle screen shows a map of the current battleship showing remaining targets. Perhaps this can scroll across (slowly)

The right display is broken (perhaps due to damage sustained in the game) maybe it contains some vital info such as power/fuel left or smart bombs or something. This may add to the challenge on later levels? Perhaps it could contain an artifical horizon like in real aircraft or maybe a heart rate monitor! Some displays could be for eye-candy only.
Concept 2
Concept 2
chema.png (71.23 KiB) Viewed 9929 times

User avatar
Chema
Game master
Posts: 2840
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema »

I must confess I like your design a lot. And it has also given me some ideas to play with :)

I am not very sure to include realistic-looking elements, as my idea about the game is not to take it too seriously :). Anyway it looks very nice indeed.

Thanks!

User avatar
Chema
Game master
Posts: 2840
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema »

There be sound effects!

Yep. I finally integrated the sound engine into the game and tested the first sfx :)

Let me get a bit technical. The sound engine (which I talked about some time ago) is designed to play both music and sfx, and it is designed to be compact, not general or easy to use (no editor, for instance). The current result is 556 bytes, which is quite adequate, in my opinion.

The general outline is quite simple. Each channel is controlled individually and you can set up a Play List to it. Each play list consists of a set of patterns (numbers 0-127) to be played or commands to be executed. An example command may be something like END to finish the list.

A pattern is a list of notes and commands to be played. Notes are in long notation from 0 to 96 to cover 12 notes and 8 octaves. It also contains commands such as RST to rest a number of steps, or SIL to silence the channel (if a continuous sound is being played). The speed at which the notes are played is controlled by a Tempo variable.

Each note is played in the channel with a software defined envelope, which is a volume variation lists of 8 entries (from 0 to 15) and ornament, which is a pitch variation list (positive or negative entries) of 8 elements (which repeats during the duration of the note).

Each time the routine is called (from within an ISR or anywhere else) it plays the note with the corresponding variation in volume or pitch according to the current envelope and ornament until a counter initialized with the value of Tempo reaches zero. Then the next entry in the pattern list is obtained and processed (another note or an command).

So you can see envelopes and ornaments as the "instrument" to be used. They are set up in the Play List with the ENV and ORN commands and remain active until another ENV or ORN command is found. Patterns are useful to set up the list of notes to be played, using RST commands (which have a parameter of duration) to indicate the duration of each note. This way it is easier to translate from a sheet music to a pattern.

Patterns are re-usable and it is our responsibility to find repetitive sequences to save memory.

I've talked about this idea before, so won't get into more detail now. The current set of commands that are implemented in the Play List is:
END, ENV, ORN (set envelope and ornament), NON, NOFF (add/remove NOISE to this channel), TON, TOFF (same for tone), NVAL (sets the value of the noise register in the AY chip), NOFFSET (add an offset to each note before playing it) and LOOP (jump to an entry in the list).

I have to add one to alter the volume, and also a master volume max value to let the player choose it.

Sound effects are exactly the same as tunes: playlists of commands and notes along with envelopes and ornaments. A simple sfx could be just a list such as:

Code: Select all

.byt ENV, 0, ORN, 0, 0, END	

To select envelope id 0 and ornament id 0 and play pattern 0. Then finish.

The pattern could be something such as a single note:

Code: Select all

	.byt 7*12
	.byt END
And we can introduce noise, more notes, change the envelope or ornament along the list, etc. Clever ornaments and envelopes, however, are quite enough to produce quite good results with a single note!

It is not the most compact way to do it, but it is quite flexible and compatible with the music player. Envelopes, Ornaments and patterns can, of course, be shared between effects.

A problem I had to resolve is that we would like to have simultaneous sounds playing in the three channels. This usually requires attaching some sfx to each channel only or finding an empty channel before playing.

The former has the problem that we will have some channels unusable a lot of time. Imagine you want to play an small tune when the player gets an extra life. You can reserve channel A for that (so it is not interrupted by any other sfx), but it will be most of the time unused.

The second choice will work much better, but also has one problem. If a long effect is being played, other (probably more important) effects may not find a free channel to be played. Maybe we don't want that.

So I set up a priority system. Each effect has a priority. An empty channel is set to priority 0. To play an effect a free channel or one playing an effect with less priority is selected (if there is one - always the minimum priority is selected, of course). In the second case the low priority sfx will be stopped and replaced with the high priority one.

I think we have an optimal usage of the three channels with this idea. The usage is simple: load register A with the id of the sfx/tune to be played and jsr _PlaySfx.

If you want to play an small tune using two channels, assign the tune the highest priority and it won't be interrupted by anything else!

I have currently 8 sfx for testing, which use 260 bytes (quite a lot!). But that size will be reduced greatly when reusing envelopes, ornaments and patterns (144 bytes are used for envelopes and ornaments with a lot of duplicated entries, and some sfx are using the same patterns, or variations that can be assessed through commands in the PlayList).

For testing it is simpler to have them separate.

I made some tests and it works quite nicely. The only issue I found is that it is relatively CPU intensive. It may take up to 1000 CPU cycles to process the three notes in a pattern (when there is a change in the note). I know where most of the cycles go, though: in the Note2Pitch routine which is compact but slow (it is the routine posted by Twiligte in the wiki, and it takes 200 cycles approx. for each call). I may use a faster approach using a 192 byte table, which would reduce the timing quite significantly. It will, however, increase the size of the player.

Unfortunately the fact that the sound engine is flexible, compact and nice, does not mean that I am able to produce spectacular sfx or music tunes. That is a completely different aspect, which I need to improve. It is like having HIDE, but sucking at drawing beautiful pictures :)

Anyway, another small advance :)

User avatar
ibisum
Wing Commander
Posts: 1471
Joined: Fri Apr 03, 2009 8:56 am
Location: Vienna, Austria
Contact:

Re: Fast scrolling game howto, anyone?

Post by ibisum »

Very much looking forward to your first playable release - and also, when you're done, I'm looking forward to coming back to this thread and reading the details you've written while I'm browsing your sources, so I can learn something valuable while I'm at it! :)

User avatar
Chema
Game master
Posts: 2840
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema »

There be items to pick up!

Yep. Small effort this time and I got the items (pickups/powerups/whatever) working!. Just a preliminary test, but items will appear randomly (well, not so randomly but you get the point) when destroying enemies... Of course with their sfx when they appear and when you pick them up!

This screenshot shows the player (me!) about to pick up an item dropped by one of those phantoms... This time it could resemble an extra life, for instance.
Item about to be picked up
Item about to be picked up
item.png (55.58 KiB) Viewed 9843 times
I also sorted out the code a bit more, including some extra routines I need, but nothing to show you... yet.

@ibisum: I will release the sources, of course. About a first playable alpha, I need to work a bit more on some details showing at least one complete level with a reasonable difficulty level.

Soon, I hope :)

User avatar
barnsey123
Flight Lieutenant
Posts: 379
Joined: Fri Mar 18, 2011 10:04 am
Location: Birmingham

Re: Fast scrolling game howto, anyone?

Post by barnsey123 »

Good to see new features. I am very interested in your new music/Sfx routines. Can't wait to see what you can do with it. Looks like this game is set to become a classic... :D

User avatar
peacer
Flight Lieutenant
Posts: 435
Joined: Wed Jun 09, 2010 9:23 pm
Location: Turkey
Contact:

Re: Fast scrolling game howto, anyone?

Post by peacer »

It's been long time to see playable demo for this project :)

Can we have an update? :)

User avatar
Dbug
Site Admin
Posts: 3793
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Fast scrolling game howto, anyone?

Post by Dbug »

Something doable is to use inverse video for the bonus, you could have them drawn in a 'box', your color scheme is cyan/black, which gives you white/red as possible colors for the bonus. You could even make them blink between inverted and non inverted :)

User avatar
coco.oric
Squad Leader
Posts: 656
Joined: Tue Aug 11, 2009 9:50 am
Location: North of France
Contact:

Re: Fast scrolling game howto, anyone?

Post by coco.oric »

Yeah !

This is great.
I'm sure i'll test the first playable demo you'll release and that i'll look, learn with your music routine. (i'm level 0 in code music and in music also)
coco.oric as DidierV, CEO Member
Historic owner of Oric, Apple II, Atari ST, Amiga

User avatar
Chema
Game master
Posts: 2840
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema »

More small advances. I have hunted down an ugly bug and sort a bit the difficulty increasing with level, and worked out some other general aspects. Still need some tweaking, but it is evolving as expected with the little free time I've got.

Anyway time for another video, I think. This time it shows several things. First how a user-driven software calibration of the vsync signal could be done. Not the most elegant thing, but it is easy once you get it and it needs to be done only once!

Sfx are included. Please notice the actual effects are just preliminary and may change. Also I plan to add small tunes (when getting an extra life, for instance) playing in one channel and effects that indicate when enemies are about to do something 'special'. But the engine is working with the priority method which is good.

Also you can see the difficulty of level 1 (tutorial phase). Still cannot destroy the main ship, I want to keep that for later :). So after some dying I use a hack to jump over several levels (over 20) to show how a more advanced level may look like.

I am still not revealing how to destroy the ship, because that will be some kind of puzzle and I would like to keep it as a small surprise (no high expectations, though, something simple).

Well, here it is. Any feedback is welcome.

http://youtu.be/7WeFgFSwEJ4

User avatar
Dbug
Site Admin
Posts: 3793
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Fast scrolling game howto, anyone?

Post by Dbug »

It sounds very nice, I like the floating hearts as well :)
I'd say that the only issue is that enemies are sometimes difficult to see, the player ship is easier thanks to the shadow, perhaps you could increase the border around enemies (more masking) to make them more visible over the background?

User avatar
Dbug
Site Admin
Posts: 3793
Joined: Fri Jan 06, 2006 10:00 pm
Location: Oslo, Norway
Contact:

Re: Fast scrolling game howto, anyone?

Post by Dbug »

Actually I was thinking of a way to mitigate the frustration of dying because one does not see the enemies: What about if you had an energy/shield bar, and when you are in contact with enemies you just get the bar move down possibly with some flashing effect somewhere, so at least you don't die immediately, and some of the bonus can be used to recharge the bar?

User avatar
Chema
Game master
Posts: 2840
Joined: Tue Jan 17, 2006 10:55 am
Location: Gijón, SPAIN
Contact:

Re: Fast scrolling game howto, anyone?

Post by Chema »

I agree with your comments, Dbug. Not sure, but I recall I did not have difficulties on the real machine. Anyway I had some similar idea about the shields. See the glowing energy balls you can collect? And the bar on the score panel? :)

But I am not decided yet. There are other possible usages for those...

Anyway I will think about this issue. Thanks for the input.

You see I followed your advice for the calibration screen. Do you think that could work as it is?

User avatar
peacer
Flight Lieutenant
Posts: 435
Joined: Wed Jun 09, 2010 9:23 pm
Location: Turkey
Contact:

Re: Fast scrolling game howto, anyone?

Post by peacer »

:shock: :shock: I couldn't believe if I saw such a video and they say it is from an Oric game.. Its absolutely a miracle !

Please tell that there's going to be tape version ! I want to play this on my real Oric !

Post Reply