Dreamcast Programming (Where To Start)

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.
speewave
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 18
Joined: Sun Feb 28, 2010 9:29 pm
Has liked: 0
Been liked: 0

Dreamcast Programming (Where To Start)

Post by speewave » Tue Mar 02, 2010 4:10 pm

I Really would like some good tutorials on using the native DC Libraries in KOS.. (PVR\Input\Video\VMU\CD\ and whatever..)... something for a newbie to DC Programming... something that breaks it down for you
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5387
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 1 time
Been liked: 12 times
Contact:

Re: Dreamcast Programming (Where To Start)

Post by BlueCrab » Tue Mar 02, 2010 7:22 pm

Your best bet would be to look at the examples included with KOS. They cover most of the topics that you could ever want to do, and they're usually either small and simple to understand, or well commented (or they aren't meant to be examples, but rather testcases -- but even those make good examples of how to do some interesting things).

There's really never been any real "tutorials" simply because there generally isn't any need for them. If you understand C well enough to make your way around programming in general, you should be able to figure out KOS pretty easily (since the whole thing is relatively small, and of course, open-source).

That being said, if you don't already know C, you definitely want to learn at least the basics of it first. I'd recommend being comfortable with all manner of things in C (File I/O, Structures, Arrays, Pointers, String Manipulation, math, etc) before even attempting to work with KOS. It will help in the long run, and all the basic stuff in C will work just fine with KOS.
speewave
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 18
Joined: Sun Feb 28, 2010 9:29 pm
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by speewave » Tue Mar 02, 2010 8:12 pm

Ok i'll look around there than... just wondering if there were any tutorials...
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7486
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has liked: 0
Been liked: 3 times
Contact:

Re: Dreamcast Programming (Where To Start)

Post by Quzar » Wed Mar 03, 2010 12:12 am

You might want to look for any PC software you're familiar with that has been ported to the DC and look at the differences. There's also an example that I wrote called 'Minivader' in which I converted a very small MAME driver into a standalone emulator. I tried to document it very well to demonstrate each of the components (video, controller, file IO, etc).
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
sahiphop
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 17
Joined: Sat Feb 27, 2010 12:02 am
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by sahiphop » Tue Mar 09, 2010 1:27 pm

I thought the title on this thread was rather interseting because I'm in the same boat. Although problem with me is, I'm just now learning C++. I actually like it. I think I'll understand the basics of it pretty soon. There's no rush, so I'm taking my time to learn it, but I'm taking several lessons on at once. So far so good....

Okay, so my understanding is it all starts with understanding the language itself of C++.

Once I understand C++, what would be the next step?? I'm getting to understand all this, but here's a couple questions:

1) What are compilers? What are they used for?
2) What are libraries? What are they used for?
3) How are engines different from libraries? Can I use the Torque, Source or Unreal engine to program Dreamcast games?
4) What programs will I need specifically in order to have my workstation ready to start programming Dreamcast games? I already have Dev C++ for the programming language, but what other programs are necessary? Is there an all-in-one program?

I know this sounds humiliating in the n00bish sense, and from the looks of it, I'm over my head. That's fine, we all start off utterly ignorant so I'm trying to figure things out. I kinda have an idea what these three questions are about but I would like for someone with experience to give me a definitive answer so I can know without any doubts what these things are.

I suppose if I have any other questions, they will go off from any answers received. Thanks so much for taking the time out to help!
Inspired by the GREATEST gaming console of all-time!
User avatar
emptythought
DC Developer
DC Developer
Posts: 2015
Joined: Wed Jan 30, 2002 9:14 am
Location: UNITED STATES NRN
Has liked: 0
Been liked: 0
Contact:

Re: Dreamcast Programming (Where To Start)

Post by emptythought » Tue Mar 09, 2010 2:01 pm

Just buy a book; Practical C Programming by O'Reilly.
sahiphop
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 17
Joined: Sat Feb 27, 2010 12:02 am
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by sahiphop » Tue Mar 09, 2010 8:08 pm

emptythought wrote:Just buy a book; Practical C Programming by O'Reilly.
Kinda on that path already, but I was hoping to get some help to get me started off while I wait on obtaining those resources. Hense my questions. I'll try not to ask a question for every little thing, but I've looked around and haven't found answers yet. Maybe I'm just not looking in the right direction?
Inspired by the GREATEST gaming console of all-time!
OneThirty8
Damn Dirty Ape
Damn Dirty Ape
Posts: 5031
Joined: Thu Nov 07, 2002 11:11 pm
Location: Saugerties, NY
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by OneThirty8 » Tue Mar 09, 2010 8:52 pm

sahiphop wrote: 1) What are compilers? What are they used for?
2) What are libraries? What are they used for?
3) How are engines different from libraries? Can I use the Torque, Source or Unreal engine to program Dreamcast games?
4) What programs will I need specifically in order to have my workstation ready to start programming Dreamcast games? I already have Dev C++ for the programming language, but what other programs are necessary? Is there an all-in-one program[
1) In a general sense, you have a compiler, assembler, and linker that will be run in sequence to turn your source code (in our case, C or C++) into an executable file (there are a few steps in between--each C file is compiled into assembler code, then turned into object files, and then the object files are linked together to make your executable). Dev-C++ is an IDE (Integrated Development Environment) that provides you with a nice code editor that organizes your source files, and a frontend to the compiler, assembler, and linker.
2) A library is basically reusable code that performs certain functions so that you don't have to reinvent the wheel each time you write a program. For example, KOS (the main library we use) contains code to read the ISO9660 filesystem on the CD, talk to the sound hardware, the video hardware, etc. Another library that you might find useful is libtremor. This is an ogg vorbis audio playing library that gives you a simple-to-use method of adding background music to your game or menu system on the Dreamcast.
3) An engine might be available as a library, but basically a game engine is the core of game. I'm at a loss when it comes to adequately describing it, but if you look at my Dreamcast port of Yeti3d, you will find a bunch of code that will let you build a 3D game and a bunch of demos (some run on the Dreamcast, some on a PC, and all are fairly similar) for using the code, but it's not a game. The enemies are really stupid in the demo, there's only one level, there's no sound, and there's no way programmed in there to win the game. But it will render a 3D world and let you walk around in it.
4) If you're a Windows user, which you must be if you're using Dev-C++, check out fackue's DCDev ISO. It includes everything you will need--Code editors, a compiler toolchain for building Dreamcast programs, KallistiOS and a bunch of add-on libraries for it, and I believe it includes Dreamcast emulators for testing your code on the PC (but don't quote me on that last bit, and keep in mind that an emulator isn't a substitute for the real hardware).

I hope that's at least a little bit helpful, and I'm sure somebody more knowledgeable will point out any mistakes I've made or clear up what I haven't explained well.
sahiphop
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 17
Joined: Sat Feb 27, 2010 12:02 am
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by sahiphop » Tue Mar 09, 2010 11:26 pm

OneThirty8 wrote:
sahiphop wrote: 1) What are compilers? What are they used for?
2) What are libraries? What are they used for?
3) How are engines different from libraries? Can I use the Torque, Source or Unreal engine to program Dreamcast games?
4) What programs will I need specifically in order to have my workstation ready to start programming Dreamcast games? I already have Dev C++ for the programming language, but what other programs are necessary? Is there an all-in-one program[
1) In a general sense, you have a compiler, assembler, and linker that will be run in sequence to turn your source code (in our case, C or C++) into an executable file (there are a few steps in between--each C file is compiled into assembler code, then turned into object files, and then the object files are linked together to make your executable). Dev-C++ is an IDE (Integrated Development Environment) that provides you with a nice code editor that organizes your source files, and a frontend to the compiler, assembler, and linker.
2) A library is basically reusable code that performs certain functions so that you don't have to reinvent the wheel each time you write a program. For example, KOS (the main library we use) contains code to read the ISO9660 filesystem on the CD, talk to the sound hardware, the video hardware, etc. Another library that you might find useful is libtremor. This is an ogg vorbis audio playing library that gives you a simple-to-use method of adding background music to your game or menu system on the Dreamcast.
3) An engine might be available as a library, but basically a game engine is the core of game. I'm at a loss when it comes to adequately describing it, but if you look at my Dreamcast port of Yeti3d, you will find a bunch of code that will let you build a 3D game and a bunch of demos (some run on the Dreamcast, some on a PC, and all are fairly similar) for using the code, but it's not a game. The enemies are really stupid in the demo, there's only one level, there's no sound, and there's no way programmed in there to win the game. But it will render a 3D world and let you walk around in it.
4) If you're a Windows user, which you must be if you're using Dev-C++, check out fackue's DCDev ISO. It includes everything you will need--Code editors, a compiler toolchain for building Dreamcast programs, KallistiOS and a bunch of add-on libraries for it, and I believe it includes Dreamcast emulators for testing your code on the PC (but don't quote me on that last bit, and keep in mind that an emulator isn't a substitute for the real hardware).

I hope that's at least a little bit helpful, and I'm sure somebody more knowledgeable will point out any mistakes I've made or clear up what I haven't explained well.
That is a PERFECT responce sir, thank you so much for breaking it down for me like that! I erally do appreciate it! I'm downloading Fackue's DC Dev right now and I'm going to take a look at it. I'm definitely going to continue learning C++ (I'm also learning AutoCAD as well) so I hope to get my feet wet on programming soon. Right now I'm just basically schooling myself on the fundamentals first and I'm in no rush so it's all good. Thanks again! You were very helpful!
Inspired by the GREATEST gaming console of all-time!
sahiphop
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 17
Joined: Sat Feb 27, 2010 12:02 am
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by sahiphop » Wed Mar 10, 2010 12:47 am

OneThirty8 wrote: and I believe it includes Dreamcast emulators for testing your code on the PC (but don't quote me on that last bit, and keep in mind that an emulator isn't a substitute for the real hardware).

I hope that's at least a little bit helpful, and I'm sure somebody more knowledgeable will point out any mistakes I've made or clear up what I haven't explained well.
BTW I installed it and I'm peeking into the Extras folder... there definitely are Dreamcast Emulators in here... thanks again!
Inspired by the GREATEST gaming console of all-time!
User avatar
Quzar
Dream Coder
Dream Coder
Posts: 7486
Joined: Wed Jul 31, 2002 12:14 am
Location: Miami, FL
Has liked: 0
Been liked: 3 times
Contact:

Re: Dreamcast Programming (Where To Start)

Post by Quzar » Wed Mar 10, 2010 12:11 pm

sahiphop wrote:3) How are engines different from libraries? Can I use the Torque, Source or Unreal engine to program Dreamcast games?
I figured I'd help elaborate on 138's answer to this. An engine is essentially a large set of libraries. It is a game but with no ... data in it. Not sure how apt this analogy is but it can be like a music instrument with no music written. Is has built in ability to do all sorts of things but it is up to the user (in the case of an engine, the developer of the game not the player) to compose the results.

Usually an engine provides a full set of libraries, which are very high level, to do everything you will need to to create a game. Using an engine you plug in models of characters, scripts for where enemies or items will be, a map of an area, and what sorts of things may trigger advancement to a new area (generically). Sometimes it's tempting to think of a game with lots of customization to be an engine, for example one of the DC Pong clones allows for pretty much all visuals (textures), sound effects, and music to be changed. In the end though, you're still just playing pong ;), you can't turn it into breakout or anything.

The most popular open engines for the DC are by far BOR (Beats of Rage) and Quake.
"When you post fewer lines of text than your signature, consider not posting at all." - A Wise Man
sahiphop
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 17
Joined: Sat Feb 27, 2010 12:02 am
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by sahiphop » Thu Mar 11, 2010 1:10 am

I see... I believe I understand what engines do a lot better now. I guess my next question would be what do you guys think of the following game engines: Torque, Unreal, or Source? I'm looking to use Torque to start off with...

Could any Open Source game engines written in C++ and cross-platform work for the Dreamcast development? I'm wondering because I found this listh here: http://en.wikipedia.org/wiki/List_of_ga ... ce_engines Any ideas?

BTW I'm assuming that the engine is where a developer can create the actual graphics for the game to run on, is that true?

From what I currently understand:
- C++ is the code I'll be using to program the game (I'm using Dev C++)
- The compiler pulls the code and executes it (included in my copy of DC Dev ISO 4)
- The library helps me with pre-written codes that I can use without having to re-write them all myself (KallistiOS, included in DC Dev ISO 4)

So to my understanding, that's all dealing with coding. I'm wondering what is involved with the actual 3D mapping, drawing and sculpting of the graphics? Again, I think that's all involved with the type of open source engine I choose, is that right? If so, what do you think about that link I provided?
Inspired by the GREATEST gaming console of all-time!
Ex-Cyber
DCEmu User with No Life
DCEmu User with No Life
Posts: 3641
Joined: Sat Feb 16, 2002 1:55 pm
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by Ex-Cyber » Thu Mar 11, 2010 8:46 am

sahiphop wrote:Could any Open Source game engines written in C++ and cross-platform work for the Dreamcast development?
In general, the engine will need to be ported to Dreamcast. KOS offers some things that make Dreamcast a bit more compatible with code written for PC operating systems, but in general you can't just plug in existing code and expect it to work with no changes. This is because the libraries available on Dreamcast do not have the exact same interface/behavior as the standard libraries on other platforms (partly because of hardware differences, especially in the GPU).
"You know, I have a great, wonderful, really original method of teaching antitrust law, and it kept 80 percent of the students awake. They learned things. It was fabulous." -- Justice Stephen Breyer
User avatar
emptythought
DC Developer
DC Developer
Posts: 2015
Joined: Wed Jan 30, 2002 9:14 am
Location: UNITED STATES NRN
Has liked: 0
Been liked: 0
Contact:

Re: Dreamcast Programming (Where To Start)

Post by emptythought » Thu Mar 11, 2010 4:54 pm

There's also local libraries. Nutshell books are what you're after for reference(s).
sahiphop
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 17
Joined: Sat Feb 27, 2010 12:02 am
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by sahiphop » Fri Mar 12, 2010 5:16 pm

Ex-Cyber wrote:
sahiphop wrote:Could any Open Source game engines written in C++ and cross-platform work for the Dreamcast development?
In general, the engine will need to be ported to Dreamcast. KOS offers some things that make Dreamcast a bit more compatible with code written for PC operating systems, but in general you can't just plug in existing code and expect it to work with no changes. This is because the libraries available on Dreamcast do not have the exact same interface/behavior as the standard libraries on other platforms (partly because of hardware differences, especially in the GPU).
Hmm..okay, I understand that. I'm just wondering though, because I want to be able to make a Platforming game, a fighting game and a racing game in the future (course it'll be the FAAAR future when I finally have a grasp on all this, lol) and I don't think a Quake engine (which is what I mostly hear) would really suit those needs. That's why I'm trying to see if a Free Open Source engine like Toque, Unreal or Source would work on a Dreamcast... since they're open source, I figure I would have access to the code in which I can port to the Dreamcast... so, how easy/difficult would that be?
Inspired by the GREATEST gaming console of all-time!
Ex-Cyber
DCEmu User with No Life
DCEmu User with No Life
Posts: 3641
Joined: Sat Feb 16, 2002 1:55 pm
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by Ex-Cyber » Fri Mar 12, 2010 6:59 pm

sahiphop wrote:That's why I'm trying to see if a Free Open Source engine like Toque, Unreal or Source would work on a Dreamcast... since they're open source, I figure I would have access to the code in which I can port to the Dreamcast... so, how easy/difficult would that be?
How difficult it is to port an engine depends on how clean/portable its code is and on the programmer's skills. Also, it sounds like you're saying that Torque, Unreal Engine, and Source are all Free Software / Open Source, and as far as I know they are all proprietary code.
"You know, I have a great, wonderful, really original method of teaching antitrust law, and it kept 80 percent of the students awake. They learned things. It was fabulous." -- Justice Stephen Breyer
sahiphop
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 17
Joined: Sat Feb 27, 2010 12:02 am
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by sahiphop » Sat Mar 13, 2010 10:28 am

Yeah... come to think of it, after looking at it more.... duh, lol yeah they're propriety code. Someone had told me those engines would work on the Dreamcast... *sigh*

Okay, I'm expanding my learning on the basic C++ but as I'm doing so, I'd like some insight to the future if possible...

I have the DC Dev ISO R4 and I've looked into it... it's awesome! It looks like it has everything, but I'm wondering about whenever I get to 3D modeling and mapping... is there a program in here for that or do I need to download some other program like 3D Max Studio or AutoCAD? I have AutoCAD already...
Inspired by the GREATEST gaming console of all-time!
Ex-Cyber
DCEmu User with No Life
DCEmu User with No Life
Posts: 3641
Joined: Sat Feb 16, 2002 1:55 pm
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by Ex-Cyber » Sat Mar 13, 2010 2:54 pm

sahiphop wrote:I'm wondering about whenever I get to 3D modeling and mapping... is there a program in here for that or do I need to download some other program like 3D Max Studio or AutoCAD? I have AutoCAD already...
I don't know of any well-developed process. Most Dreamcast homebrew is 2D, with 3D typically being done in the form of Quake mods (for which you'd use whatever tools Quake modders use).
"You know, I have a great, wonderful, really original method of teaching antitrust law, and it kept 80 percent of the students awake. They learned things. It was fabulous." -- Justice Stephen Breyer
sahiphop
DCEmu Fast Newbie
DCEmu Fast Newbie
Posts: 17
Joined: Sat Feb 27, 2010 12:02 am
Has liked: 0
Been liked: 0

Re: Dreamcast Programming (Where To Start)

Post by sahiphop » Sat Mar 13, 2010 8:33 pm

Ex-Cyber wrote:
sahiphop wrote:I'm wondering about whenever I get to 3D modeling and mapping... is there a program in here for that or do I need to download some other program like 3D Max Studio or AutoCAD? I have AutoCAD already...
I don't know of any well-developed process. Most Dreamcast homebrew is 2D, with 3D typically being done in the form of Quake mods (for which you'd use whatever tools Quake modders use).
I'm all for starting off with a 2D Platforming game... I basically want to create a very simple game JUST to give me the experience and encouragement to try more complicated programming... It's just that while I'm learning C++, I'm noticing that there's a loooot of info to go through for Dreamcast programming... I'll make a basic tic-tac-toe game for Dreamcast just so I can see a finished product and have that springboard me into developing more complicated programs as I continue my learning... Any ideas?
Inspired by the GREATEST gaming console of all-time!
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5387
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has liked: 1 time
Been liked: 12 times
Contact:

Re: Dreamcast Programming (Where To Start)

Post by BlueCrab » Sat Mar 13, 2010 11:04 pm

sahiphop wrote:I'll make a basic tic-tac-toe game for Dreamcast just so I can see a finished product and have that springboard me into developing more complicated programs as I continue my learning... Any ideas?
Don't make your end-game detection logic for tic-tac-toe all in one if statement... It makes for one very ugly if statement. :lol:

Note: I wrote a tic-tac-toe program for TI-83+ calculators that actually did check all winning conditions for tic-tac-toe with one if statement (it checked every combination of marks in a 3x3 grid). The if statement was several screens full of text on the TI-83+. It worked... thankfully, but its probably the worst code I've written any time in the last 4 years (I wrote it during a day of Linear Algebra class a few years back).
Post Reply