Overview Features Instructions Performance Forum Downloads Products OrderV4 Reseller Contact

Welcome to the Apollo Forum

This forum is for people interested in the APOLLO CPU.
Please read the forum usage manual.



All TopicsNewsPerformanceGamesDemosApolloVampireAROSWorkbenchATARIReleases
Running Games and Apps.

[Development] Current Status of SDLpage  1 2 

Olle Haerstedt

Posts 102
04 Apr 2020 13:27


SDL is a fine choice if you want your game to be compatible between many different platforms. I believe Diablo 68k uses SDL, correct? Is there a current "status report" of SDL on Amiga, like which lib to use, optimizations possible or planned, and such? Grateful for any feedback. ^^
 
  Aminet lib is from 2003: EXTERNAL LINK   
  Now idea if this fork works: EXTERNAL LINK   
  Another port of SDL: EXTERNAL LINK 
  SDL for AGA: EXTERNAL LINK


Gunnar von Boehn
(Apollo Team Member)
Posts 4795
04 Apr 2020 15:24


Olle Haerstedt wrote:

SDL is a fine choice if you want your game to be compatible between many different platforms. I believe Diablo 68k uses SDL, correct?

Diablo did use SDL and this make it slow.
Therefore the porting team removed SDL.



Olle Haerstedt

Posts 102
04 Apr 2020 16:52


Gunnar von Boehn wrote:

   
Olle Haerstedt wrote:

      SDL is a fine choice if you want your game to be compatible between many different platforms. I believe Diablo 68k uses SDL, correct?
     

     
      Diablo did use SDL and this make it slow.
      Therefore the porting team removed SDL.
     
   

   
    Aha. Is there a way to get information from the Diablo team about how they worked?
 
  Edit, there's a commit here which checks for Vampire SAGA? https://github.com/diasurgical/devilutionX/pull/397/files/5528cccaa604c285cb798e700d92d9618db6614c#diff-2a0614b1fe1cec8f5fb37ca8fd7715b7R29

Edit 2, emailed anjaro from github.


Gunnar von Boehn
(Apollo Team Member)
Posts 4795
04 Apr 2020 18:02


In the recent times a few games were developed for AMIGA.

RESHOOT

TINY LITTLE SLUG

METRO SOMETHING

Strangely these games not use SDL.
How about you ask the developers what tools and which languages they used?


Olle Haerstedt

Posts 102
04 Apr 2020 18:05


Gunnar von Boehn wrote:

In the recent times a few games were developed for AMIGA.
 
  RESHOOT
 
  TINY LITTLE SLUG
 
  METRO SOMETHING
 
 
  Strangely these games not use SDL.
  How about you ask the developers what tools and which languages they used?

Yep, on it.


Ronnie Beck
(Apollo Team Member)
Posts 178
04 Apr 2020 20:14


There is a good reason to use SDL on the Vampire: RTG Graphics

The Amiga chipset will not help you here.  You will need to do most, if not all, drawing operations in software.  You can use the Amiga OS API for doing simple primitives such as drawing lines, circles and blitting images etc onto the screen.  But this will be done with software.

The SDL port from Henryk Richter which you linked to has one key advantage:  AMMX acceleration.  A few crucial operations are implemented with AMMX.  You can see the implementation here:

EXTERNAL LINK 
It isn't really correct to say SDL is slow because in the end you will implement your own drawing routines anyhow.  SDL or not.  Those routines will write into a frame buffer.  Whether you use cybergraphix to create your screen and give you your frame buffer or SDL makes almost no difference.  It is the same RAM you write to.  Hence the same speed.

The port of SDL mentioned above anyway wraps around Cybergraphix.  If you are experienced you could of course do this yourself and not bother with SDL.  But if you are learning and you are interested specifically in RTG graphics, Henryk's SDL port isn't a bad starting point.

For audio, joystick/mouse and other non-graphics related functions, you can use the normal Amiga OS or write/read to the hardware.  SDL also has some nice functions for that but it will not be any real advantage.  Maybe easier to code.  But not much else.

The games Gunnar mentioned don't use SDL because there is no point in those cases.  The use the Amiga's native gfx.  SDL cannot fully utilise the unique capabilities of the Amiga chipset.  So by using SDL for amiga gfx, you as the programmer will not be able to take advantage of all those capabilities. A skilled programmer can though, and SDL will just be in their way.


Gunnar von Boehn
(Apollo Team Member)
Posts 4795
04 Apr 2020 20:45


I think as developer you can make an game compatible with

1) OCS / AGA / SAGA then you can cover classic Amiga users like A500/A1200/Vampire then SDL is not possible to use!

or
2)  aim for chunky stuff like SDL
and be compatible to Vampire / PC/ MAC...
but then the game will likely not run on A500/A1200.




Olle Haerstedt

Posts 102
04 Apr 2020 23:10


Gunnar von Boehn wrote:

      I think as developer you can make an game compatible with
     
      1) OCS / AGA / SAGA then you can cover classic Amiga users like A500/A1200/Vampire then SDL is not possible to use!
     
      or
      2)  aim for chunky stuff like SDL
      and be compatible to Vampire / PC/ MAC...
      but then the game will likely not run on A500/A1200.
     

     
      There's one at least theoretical solution to this conflict: Rape the SDL API with a custom native graphic lib.
   
    For example:
     
      1) Port Blitz graphical ACID libs to C (written in ASM, callable from C, I mean)
      2) Make the API to those libs exactly the same as to SDL
      3) Make the game
      4) You can now compile it with both native libs and SDL, whichever one you link
     
      The problem of course being how to do hardware sprites etc using SDL-only functions. That's when the raping part comes. So, for example, the function `SDL_RenderCopy` would map to a hardware sprite rendering routine or the blitter, `SDL_CreateWindow` would create an Amiga OCS screen or viewport, etc. Yes, I said "theoretical solution". :) One would have to investigate if this would be madness (#ifdef __AMIGA__ everywhere) or kind of cool (#ifdef __AMIGA__ in only some places)
     
      This method would make it possible to port a game FROM Amiga to another platform, but obviously not the other way around.


Olle Haerstedt

Posts 102
05 Apr 2020 00:16


Funny how the Amiga port of Diablo is that exact "#ifdef __AMIGA__" I wanted to avoid... EXTERNAL LINK (github render.cpp source)
 


Samuel Crow

Posts 387
05 Apr 2020 04:43


Olle Haerstedt wrote:

      There's one at least theoretical solution to this conflict: Rape the SDL API with a custom native graphic lib.
     
      For example:
     
      1) Port Blitz graphical ACID libs to C (written in ASM, callable from C, I mean)
      2) Make the API to those libs exactly the same as to SDL
      3) Make the game
      4) You can now compile it with both native libs and SDL, whichever one you link
     
      The problem of course being how to do hardware sprites etc using SDL-only functions. That's when the raping part comes. So, for example, the function `SDL_RenderCopy` would map to a hardware sprite rendering routine or the blitter, `SDL_CreateWindow` would create an Amiga OCS screen or viewport, etc. Yes, I said "theoretical solution". :) One would have to investigate if this would be madness (#ifdef __AMIGA__ everywhere) or kind of cool (#ifdef __AMIGA__ in only some places)
     
      This method would make it possible to port a game FROM Amiga to another platform, but obviously not the other way around.

It's been done.  It requires AGA and is closed source.  It only runs in 256 colors and the development headers are lost.  I'm talking about an SDL replacement.  Since most SDL games require high color or true color depths, a Vampire or graphics card is a basic minimum.  No sprites, playfields or copper lists supported by SDL.


Olle Haerstedt

Posts 102
05 Apr 2020 06:47


Samuel Crow wrote:

  It's been done.  It requires AGA and is closed source.  It only runs in 256 colors and the development headers are lost.  I'm talking about an SDL replacement.  Since most SDL games require high color or true color depths, a Vampire or graphics card is a basic minimum.  No sprites, playfields or copper lists supported by SDL.

You mean this on Aminet? EXTERNAL LINK 
What does that mean, development headers are lost?


Olle Haerstedt

Posts 102
05 Apr 2020 11:09


In any case, the lib by NovaCoder is not *exactly* what I meant. He/she made it to make it faster to port things TO Amiga - I want a lib to make it possible to port new games FROM Amiga. With this premise, you can hack the SDL API a lot harder.


Samuel Crow

Posts 387
05 Apr 2020 20:54


Olle Haerstedt wrote:

Samuel Crow wrote:

  It's been done.  It requires AGA and is closed source.  It only runs in 256 colors and the development headers are lost.  I'm talking about an SDL replacement.  Since most SDL games require high color or true color depths, a Vampire or graphics card is a basic minimum.  No sprites, playfields or copper lists supported by SDL.
 

 
  You mean this on Aminet? EXTERNAL LINK 
  What does that mean, development headers are lost?

No.  There used to be a shared library by somebody who eventually left the Amiga scene that was called something like turbosdl.library but only the author could use it because the .h, .i and .fd files were all kept by the author and never distributed.  There was only a few games that used it as a result.


Samuel Crow

Posts 387
05 Apr 2020 21:00


Olle Haerstedt wrote:
In any case, the lib by NovaCoder is not *exactly* what I meant. He/she made it to make it faster to port things TO Amiga - I want a lib to make it possible to port new games FROM Amiga. With this premise, you can hack the SDL API a lot harder.

I don't consider that to be "hacking" SDL, I consider that writing an Amiga Chipset Compatibility layer using SDL as a backend.  The PC-style workarounds could be implemented in SDL while the Amiga stuff bangs the hardware mercilessly for higher performance.

That said, RetroMode.library for AmigaOS 4.1 (linked above) could be used for the PC wrapper or some extension thereof.  The Amiga version should be written with lots of Assembly code, since the other versions of the library are just brute force wrappers there shouldn't be anything other than an Amiga that runs the native assembly version.


Olle Haerstedt

Posts 102
05 Apr 2020 22:11


Yes, SDL would be the fallback ifndef __AMIGA__.
 
  Here's one idea how to do it with macros:
 
#ifdef __AMIGA__                                                                                                                                                                                                 
#define SPRITE SimpleSprite                                                                                                                                                                                       
#else                                                                                                                                                                                                             
#define SPRITE SDL_Surface                                                                                                                                                                                       
#endif                                                                                                                                                                                                           
/** Similar logic with rcSprite */                                                                                                                                                                               
#ifdef __AMIGA__                                                                                                                                                                                                 
#define MOVE_SPRITE(sprite, rcSprite) MoveSprite(NULL, sprite, rcSprite.x, rcSprite.y)                                                                                                                           
#else                                                                                                                                                                                                             
/** Assumes screen is defined */                                                                                                                                                                                 
#define MOVE_SPRITE(sprite, rcSprite) SDL_BlitSurface(sprite, NULL, screen, rcSprite)                                                                                                                             
#endif   


Olle Haerstedt

Posts 102
05 Apr 2020 22:12


Pretty hopeless to format, but you get the point.


Olle Haerstedt

Posts 102
05 Apr 2020 22:13


Samuel Crow wrote:

Olle Haerstedt wrote:

 
Samuel Crow wrote:

    It's been done.  It requires AGA and is closed source.  It only runs in 256 colors and the development headers are lost.  I'm talking about an SDL replacement.  Since most SDL games require high color or true color depths, a Vampire or graphics card is a basic minimum.  No sprites, playfields or copper lists supported by SDL.
 

 
  You mean this on Aminet? EXTERNAL LINK   
  What does that mean, development headers are lost?
 

  No.  There used to be a shared library by somebody who eventually left the Amiga scene that was called something like turbosdl.library but only the author could use it because the .h, .i and .fd files were all kept by the author and never distributed.  There was only a few games that used it as a result.

Oh, OK. Shame.


Olle Haerstedt

Posts 102
05 Apr 2020 22:16


I have no idea how to setup sprite reuse with a macro compatibility layer as above.


Samuel Crow

Posts 387
05 Apr 2020 22:19


This discussion continues at EAB at the following link:
EXTERNAL LINK


Olle Haerstedt

Posts 102
05 Apr 2020 22:27


Samuel Crow wrote:

This discussion continues at EAB at the following link:
  EXTERNAL LINK 

Yes, thank you. I'm a bit confused by all channels. :d

posts 21page  1 2