8-way scrolling system for prototyping games on STE

GFA, ASM, STOS, ...

Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team

MM41
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Sun Jun 28, 2015 2:36 pm
Location: France

Re: 8-way scrolling system for prototyping games on STE

Postby MM41 » Mon May 02, 2016 7:06 pm

The new demo is wonderful :D , run very well on real STe

Well done! DML :D

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3474
Joined: Sat Jun 30, 2012 9:33 am

Re: 8-way scrolling system for prototyping games on STE

Postby dml » Mon May 02, 2016 7:14 pm

:cheers:

It's pretty crappy AI - just spawns a single enemy type near the player. But the system under it is reasonably 'proper'. Will take a bit longer to get collisions working properly but not too far off.

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3474
Joined: Sat Jun 30, 2012 9:33 am

Re: 8-way scrolling system for prototyping games on STE

Postby dml » Tue May 03, 2016 11:01 am

Again, to provide an idea of whats going on here, I have attached the source for the last demo from the weekend.

All of the demo-specific stuff is in this one sourcefile and it's currently all C code - well, a very narrow flavour of C++.

Everything outside of demo1.cpp is generic/reusable and is a mixture of 68k and C for some parts. Most of the reusable stuff will end up as 68k as it settles down - unless I think its likely to need understanding & modding for different kinds of game, in which case I'll probably leave some parts as C.

I have also attached entity.h from the generic part of the engine but it lacks comments and is still in very early stages. Only offered here as some context for the code in demo1.cpp. 68k structures for entity.h will also be provided once it settles down (no point in that while it is still changing).

So if you can follow my weird code and comments, you could probably use the system to prototype a game once the other parts arrive.

The player craft & options currently use screen-local coordinates, since those are pushed along with the scroll. Everything else will use world coordinates (Any collision interactions will use world coordinates for the sake of coherence).

There is an obscure looking detail in the code which handles 'virtual page coordinates' for drawing, which isn't really needed for this h-scroll demo but would be needed for vertical scrollers or 8-way, so I kept it in. This compensates for internal, hidden scrolling behaviour, to maintain the illusion of infinite scroll ranges. It's only needed when trying to access the display workbuffer directly (as a couple of things in this demo will). The automatic entity drawing stuff will do this part itself anyway.


All of the source will be provided when it is ready because I myself hate using black boxes that can't be modified or fixed when required. :)
You do not have the required permissions to view the files attached to this post.

User avatar
calimero
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 2310
Joined: Thu Sep 15, 2005 10:01 am
Location: STara Pazova, Serbia
Contact:

Re: 8-way scrolling system for prototyping games on STE

Postby calimero » Tue May 03, 2016 3:24 pm

new era of Atari ST games :) super smooth and with border removal! Incredible!

to bad that I can not test it on real ST on TV though ....
using Atari since 1986.http://wet.atari.orghttp://milan.kovac.cc/atari/software/ ・ Atari Falcon030/CT63/SV ・ Atari STe ・ Atari Mega4/MegaFile30/SM124 ・ Amiga 1200/PPC ・ Amiga 500 ・ C64 ・ ZX Spectrum ・ RPi ・ MagiC! ・ MiNT 1.18 ・ OS X

User avatar
AtariCrypt
Captain Atari
Captain Atari
Posts: 392
Joined: Fri Mar 14, 2014 5:04 pm
Location: Lancashire, England
Contact:

Re: 8-way scrolling system for prototyping games on STE

Postby AtariCrypt » Tue May 03, 2016 7:46 pm

calimero wrote:to bad that I can not test it on real ST on TV though ....


I knocked my Mega STe down to 8Mhz and it worked a treat - jaw dropping to see (and control).
I hope all this leads somewhere reallllllly cool for the near future. ?

Steve

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3474
Joined: Sat Jun 30, 2012 9:33 am

Re: 8-way scrolling system for prototyping games on STE

Postby dml » Wed May 04, 2016 5:18 pm

Thanks for following the coder spam. Some more changes.

https://dl.dropboxusercontent.com/u/129 ... input3.zip

W,S,A,D, '#' key to shoot.

Generally runs at 50hz, but haven't optimized any recent work and the game/entity part is still all C++ so it can drop if it gets busy (and it's a rough drop to 25 - no cushions yet!). No collision handling so far - that's some work. No custom drawing for weapon, just same sprite routine for all. Weapons should have custom code for their number and speed.

I do intend to swap the BG at some point but I don't have many complete h-scroll BGs except these. Most of the rips I have are v-scroll. And these have been a good stress test for PCS anyway.

1.png
2.png


I have a new sprite clearing system due to go in later. The current one is efficient for smallish sprite coverage and higher scroll cost (STF). The new one will be better when scroll is cheap sprite load is high (STE, maybe STF with 4pix shift) but uses a bit more ram.
You do not have the required permissions to view the files attached to this post.

User avatar
AtariCrypt
Captain Atari
Captain Atari
Posts: 392
Joined: Fri Mar 14, 2014 5:04 pm
Location: Lancashire, England
Contact:

Re: 8-way scrolling system for prototyping games on STE

Postby AtariCrypt » Wed May 04, 2016 6:18 pm

Dang I'm loving this!
Couldn't diagonally move with fire held down but now I'm just being annoying ;D

MM41
Obsessive compulsive Atari behavior
Obsessive compulsive Atari behavior
Posts: 115
Joined: Sun Jun 28, 2015 2:36 pm
Location: France

Re: 8-way scrolling system for prototyping games on STE

Postby MM41 » Thu May 05, 2016 10:44 am

I'm waiting for the next stage :D , sprites collision?

wietze
Captain Atari
Captain Atari
Posts: 283
Joined: Fri Mar 01, 2013 10:52 pm

Re: 8-way scrolling system for prototyping games on STE

Postby wietze » Thu May 05, 2016 11:54 am

This looks very promising dml, keep up the good work!

User avatar
shoggoth
Nature
Nature
Posts: 983
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: 8-way scrolling system for prototyping games on STE

Postby shoggoth » Thu May 05, 2016 5:50 pm

Yikes, awesome :)

A small request though - could we trade '#' for something that maps better on emulators (control, shift)?
Ain't no space like PeP-space.

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3474
Joined: Sat Jun 30, 2012 9:33 am

Re: 8-way scrolling system for prototyping games on STE

Postby dml » Thu May 05, 2016 5:55 pm

shoggoth wrote:A small request though - could we trade '#' for something that maps better on emulators (control, shift)?


Yes that would probably be a good idea :) Sounds like there's an issue anyway with # on the kbd matrix interfering with movement so i'll investigate that later too...

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3474
Joined: Sat Jun 30, 2012 9:33 am

Re: 8-way scrolling system for prototyping games on STE

Postby dml » Thu May 05, 2016 7:26 pm

MM41 wrote:I'm waiting for the next stage :D , sprites collision?


Indeed it will be! :)

User avatar
shoggoth
Nature
Nature
Posts: 983
Joined: Tue Aug 01, 2006 9:21 am
Location: Halmstad, Sweden
Contact:

Re: 8-way scrolling system for prototyping games on STE

Postby shoggoth » Fri May 06, 2016 6:39 am

dml wrote:
shoggoth wrote:A small request though - could we trade '#' for something that maps better on emulators (control, shift)?


Yes that would probably be a good idea :) Sounds like there's an issue anyway with # on the kbd matrix interfering with movement so i'll investigate that later too...


IIRC left/right shift keys does not interfere and hence are well suited as fire buttons :) (not sure about Control/Alt though)
Ain't no space like PeP-space.

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3474
Joined: Sat Jun 30, 2012 9:33 am

Re: 8-way scrolling system for prototyping games on STE

Postby dml » Fri May 06, 2016 5:32 pm

Ok fire key has been fixed (now RSHIFT), and basic entity interactions now fully operational. :twisted:

https://dl.dropboxusercontent.com/u/129 ... input4.zip

All objects are now entities - the bodges were all cleaned up and removed. Nothing optimized since last time. Just very quick changes to enable collision handling and add some new gfx that were waiting on the same spritesheets.

The game layer is still all C code. I thought speed would have really hit the wall by now but it struggles on somehow.

Some parts will need the 68k treatment before long though... the list processing and callback overheads are quite high and there is a lot of activity in those areas. Still I think it runs well enough as a sample and quite easy to hack/adapt.

c1.png

c2.png

c3.png

c4.png

c5.png
You do not have the required permissions to view the files attached to this post.

User avatar
exxos
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 4933
Joined: Fri Mar 28, 2003 8:36 pm
Location: England
Contact:

Re: 8-way scrolling system for prototyping games on STE

Postby exxos » Fri May 06, 2016 5:47 pm

8) smooooooooth 8)
4MB STFM 1.44 FD- VELOCE+ 020 STE - Falcon 030 CT60 - Atari 2600 - Atari 7800 - Gigafile - SD Floppy Emulator - PeST - various clutter

http://www.exxoshost.co.uk/atari/ All my hardware guides - mods - games - STOS
http://www.exxoshost.co.uk/atari/last/storenew/ - All my hardware mods for sale - Please help support by making a purchase.
http://ataristeven.exxoshost.co.uk/Steem.htm Latest Steem Emulator

User avatar
AtariCrypt
Captain Atari
Captain Atari
Posts: 392
Joined: Fri Mar 14, 2014 5:04 pm
Location: Lancashire, England
Contact:

Re: 8-way scrolling system for prototyping games on STE

Postby AtariCrypt » Fri May 06, 2016 5:49 pm

I'm so eager to see where this "project" goes because I'm constantly being blown away by dml pushing the STe :cheers:

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3474
Joined: Sat Jun 30, 2012 9:33 am

Re: 8-way scrolling system for prototyping games on STE

Postby dml » Fri May 06, 2016 6:08 pm

:cheers:

Well the 'project' is really just some effort-saving devices (like scrolly backgrounds and sprites), tools to make content and some glue to make things move around and do things without huge effort and pain. This demo is just an example of how to use those bits together properly. I don't think I have the time/resources to progress it to a full game but somebody else could.

I'll spend a bit of time commenting the new code and upload that soon. It doesn't demo everything you can do but still quite a lot covered.

I don't know how much ram it uses just now but it is still comfortably less than 512k on STE.

The same demo *should* run on STF if I rebuild the sprite data with different flags (but it's definitely going to drop to 25Hz on that machine, with current code).

User avatar
dma
Atari God
Atari God
Posts: 1013
Joined: Wed Nov 20, 2002 11:22 pm
Location: France
Contact:

Re: 8-way scrolling system for prototyping games on STE

Postby dma » Fri May 06, 2016 6:33 pm

Gameplay appears! And great death animation. :-)

If someone wants to build a game on this, i would love to compose music. ;-)

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3474
Joined: Sat Jun 30, 2012 9:33 am

Re: 8-way scrolling system for prototyping games on STE

Postby dml » Fri May 06, 2016 7:33 pm

dma wrote:If someone wants to build a game on this, i would love to compose music. ;-)


That's instant incentive! :D

One of the things I was idly trying to figure out is how to play decent YM sfx on top of YM music. It would be great to have a YM music driver that can accept events from the code to trigger instruments - then it would be possible to just edit the sound fx in the YM tracker. But I looked around and I don't think anything currently supports that kind of external triggering. If you or anyone know of such a thing please let me know!

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3474
Joined: Sat Jun 30, 2012 9:33 am

Re: 8-way scrolling system for prototyping games on STE

Postby dml » Fri May 06, 2016 10:31 pm

...and this version is the same, but now displaying 80-colour graphics using complementary fields (instead of raw dithering, which the previous demo used).

https://dl.dropboxusercontent.com/u/129 ... nput4e.zip

There are occasional glitches due to a sync bug after adding all the game stuff and moving things around but ill deal with that later.

Reminder: Complementary-field rendering (interlaced dither) will shimmer visibly if not used with strict VSYNC on emulators (which usually requires fullscreen too).

User avatar
dma
Atari God
Atari God
Posts: 1013
Joined: Wed Nov 20, 2002 11:22 pm
Location: France
Contact:

Re: 8-way scrolling system for prototyping games on STE

Postby dma » Sat May 07, 2016 6:57 am

dml wrote:One of the things I was idly trying to figure out is how to play decent YM sfx on top of YM music. It would be great to have a YM music driver that can accept events from the code to trigger instruments - then it would be possible to just edit the sound fx in the YM tracker. But I looked around and I don't think anything currently supports that kind of external triggering. If you or anyone know of such a thing please let me know!

The GODLib C library got a sfx system which can normally work along generic SNDH replay.

(i used it myself in Manical Drop with 2 channels and even 1 channel music (for 2 players game) so that the sfx of each player wouldn't cut the music, but this was a experimental approach of ST sound design, as the music is then quite limited)

[EDIT]

I found the related files in the library. These are called "PINKNOTE".
Actually it is not explicitly labelled as "sfx system", but i used it as such, building YM pseudo-macros with the commands and object it provides.

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3474
Joined: Sat Jun 30, 2012 9:33 am

Re: 8-way scrolling system for prototyping games on STE

Postby dml » Sat May 07, 2016 11:20 am

Ok that's very interesting - thanks. I'll definitely take a look at that. I should maybe have thought about digging through the godlib bits earlier but it does make sense that they'd have something like this...

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3474
Joined: Sat Jun 30, 2012 9:33 am

Re: 8-way scrolling system for prototyping games on STE

Postby dml » Sat May 07, 2016 1:57 pm

I thought the 80 colour version was dropping frames a bit too easily compared with the other one and put it down to some bug - but it turns out I forgot to configure it for 50hz-only dual-field, so its currently updating 2x backgrounds per frame instead of 1. Another random thing on the todo list then.

User avatar
TheNameOfTheGame
Atari God
Atari God
Posts: 1353
Joined: Mon Jul 23, 2012 8:57 pm
Location: Almost Heaven, West Virginia

Re: 8-way scrolling system for prototyping games on STE

Postby TheNameOfTheGame » Sat May 07, 2016 4:08 pm

Thanks for the new demo...pretty cool.

A couple questions:

Is there an advantage to the CFR method over raw dithering (I mean performace-wise; is one less cpu intensive or less taxing on the system overall?)

Does CFR require locked 50Hz operation or will it work for us NTSC blokes at 60hz? I do have to plead total ignorance on the CFR method so apologies for that :cheers:

User avatar
dml
Fuji Shaped Bastard
Fuji Shaped Bastard
Posts: 3474
Joined: Sat Jun 30, 2012 9:33 am

Re: 8-way scrolling system for prototyping games on STE

Postby dml » Sat May 07, 2016 4:46 pm

Hi!

TheNameOfTheGame wrote:Is there an advantage to the CFR method over raw dithering (I mean performace-wise; is one less cpu intensive or less taxing on the system overall?)


In the current configuration, if the game can maintain 50hz then the CPU cost is exactly the same for the two methods (1-field dither or 2-field dither). The 2-field method takes just twice as much ram for the tiles (for now that's 85k x 2, which is quite small - but it could be a considerable cost for huge maps).

If the game needs to cope with 25hz or less though, you need an extra buffer for odd/even fields on each main buffer so it can continue flipping at 50hz, while the drawing takes place at 25hz - so 4 buffers instead of 2. And then you then have to draw 2x as much stuff. That's ok if its applied to backgrounds only, but IMO too expensive if it includes sprites. In this demo I just apply it to BG for simplicity and its 50hz anyway.

Generally it pays to keep the game at 50hz for the 2-field method though (or 12.5hz perhaps but thats already a low fps).

TheNameOfTheGame wrote:Does CFR require locked 50Hz operation or will it work for us NTSC blokes at 60hz? I do have to plead total ignorance on the CFR method so apologies for that :cheers:


It works at 50 or 60hz, and probably looks better at 60hz. Although it's always useful to have the spare CPU time per frame you gain from sticking with 50hz :)


Social Media

     

Return to “Coding”

Who is online

Users browsing this forum: No registered users and 2 guests