DCEmulation

dreamcast development • homebrew software • hardware hacking • indie games • emulators • and more!
Back to main site
It is currently Mon Dec 18, 2017 9:34 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 92 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
 Post subject:
PostPosted: Fri Aug 08, 2003 9:23 pm 
Offline
Insane DCEmu
Insane DCEmu
User avatar

Joined: Sat Jun 14, 2003 10:00 pm
Posts: 223
Location: melb.vic.au
Pyrosurfer wrote:
I am using visual c++ and kos 1.9, and the following "vram_s[x + (y * 640)] = PACK_PIXEL(r, g, b); " would not work for me. Is this method not supported in 1.9?

Did you actually #define the PACK_PIXEL macro, as BlackAura described?

EDIT: Just noticed, when defining it's called "PACK_PIXELS", but used as PACK_PIXEL later. Bit of a bug in your tutorial there BlackAura. :) So yeah, just add or remove the S as you see fit.


Last edited by finite on Sat Aug 09, 2003 10:57 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Aug 09, 2003 2:05 pm 
Offline
DCEmu Nutter
DCEmu Nutter

Joined: Sun Aug 11, 2002 3:07 pm
Posts: 964
Yeah i did the #define, but it didn't work. Edit: Changed pack_pixel to pack_pixels and it worked.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Aug 09, 2003 7:47 pm 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
D'oh! Typing error. That's what happens when you change the names of the macros at the last minute - it used to be PACK_RGB565. I'll change it...


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Aug 10, 2003 8:32 pm 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
Alrighty... I've converted the tutorials to HTML, and put them up, along with a third tutorial, along with BlueCrab's PVR version. I'm going to be putting Reaper's SDL tutorial up soon too.

I've got two more 2D graphics tutes that I'm working on - one is pretty much done, the other's been coded but not written up. It's enough to do a simple game by now, so I might start doing some tutorials on controller input too. Anyone want to request a specific game to go through? Something simple, line an old arcade game would probably be best.

http://files.frashii.com/~sp00nz/Doom/f ... Aura/tutes


Top
 Profile  
Reply with quote  
 Post subject: Requests!
PostPosted: Sun Aug 10, 2003 9:47 pm 
Offline
Mental DCEmu
Mental DCEmu

Joined: Thu Oct 10, 2002 5:18 pm
Posts: 415
Pong, Breakout, and Pac Man (in that order).

Maybe some time later Super Mario Bros.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sun Aug 10, 2003 10:20 pm 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
Pong's easy - typically just twenty lines of code. That's how long my last version (coded in about twenty minutes) was, I think.

Breakout - also fairly easy. It's just Pong, turned around 90 degrees, with blocks instead of a paddle.

Pac Man - Oddly, I've never done one... I don't think it'd be too hard though. Needs some actual graphics, instead of just boxes and lines, but otherwise it should be fairly easy.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 11, 2003 1:17 am 
Offline
DCEmu Banned
DCEmu Banned

Joined: Fri Jul 11, 2003 7:56 pm
Posts: 4850
Hey neat i will enjoy following the game tuts my pong clone was a lot more then 20 lines :oops: but i used AI and grafix. was only a 1 player game. i know tetris is allways good!.

_________________
Image

Join the Muppet posse!
http://www.dcemulation.com/phpBB/viewtopic.php?t=54866


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 11, 2003 6:25 am 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
Well, the entire chunk of code was a lot longer, but most of that was some PVR code to render the bats, the ball, and the score, along with some controller inteface code. I don't consider that to be part of the game itself. The main game loop was very short. Admittedly, it was a little buggy, but it worked quite well - the bugs were just be being really, really lazy.

Space Invaders isn't really that difficult either. I coded a version of that in Visual Basic at school, while I was sitting in class with nothing to do because I'd finished the assignment about four weeks before it was due in. And that was a very complex version of Space Invaders.

So, in my to-do list for these tutorials, I've currently got:
Graphics - Hardware double buffering / animation
Graphics - Image loading and drawing (using KOS's image library)
Graphics - Sprite drawing, RLE accelerated sprites (these are a real pain in the bum)
Graphics - Software double buffering (DMA or store queues)
Game - DC controller support
Games - Pong, Breakout, Pacman, (maybe) Space Invaders, (maybe) Tetris

I might change the layout of the games tutorials a little bit. I don't much like the idea of teaching someone what to do - I prefer to teach them how to do it. So instead of writing a tutorial on how to write a Pong clone, I might instead write a tutorial on basic games programming, and use Pong as an example. That way, people might actually learn something, and can hopefully go on to create a game of their own. And I'd really like to see some more homebrew games.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 11, 2003 8:35 pm 
Offline
DCEmu Ultra Poster
DCEmu Ultra Poster

Joined: Wed Jul 17, 2002 9:25 am
Posts: 1754
Sounds like quite a project.

_________________
If you have twenty monkeys,
banging randomly on typewriters,
they will in twenty minutes produce the complete source code to World of Warcraft.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 11, 2003 10:01 pm 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
Yeah, but I already have most of the code written. I've got hardware double buffering done, and I have code to load images (from Genesis Plus), draw images, draw sprites, use the controllers, and I have fairly simple versions of Pong and Space Invaders I can use.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 12, 2003 9:11 pm 
Offline
Official DCEMU Stalker
Official DCEMU Stalker

Joined: Tue Apr 23, 2002 4:26 pm
Posts: 1604
Location: South Dakota
Hmmm rebirth of dev.dcemulation.org? :) It would be great to get dcdev updated, and then have your tutorials. I think siggy is going to redo the site, but some things such as his own projects are coming in the way, lol. Think you would let dcdev host your tutorials if the site is ever updated? Great job btw

_________________
Image
Thanks to Digital Chaos, GoldbergWWE, and ace for the avatar, sig, and badge!
http://devcast.dcemulation.com


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 12, 2003 10:37 pm 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
I'd let them host the tutorials - I have no problems with that. Tutorials on drawing text, and hardware double buffering are coming up - I'm writing the double buffering one up in HTML, and writing the code for the text one (basically reusing KOS code)


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Aug 18, 2003 9:04 pm 
Offline
DCEmu Nutter
DCEmu Nutter

Joined: Sun Aug 11, 2002 3:07 pm
Posts: 964
Any progress yet on new tutorials? I would really like to learn how to input from the controller and keyboard. Great job so far Everyone!


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 19, 2003 1:20 am 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
Well, I have an extremely rough and insufficiently tested double buffering tutorial in text format. I'll test it and upload it later, probably tomorrow morning (late Tuesday night US time)

Controller input isn't really that hard - I'll try to do a tutorial on it in a bit.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 19, 2003 10:18 am 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 5228
Controller Input:

I actually had some stuff for a contoller input tutorial written up already, so I figured I'd post it. (Feel free to add to this BlackAura)

With newer versions of KOS (up to 1.2.0), you have two methods you can choose from for controller input. Both are very similar, and easy to understand. First I will tell what is the same between the two, and then get into the differences.

Button Codes:

Both methods of polling the controllers (for lack of a better term), use the same button names. They are self explanatory, and listed below:
Most common:
Code:
CONT_A
CONT_B
CONT_X
CONT_Y
CONT_START
CONT_DPAD_UP
CONT_DPAD_DOWN
CONT_DPAD_LEFT
CONT_DPAD_RIGHT


Here are a few others that don't appear on most controllers, but still can be used:
Code:
CONT_C
CONT_D
CONT_Z
CONT_DPAD2_UP
CONT_DPAD2_DOWN
CONT_DPAD2_LEFT
CONT_DPAD2_RIGHT


Remember, all the button codes are used in both methods of controller polling.

Now lets move on to some differences:

Method 1: The old Maple API:

This method of controller input uses the older Maple API of KOS. This method is slightly easier (no use of pointers, one less function call), but may not be available in future versions of KOS. This is, by far, the most common way you will see controller code, as of right now.

To hold the controller information, we need a simple variable. This is a cont_cond_t in this case.
Code:
cont_cond_t cond;
Will get a variable set up for you.

Now, to see what's being pushed, and react to it, you would put the following code in your game's main loop:

Code:
cont_get_cond(maple_first_controller, &cond);

if(!(cond.buttons & CONT_A))   {
   /* Do anything that needs to be done for pressing the A button here */
}

/* Put any buttons you will need in here, just like the A one above */


This just grabs what is being pushed on the 1st controller, and puts it in our variable we set up. All you have to do is test that variable for what ever button constant you want, as directed above. Simple, eh?

Method 2: The new Maple API:

This next method of controller polling relies on the new Maple API in newer versions of KOS. I believe that this API was available beginning with KOS 1.1.8, but I'm not positive.

This method involves two different variables, and is slightly easier to deal with multiple variables. Here are our two variables:
Code:
cont_state_t * state;
maple_device_t * addr;


Our cont_state_t pointer will hold what buttons are pushed, and the maple_device_t pointer will point to a Maple address.

Before we try to get controller info, we need to initialize the address variable. This is done like so:
Code:
addr = maple_enum_type(0, MAPLE_FUNC_CONTROLLER);

This will set the address variable to point to the first found Maple device that reports itself as a controller. You can change the 0 in the function to allow for other controllers to be used, just make sure to have multiple address variables.

Now to poll the controllers, put the following code in your game's main loop:
Code:
state = maple_dev_status(addr);
if(state->buttons & CONT_A)   {
   /* Do any A button stuff here */
}


Once again feel free to add other buttons, and take A out. Just make sure they all look similar to the code snippet above.

That's all for right now, because I can't think of anything else to say! Feel free to leave any comments/questions and I'll try to remember to respond.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 19, 2003 6:26 pm 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
Cool, thanks. Saves me from having to do it from scratch.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 19, 2003 7:23 pm 
Offline
The Crabby Overlord
The Crabby Overlord
User avatar

Joined: Mon May 27, 2002 9:31 am
Posts: 5228
BlackAura wrote:
Cool, thanks. Saves me from having to do it from scratch.
Heh. Glad I could help. BTW, I think you should rename this thread KOS tutorials, or something.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Tue Aug 19, 2003 9:57 pm 
Offline
DC Developer
DC Developer

Joined: Sun Dec 30, 2001 8:02 am
Posts: 9951
Yeah, probably...

Edit: I don't currently have a Dreamcast dev kit set up, so I can't do any tutorials that rely on me having a Dreamcast to test them on. That's no big deal though - most of the stuff I've got planned is fairly generic anyway, and will work just fine on a PC using SDL or on a Dreamcast. It just means that they won't actually be properly tested on a Dreamcast.

I'm HTMLifying Bluecrab's controller tutorial, and editing it a little bit. Should be done soon.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Aug 22, 2003 9:13 am 
Offline
Mental DCEmu
Mental DCEmu

Joined: Thu Oct 10, 2002 5:18 pm
Posts: 415
How are those tutorials going?

Also thanks a lot for taking the time to provide them!
(That goes out to Bluecrab, Im(r)eaper, and Blackaura)

edit: sorry the comics screen i'm using has everything in caps.
so i didn't realize. also please be a little more informant than "capslock".


Last edited by q_006 on Mon Aug 25, 2003 2:27 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Aug 22, 2003 11:26 am 
Offline
DCEmu Ultra Poster
DCEmu Ultra Poster

Joined: Wed Jul 17, 2002 9:25 am
Posts: 1754
capslock

_________________
If you have twenty monkeys,
banging randomly on typewriters,
they will in twenty minutes produce the complete source code to World of Warcraft.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 92 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group