English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 31 July 2018, 17:17   #1
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 47
Posts: 2,627
wanting to port C games I wrote to Amiga classic with SDL

Hi,

I've tried that some years ago and it was slow as hell, but maybe things have improved and I can also make it so my coding is not as bruteforce as today.

I have ported/remade a fair amount of games for SDL on Windows, some even running on Nintendo DS.

Some include:

- Magic Pockets remake
- Bagman/Le Bagnard (arcade)
- O2EM (Videopac/Odyssey emulator) ported from O2EM using Allegro => SDL convert layer I've written
- A lot of Oric games (Zorgon/Xenon/Scuba dive/Golden Eagle/text/gfx adventure games...)

They all run very well on windows, but my attempt to make "Le bagnard" run on Amiga wasn't very successful. I mean, it ran, but slooooowly.


I think the culprit is SDL and the way it updates the screen: like emulators do: the whole thing, and probably on 8 bitplanes...

So I had some questions:


- where to find an up-to-date 68k version of SDL for classic amiga?
- is sound supported properly?
- is AmiDevCPP still the best cross dev system around?
- If I only update parts of the screen, is it possible for SDL NOT to redraw the whole screen? because I used that partial refresh method on Amoric (an emulator I had written moons ago) and that worked pretty well, but at the time I was "banging" in the bitplanes directly, not using SDL. It seems that SDL uses a flip/flop buffer technique, but maybe it's possible not to use it.


The idea is to port stuff that can be ported (no hopes for Magic pockets, but we already have it ), maybe without sound, maybe only text-based adventure games, with a good playability on some moderately powered amigas like 68030.
jotd is offline  
Old 31 July 2018, 18:10   #2
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Ft. Collins, CO USA
Age: 44
Posts: 1,117
Send a message via Yahoo to Samurai_Crow
http://aminet.net/package/dev/lib/SDL_AGA is good for an '040+FPU.
Samurai_Crow is offline  
Old 31 July 2018, 18:44   #3
dodke
Registered User

 
Join Date: Feb 2018
Location: London / UK
Posts: 31
I personally use vbcc + vasm for cross compiling on Mac.
http://sun.hasenbraten.de/vbcc/

GCC 6 might be faster but I haven't tried it yet myself:
http://eab.abime.net/showthread.php?t=85474

If you're porting a game that uses only 16 colours a 4 bitplane C2P routine and not using SDL would be much faster of course. Something like what's available in:
http://privat.bahnhof.se/wb800787/da...p/kalmsc2p.lha
dodke is offline  
Old 31 July 2018, 18:52   #4
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 45
Posts: 3,238
Write a wrapper around SDL to make the interface look more like how the Amiga would do things.
Adapt your games so they don't touch SDL directly but only thru your own functions.
Then rewrite your functions with normal Amiga code.
meynaf is offline  
Old 31 July 2018, 19:19   #5
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,146
Quote:
Originally Posted by meynaf View Post
Write a wrapper around SDL to make the interface look more like how the Amiga would do things.
Adapt your games so they don't touch SDL directly but only thru your own functions.
Then rewrite your functions with normal Amiga code.

+1 That's the only sane approach IMHO.
StingRay is offline  
Old 01 August 2018, 03:36   #6
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,502
Quote:
Originally Posted by jotd View Post
Hi,

I've tried that some years ago and it was slow as hell, but maybe things have improved and I can also make it so my coding is not as bruteforce as today.

I have ported/remade a fair amount of games for SDL on Windows, some even running on Nintendo DS.

Some include:

- Magic Pockets remake
- Bagman/Le Bagnard (arcade)
- O2EM (Videopac/Odyssey emulator) ported from O2EM using Allegro => SDL convert layer I've written
- A lot of Oric games (Zorgon/Xenon/Scuba dive/Golden Eagle/text/gfx adventure games...)

They all run very well on windows, but my attempt to make "Le bagnard" run on Amiga wasn't very successful. I mean, it ran, but slooooowly.


I think the culprit is SDL and the way it updates the screen: like emulators do: the whole thing, and probably on 8 bitplanes...

So I had some questions:


- where to find an up-to-date 68k version of SDL for classic amiga?
- is sound supported properly?
- is AmiDevCPP still the best cross dev system around?
- If I only update parts of the screen, is it possible for SDL NOT to redraw the whole screen? because I used that partial refresh method on Amoric (an emulator I had written moons ago) and that worked pretty well, but at the time I was "banging" in the bitplanes directly, not using SDL. It seems that SDL uses a flip/flop buffer technique, but maybe it's possible not to use it.


The idea is to port stuff that can be ported (no hopes for Magic pockets, but we already have it ), maybe without sound, maybe only text-based adventure games, with a good playability on some moderately powered amigas like 68030.
Hi,

Yep my SDL AGA lib (hack) can be used to port but as already mentioned it needs an 040 as a minimum (030's are too slow for doing SDL ports, even an overclocked 060 can struggle).

Sound is supported by my SDL hack and it also used to support partial screen updates but I can't remember if the version on AmiNet does or not.

I used AmiDevCPP for all of my ports but you might want to use GCC 6 as already suggested.

The best thing about using SDL is the time it take to get something up and running, it only took me 4 hours work to get Wolfenstein running on my A1200 using some SDL source code that I downloaded
NovaCoder is offline  
Old 01 August 2018, 11:24   #7
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 47
Posts: 2,627
Yes that is the spirit. Where can your hack be found?
jotd is offline  
Old 01 August 2018, 12:00   #8
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Ft. Collins, CO USA
Age: 44
Posts: 1,117
Send a message via Yahoo to Samurai_Crow
See post 2.
Samurai_Crow is offline  
Old 03 August 2018, 16:27   #9
lantus360
Registered User
 
Join Date: Feb 2013
Location: Olathe, Kansas
Posts: 197
in my experience - ive made SDL ports - your best option is to get the executable up and running with SDL as more of a proof of concept

then start replacing SDL with native Amiga calls. your code will almost always run faster
lantus360 is offline  
Old 03 August 2018, 17:09   #10
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 47
Posts: 2,627
thanks for all those excellent advices. The project(s) I want to port is a bit like an emulator, so the SDL calls are very localized. If I remove them & replace by native amiga stuff, all games are going to be available at the same time I hate to require a 68040+AHI just to run 8-bit games.

I've written Amoric (oric emulator) moons ago so I can reuse display & even probably sound stuff (okay it is asm code I'll convert it to C or I'll cross-compile it). I'll have to pick a compiler first. I'll check the "C compiler" thread, because my version of m68k gcc seems to require cygwin and I just hate that.

The main issue I see when NOT using SDL is the resources: for some projects I have .wav files (different sampling rates & mono/stereo) that I'll have to convert to AIFF.
And some other projects also use .png files, that I'd have to convert to "blittable objects". But if I can do that, I can bring a pixel-perfect "Le Bagnard / Bagman" arcade version to the amiga: [ Show youtube player ] (video contains arcade version + my remake running on the PC, I'm not the author of the video)

Are there some decent Windows music module editors or should I stick to OctaMED (that I used to know pretty well) ?

Last edited by jotd; 03 August 2018 at 17:21.
jotd is offline  
Old 03 August 2018, 17:35   #11
Cobe
Registered User

 
Join Date: Jan 2014
Location: Belgrade / Serbia
Age: 35
Posts: 600
Quote:
Originally Posted by jotd View Post
Are there some decent Windows music module editors or should I stick to OctaMED (that I used to know pretty well) ?
I prefer OctaMED but for years occasionally I fire up ModPlugTracker on windows and it does the job pretty well.
Cobe is offline  
Old 03 August 2018, 17:37   #12
Samurai_Crow
Total Chaos forever!

Samurai_Crow's Avatar
 
Join Date: Aug 2007
Location: Ft. Collins, CO USA
Age: 44
Posts: 1,117
Send a message via Yahoo to Samurai_Crow
Quote:
Originally Posted by Cobe View Post
I prefer OctaMED but for years occasionally I fire up ModPlugTracker on windows and it does the job pretty well.
MilkyTracker is cross-platform and also works quite well.
Samurai_Crow is offline  
Old 03 August 2018, 18:58   #13
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 45
Posts: 3,238
Quote:
Originally Posted by jotd View Post
I've written Amoric (oric emulator) moons ago so I can reuse display & even probably sound stuff (okay it is asm code I'll convert it to C or I'll cross-compile it). I'll have to pick a compiler first. I'll check the "C compiler" thread, because my version of m68k gcc seems to require cygwin and I just hate that.
Oddly enough, Amoric (under winuae) is the only oric emulator that accepted to run on my win 8.1 setup


Quote:
Originally Posted by jotd View Post
The main issue I see when NOT using SDL is the resources: for some projects I have .wav files (different sampling rates & mono/stereo) that I'll have to convert to AIFF.
This is easy, really. If you need help anyway, i can lend you my flac player which handles these too.


Quote:
Originally Posted by jotd View Post
And some other projects also use .png files, that I'd have to convert to "blittable objects". But if I can do that, I can bring a pixel-perfect "Le Bagnard / Bagman" arcade version to the amiga: [ Show youtube player ] (video contains arcade version + my remake running on the PC, I'm not the author of the video)
As long as these PNG are not 24-bit ones, it shouldn't be difficult either. You can f.e. use any PNG viewer and then grab the screen, to build ilbm images.
meynaf is offline  
Old 03 August 2018, 19:21   #14
kamelito
Zone Friend
kamelito's Avatar
 
Join Date: May 2006
Location: France
Posts: 924
Off topic : new Atari ST screen modes : http://www.atari-forum.com/viewtopic.php?t=34108
kamelito is offline  
Old 03 August 2018, 20:54   #15
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 47
Posts: 2,627
thanks for the replies. I know I can ask for code on this forum. @meynaf If your flac player can:

- can play .wav files
- one shot or looped

I'm definitely interested, as those are the only sound effects of my project. If you have another simple sound lib that is able to play a sample looped or one shot, I'm interested as well.

For PNG, I can cleanly convert it to IFF using imagemagic for instance. no need for screen capture

Are there other Oric emulators for Amiga?? Maybe MESS but it's probably slow as hell and has a bug in the 6522 chip that prevents tape loading (well, it was the case 10 years ago when I reported it and the coders didn't want to fix it)
jotd is offline  
Old 03 August 2018, 22:10   #16
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 45
Posts: 3,238
Quote:
Originally Posted by jotd View Post
@meynaf If your flac player can:

- can play .wav files
- one shot or looped

I'm definitely interested, as those are the only sound effects of my project. If you have another simple sound lib that is able to play a sample looped or one shot, I'm interested as well.
Yes it can play .wav files one-shot or looped (you can control the number of loops).
http://eab.abime.net/showthread.php?t=91092

I have my own tools to play sounds but it's part of a larger project - whole system abstraction (which is used in all my game ports).
meynaf is offline  
Old 04 August 2018, 00:03   #17
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 47
Posts: 2,627
looks good. Can you share the source for your tool?
jotd is offline  
Old 04 August 2018, 10:33   #18
meynaf
son of 68k
meynaf's Avatar
 
Join Date: Nov 2007
Location: Lyon / France
Age: 45
Posts: 3,238
Quote:
Originally Posted by jotd View Post
looks good. Can you share the source for your tool?
That's very possible but it's asm only and not exactly made to be open sourced... PM me if you want to see it.
At least you'll be able to understand my french comments
meynaf is offline  
Old 05 August 2018, 18:11   #19
jotd
Cat freak
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 47
Posts: 2,627
First attempt zoned some french adventure game I just could port using SDL. not exactly fast, because of SDL but using the GCC toolchain I could adapt it without too much effort (Amiga GCC 6 toolchain includes a working SDL version: really excellent, and doesn't require Cygwin, really excellent)

I'm using SDL in 8-bit mode, windowed (could be full screen, well, that's a test)

now I'm sure that I have to do better than that... get rid of SDL/enable partial updates.
jotd is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fake86 (68k SDL Port) - 8086 PC emulator NovaCoder project.Amiga Game Factory 5 08 November 2018 12:13
Site with many interesting 68k SDL games arti Amiga websites reviews 45 28 June 2017 01:26
Why Did Amiga Games have So Many ST Port Games? Amiga Forever Retrogaming General Discussion 9 11 November 2010 11:47
There is SDL (Simple DirectMedia Layer) support for Classic Amigas doble07 Coders. General 10 09 January 2009 00:35
Possibility to port an AMiga/PC classic to WindowsCE ? astuermer Retrogaming General Discussion 0 16 August 2006 18:36

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 16:09.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2018, vBulletin Solutions Inc.
Page generated in 0.13394 seconds with 15 queries