8-way scrolling system for prototyping games on STE

GFA, ASM, STOS, ...

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

User avatar
Estrayk
Captain Atari
Captain Atari
Posts: 258
Joined: Mon Nov 23, 2015 2:52 pm
Location: Spain

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

Postby Estrayk » Sat May 07, 2016 10:59 pm

Hello dml. I tested in Mega STe in 16Mhz mode and works perfectly too.
Just some weird graphics bugs in the top of the screen, check the video:

https://www.youtube.com/watch?v=YnWvhIxMikM
・Falcon ct60e・Atari MegaSTE ・Atari STe ・MIST ・

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 » Sun May 08, 2016 9:03 am

Hi,

The main parts should work fine since its mostly not time-critical code. However it will fail to open the upper/lower borders so you'll get 40 scanlines missing from the image and some flicker or corruption at the border.

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 » Sun May 08, 2016 9:29 am

yeah i had to flip into 8mhz on my Mega STe (subscribed to your YT channel also - nice works) :D
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 » Sun May 08, 2016 4:39 pm

I have linked the example code for the current 'demo', after tidying it up a bit and refreshing the comments.

The startup code and mainloop are in the top half of the file. The 'game' stuff is in the bottom half. I probably spent most of the comments on the game half as the rest is still a bit opaque until I tidy up various interfaces.

It should be fairly clear though from the .cpp that you don't need a lot of code to make some interesting things happen. It would perform much better as 68k but you could still do quite a lot with what's here.

The demo itself does not do anything very complex but it's already possible to create useful AI state machines and interactions, such as invisible trigger pads which cause sleeping AIs to wake up while deleting themselves, or use invisible AIs as spawn sources for others, and so on...


Still, some important things are missing. Memory management is inadequate and some details are missing which allow more complex stuff to be done with AIs. But I'll leave it here for now and look at some other things including performance.
You do not have the required permissions to view the files attached to this post.

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 » Sun May 08, 2016 7:10 pm

Thank you DML :)

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 10, 2016 9:05 am

MM41 wrote:Thank you DML :)


You're welcome :)

Next weekend I'll probably have a go at a new sprite method and clearing method, which I expect should allow more sprites. I'll probably also add a few extra 'game' features like pickups and more enemy types to make the sample a bit more fun.

Haven't made much progress on the rest of the 'engine' source but once the sprite improvements are in I'll do more on that side, and then hopefully put all the source up at once.

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 » Tue May 10, 2016 2:01 pm

Perhaps a question thats already answered, but does the frameowrk also allow for larger scroll sizes (multiple pixels in one go)?

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 10, 2016 2:44 pm

Hi wietze!

Yes the main parts can handle any increment up to and beyond the size of the screen - although the cost goes up quite fast if you try to do that :)

IIRC the lower level drawing bit is still limited to 1 tile row/column on STF, or multiple rows/columns on STE - but only because I was lazy to do the extra changes involved.

However with more buffers (e.g. for double-buffering on STE, or syncshift on STF) the true 'step' rate can be 2x or 4x the pixel scroll rate as each playfield buffer is only updated every N refreshes, so that fact further reduces the max scroll rate currently on STF, to 4 pixels max rate. By catching the STF drawing code up to the STE version it should handle higher rates - at higher cost.

Also - while I haven't done it yet, half-pix scroll can be done at <70% the cost of 1-pix scroll by taking advantage of this 'step' issue, and rendering appropriate fractions of each tile each half-update (each display cycle). Currently it renders 2 scans per tile, every 2nd frame, for a 1-pixel double buffered scroll. Subpixel can be done using 1 scan per tile, every 2nd frame. The cost is flat, spread across every frame.

So some game designs can gain a little from 25hz background scroll with 50hz sprites on top (a few arcade games did have artificially slow BGs for the sake of gameplay).

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 13, 2016 4:01 pm

Been quite busy recently but did get some new sprites chopped the other evening and last night added some extras to the 'game' code to make use of those, in a bid to improve the demo. I have put a zip here but no time just now to test stuff so hopefully it's correct.

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

Try to get the pickups BEFORE the direction changes. Otherwise it gets hard :)

The system hasn't changed at all - its just new AIs. Waves of entities are now spawned using 'wavespawn' objects which are themselves a kind of temporary invisible entity... etc. etc.

User avatar
I_am_I
Atariator
Atariator
Posts: 17
Joined: Wed Nov 19, 2008 5:49 pm

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

Postby I_am_I » Fri May 13, 2016 4:38 pm

works great. so cool!

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 13, 2016 5:07 pm

Wow! Jaw dropping progress Mr dml. I'm truly impressed mate!!!
Steve

User avatar
bear
Atari freak
Atari freak
Posts: 53
Joined: Fri Jul 02, 2004 4:44 pm

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

Postby bear » Sat May 14, 2016 2:30 pm

Sooo good! Enjoying every update!

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 16, 2016 9:44 am

AGTCut v0.24 is on the d/l area with changes collected over the last couple of weekends:

https://bitbucket.org/d_m_l/agtools/dow ... t_v024.zip

Added support for sprite frame mapping (cut additional flips/rotates of source frames).
Added support for dual-field backgrounds.
Improved preview mode.

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 16, 2016 9:17 pm

Added a few more sample AI's tonight, including some 360' rotating/steering types and some which shoot at the player.

Not really worth uploading anything though because it only runs one enemy type at a time. I'll need to add some scheduling to make different kinds of objects appear at specific times.

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 17, 2016 11:09 am

such a tease!! :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 » Wed May 18, 2016 9:26 am

Last evening got the new sprite clearing method almost working. A bit left to do but it looks close. This will be faster when using larger sprites or just covering more screen area with sprites. I'll make both clearing methods available in case one or other works out better in different scenarios.

I had looked briefly at a third clearing method, mainly for accelerating really huge sprites. It is very complex though, so I probably won't bother just now, especially since 'huge sprites' are more likely a 25hz thing and the first demo will probably remain as 50hz. Maybe another time.

Also figured out (but have not yet coded) a method of performing pixel-level collision detection with small or large objects without using any pixel or mask data at runtime. Based on some back-of-envelope work, It should be quicker than using masks for all but the smallest objects. I probably will need to code this for any kind of 'boss' entity.

I added a new vis-trigger entity property which can exist in the map from startup time but won't be ticked until it enters the viewport. This can be used to represent enemy spawnpoint markers in some sort of editor or script later on. The presence of these entities doesn't add overhead to the normal game event processing.

This sort of thing can be easily hardcoded for fixed-rate scrolly games but in designs where the player can navigate to different corners of the map at will, there is less differentiation between entities in view and those which continue to exist when they move offscreen. It's better not to assume the edges of the screen are the end of the world, but still quite useful to receive signals when (e.g.) new things become visible.

Will try to complete the sprite clearing stuff this evening, if possible and do some tests with that. Unlikely I'll find time to optimize it immediately but a lot of code has now collected and many areas could do with proper optimization once all the pieces settle down...

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 18, 2016 12:42 pm

Spent a few minutes raster-profiling the 'engine' over lunch to see what sort of damage has resulted from recent entity & collision coding, most of which has been performance-blind (with the exception of the sprite clearing bit which is a kind of performance work).

The result seems not bad at all. In fact, the only thing that shows up any significant cost is sprite clearing and drawing. I did expect that my C engine code would be sucking up too much time but the techniques I selected are clearly paying off and making up for the drag. The cost for the game layer is hardly registering at all, even with lots of bullets flying around.

Couple of screenshots below. The big green region is sprite clearing. The orangey colour is sprite drawing. The rest is not really worth a mention.

perf1.png

perf2.png

perf3.png

perf4.png


The lasers are expensive compared to the rest but mainly because I used a very easy/obvious way to do it (chains of concatenated entities - not cheap). This is due to be replaced with something more specific - OTOH I don't want to spend too much time on specific things right now for a general purpose engine. Any improvements to that will just be to keep the demo itself inside 50fps.

I think the results do help show that while saving cycles matters, using methods at the top level which reduce the need to save cycles is at least as important, and can be taken quite far without hardcoding for any particular type of game. Although hardcoding sure helps once you know exactly what you want to do....

Anyway I can spend some time optimizing the clearing properly and add some custom sprite paths it should allow quite a lot of action with smallish sprites inside 50hz, and decent sized sprites at 25hz. That probably won't happen very quickly but I'll pick away at it gradually over the next few weekends.
You do not have the required permissions to view the files attached to this post.

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 » Wed May 18, 2016 3:58 pm

NIce! Thanks for sharing the progress. :cheers:

Is it possible to leave the raster profiling in the engine so that it can be toggled on and off for testing or debugging?

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 18, 2016 4:02 pm

Hi,

Rasters are not not on a toggle at the moment - I have to rebuild the program. But I can add an extra .prg to the archive tonight which should do for now? I could add a toggle for this later - probably makes sense for example projects.

I'll upload a new demo this evening after work with some of the other enemies enabled!

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 18, 2016 4:43 pm

Ok here we go...

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

A few notes:

- There are 3 executables. One is dithered (single field), another is colour-boosted (dual/complementary fields), the third is like the first, with timing rasters on. They all have roughly the same CPU performance. The dual-field version simulates extra colours but flakes out badly if it trips over 50hz - which can happen with the crappy laser implementation I have just now. Reason: it costs more CPU to implement dual-field as 25hz-friendly.

- The 'gameplay' is not 'balanced'. The AIs are deliberately evil :twisted: It's still mainly a technical experiment to see if typical shooter AIs with fast-moving objects were expensive to do in C on an ST, to get a feel for things. The entity limit is currently fixed at 64, including bullets, some of which is padding for deferred inserts/removes.

- If you do try to get to the end of the scroll you'll probably think up a few inventive new swearwords for some sprites. :evil: but far from the difficulty of the actual Gradius series - varying degrees of ridiculous!

- Nothing much interesting happens if you reach the end of the level. It doesn't work well in reverse for most of the new entities. At some point I will remove the reverse-scroll and just put a 'boss' in. This does require some new tech though...

- The executable has grown suddenly. I haven't had time to look properly yet but I think some of that is the sprite-clearing stack which I set really big when I was debugging issues with that. It zips to 30k so most likely it is dead-space.

- I still really want to swap the background but can't find ANY complete rips of the background sets for the Gradius series - preferably one of the later ones, for the sake of extra detail & colours. Looks like I'll have some evenings ahead sitting with MAME in the tilemap viewer :( The BG doesn't exactly need to be Gradius but it would be a far better match for the current sprites.

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 19, 2016 2:08 pm

Improved version has a finished sprite clearing system (definitely faster), a few more entities enabled and toned down the difficulty a bit. There are still quite a few entities which are not enabled yet but I don't have time to play with code until later tonight or maybe the weekend. Might do more then.

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

Most of the time now is in the sprite drawing so I'll revisit that side of things soon (The sprite count keeps going up with each version so it drops over 50hz more often than earlier builds)

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 19, 2016 5:13 pm

More enemies enabled, including some bigger sprites, more stuff happening. Difficulty of existing enemies toned down yet again, since it gets quite busy in places.

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

enemies.png


It's becoming easier and quicker to add new objects. Down to a few minutes each, minus the spritecutting setup. Adjusting difficulty is a bit more effort though - doing that properly is probably beyond the scope of this example.

There's probably not much point in adding a lot more to this. Will do a bit of work on sprite performance next.
You do not have the required permissions to view the files attached to this post.

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 20, 2016 9:45 am

Just added demo1.txt readme to the .zip, as a reminder for keyboard controls!

W,S,A,D + RSHIFT

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 20, 2016 2:50 pm

latest version rocks so bad!!! :cheers:

User avatar
Mindthreat
Captain Atari
Captain Atari
Posts: 213
Joined: Tue Dec 16, 2014 4:39 am
Contact:

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

Postby Mindthreat » Fri May 20, 2016 3:29 pm

This is looking delicious! Phenomenomenomenal work DML! =D
"My attempt at trying to create cool things for the Atari Jaguar:" - http://www.RISCGames.com


Social Media

     

Return to “Coding”

Who is online

Users browsing this forum: No registered users and 10 guests