If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.

Chui's SDL will not work, as it is using function calls that have been deprecated (and removed) from KOS. That is to say, it is old and very out of date. Without a bunch of updates to the source code, it's not going to work.

There is a version of SDL included in kos-ports that is much more up-to-date.

However, it is worth noting that SDL on the Dreamcast is basically junk. It is slow, leaks memory, and just generally does not work the way that one might expect. I would not recommend using it for anything, unless you really just want a super-quick port of something that already uses SDL (as a stepping stone to porting it properly without SDL).

SDL 1.x is designed as a simple framebuffer blitting system, which does not mesh well with the Dreamcast's hardware. SDL 2.x basically requires video hardware functionality that is much newer than what the Dreamcast provides (really, it's not SDL itself, but rather the stuff using it), and thus would be a pain to use even if you did have a port of the library itself.

Are you just using SDL to create an OpenGL context, pretty much? In that case it shouldn't be a big deal to just remove it. The OpenGL context on KOS is already set up, check kos/examples/kgl.

Using SDL for input? Asking for gamepad state on KOS is very simple (no external libraries etc), check the kos/examples folder out and look at the main loops.

Do you write to the framebuffer directly and just use SDL to flip the framebuffer? While writing to the framebuffer directly is too slow, as BlueCrab mentioned, I was able to make it fast enough for simple stuff by having a framebuffer double buffer in memory (u16 framebuffers[2][640*480]), writing to one of those, doing an asynchronous DMA copy to the screen, while writing to the other buffer. The better solution is to use the PVR chip, however.

SDL 1.x does not have any built-in networking. The SDL_net library (an extra library you'd need), is just a very thin wrapper around standard BSD sockets, which KOS supports.

Sound-wise, the base SDL sound system is very similar to what KOS has already between the snd_sfx and snd_stream stuff, albeit a lot more limited than what KOS allows you to do. There's also SDL_mixer (another external library), but that basically just adds support for playing MP3s and other such files, which KOS already provides libraries for anyway.

Wow, I didn't know SDL for DC was so bad =/ I thought it was good after seeing a Zelda game written on it!

My game is a very simple 2d platform. I had written it in BennuGD for Dreamcast before. However when I started to add things on it the performance started to be really bad... Then I wrote everything again in SDL for PC and I thought it would run well on DC haha big mistake, but at least I learned something new.

What you guys recommend then? Thank you for all the attention guys and I'm sorry for all the questions. I'm very newbie on the Dreamcast. But I wish to get my game running on it.

NeoSnk wrote:What you guys recommend then? Thank you for all the attention guys and I'm sorry for all the questions. I'm very newbie on the Dreamcast. But I wish to get my game running on it.

If you're using SDL, you must be at least somewhat comfortable with C or C++, right?

To be honest for 2D stuff, you'd probably be best off either using libparallax (or libtsunami if you want C++ classes for things) or just going at the PVR directly, depending on what you're doing. libparallax is just a very thin wrapper around the PVR functionality (and libtsunami is a relatively thin wrapper around libparallax). I know that libparallax was pretty easy for me to pick up back when I was a relative beginner at Dreamcast stuff.

Also, for reference, libtsunami is what was used to write the game Feet of Fury for the Dreamcast (a commercially sold homebrew DDR-like game).

NeoSnk wrote:What you guys recommend then? Thank you for all the attention guys and I'm sorry for all the questions. I'm very newbie on the Dreamcast. But I wish to get my game running on it.

If you're using SDL, you must be at least somewhat comfortable with C or C++, right?

To be honest for 2D stuff, you'd probably be best off either using libparallax (or libtsunami if you want C++ classes for things) or just going at the PVR directly, depending on what you're doing. libparallax is just a very thin wrapper around the PVR functionality (and libtsunami is a relatively thin wrapper around libparallax). I know that libparallax was pretty easy for me to pick up back when I was a relative beginner at Dreamcast stuff.

Also, for reference, libtsunami is what was used to write the game Feet of Fury for the Dreamcast (a commercially sold homebrew DDR-like game).

Yes, I feel more comfortable using C and C++ . I'll have a look on libparallax and libtsunami, tks for the tips man. I'll post here the results hehe!

I haven't used libtsunami myself but this tutorial should be helpful if you find it lacking and want to use the pvr directly http://dcemulation.org/?title=PVR_Spritesheets
Some other people on the forum successfully wrote a 2d renderer that way.

As BlueCrab mentioned, SDL2 works much differently from SDL1.x, but if you're familiar with using it, working in PVR is not all that different than working with hardware textures in SDL2 conceptually. Mechanically, very different. But if you can wrap your mind around SDL2, working with PVR isn't that hard.

Is there any example other than what it's included in the Kos examples for libtsunami? What happened to libtiki? I want to start a 2D renderer. I've used SDL for a lot of ports and it does the job, but not if you want to squeeze the system. The good thing about it is the multi platform without too many headaches.

BlueCrab wrote:I don't have any other examples for libtsunami other than what's included with KOS. Of course, the Feet of Fury source code might provide some insights, since that's where libtsunami was derived from.

As for libtiki, that's pretty much dead since nobody has been maintaining it for a while. The source code to it is still available in the SVN repo, if you're interested in it.