Do our homebrew games...

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.
Post Reply
DrNicholas
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 31
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Sun Oct 02, 2011 5:33 pm
Has thanked: 0
Been thanked: 0

Do our homebrew games...

Post by DrNicholas »

...1. Have be to limited to 16mb for they are just loaded onto the ram? If not, then is there code that will load parts from the cd and stuff?

2. If using SDL, it has to use the sdl specific stuff that comes with kos?

3. Have the ability to play movie files and music (that is not modplug tracker)?

If I think of more ill post them :3
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Do our homebrew games...

Post by BlueCrab »

1. Realistically, your programs generally should be limited to less than 16MB. You could split things up into separate programs, but that's a major pain and probably not something that you'd want to be dealing with.

2. If by specific SDL stuff you mean the library that comes with KOS (since the only one in the kos-ports tree in the SVN is the main SDL library, that's all I'm assuming), you're not specifically limited to it, but you're basically on your own to get the other stuff working. Fair warning, SDL absolutely sucks on the Dreamcast. Its slow, and it leaks memory like a ship that's been hit by a cannonball leaks water. Its definitely not the way to go if you're writing something that's specific to the Dreamcast.

3. Well, KOS comes with libraries to play more than just mod files, although it doesn't come with anything directly to play video. Basically, unless you see it around here, you're on your own to figure it out.
DrNicholas
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 31
Joined: Sun Oct 02, 2011 5:33 pm
Has thanked: 0
Been thanked: 0

Re: Do our homebrew games...

Post by DrNicholas »

So is there anything better than SDL? Cause what I am using is SDL and my game is specific to the dreamcast.

How was that rush rush rally racing (or whatever it was called) made (to your best guess).

And yes, Zelda ROTH will randomly crash in the middle of playing
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Do our homebrew games...

Post by BlueCrab »

KOS has many different ways to do graphics, and a few different ways of doing everything else as well. The "best" way to do graphics is to use the PVR API which uses the 3D hardware directly. If you're doing everything in 2D, its pretty easy to figure out. 3D would require extra work dealing with matrices and the like (but I'm assuming you're doing 2D based on the use of SDL to start). You can read up on the PVR stuff in its header file (kernel/arch/dreamcast/include/dc/pvr.h), or from the documentation generated from it here. Looking at the example programs that use the PVR will also help.

If you don't want to deal with that low of a level for doing stuff, there are other choices in KOS. You could use libparallax or libtsunami, for instance. These are both in the kos-ports tree.

As for controls, KOS provides its "maple" API for that. See the header files (kernel/arch/dreamcast/include/dc/maple.h and kernel/arch/dreamcast/include/dc/maple/*.h) for information on that, or consult the documentation: <dc/maple.h> and <dc/maple/controller.h> are probably the most important to you. Also, consult the examples in KOS too. Most of them have at least a little interaction with controllers.

For audio, your best bet will probably be to go with one of the Ogg Vorbis libraries that are included in the kos-ports tree, if you don't want to do mod files. They're pretty easy to set up and use, and there's an example with KOS of how to do so. For one-off sound effects, KOS has stuff to do that too. See the kernel/arch/dreamcast/include/dc/sound/sfxmgr.h file or the documentation here.

Simply put, for most things, there are examples showing how to do the basics. Most of them are fairly up-to-date (I went through and took a look at them all in the past year or so and made sure they at least compiled still).

As for other games and how they're made... I'd assume that anything of any real professional quality was probably made without using SDL. I have no idea about the specific example you provided, but the commercial homebrew game Feet of Fury was made using libtsunami.
User avatar
RyoDC
Mental DCEmu
Mental DCEmu
Posts: 366
Joined: Wed Mar 30, 2011 12:13 pm
Has thanked: 2 times
Been thanked: 0

Re: Do our homebrew games...

Post by RyoDC »

It is possible to work with PVR on 2d?
How do I try to build a Dreamcast toolchain:
Image
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Do our homebrew games...

Post by BlueCrab »

Of course it is.
DrNicholas
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 31
Joined: Sun Oct 02, 2011 5:33 pm
Has thanked: 0
Been thanked: 0

Re: Do our homebrew games...

Post by DrNicholas »

when i finish my basic engine, do you think you could take a look and try and port it to pvr? would pvr benefit my game on the dreamcast? is there any site, resource, etc?
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Do our homebrew games...

Post by BlueCrab »

Unfortunately, I don't even have time for my own code at the moment, so I wouldn't be able to help out at all. That said, many homebrew games/emulators/etc use the PVR, so there's a wide base of things to look at to help you out.
DrNicholas
DCEmu Crazy Poster
DCEmu Crazy Poster
Posts: 31
Joined: Sun Oct 02, 2011 5:33 pm
Has thanked: 0
Been thanked: 0

Re: Do our homebrew games...

Post by DrNicholas »

I ahve seen things for vmus but ive seen no real way to initialize a vmu lol.
User avatar
BlueCrab
The Crabby Overlord
The Crabby Overlord
Posts: 5652
Joined: Mon May 27, 2002 11:31 am
Location: Sailing the Skies of Arcadia
Has thanked: 9 times
Been thanked: 69 times
Contact:

Re: Do our homebrew games...

Post by BlueCrab »

Saving and loading is pretty easy to a VMU is pretty easy. Here's some code from my emulator CrabEmu that does VMU stuff, and compresses the data (before saving it):

Code: Select all

/*
    This file is part of CrabEmu.

    Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Lawrence Sebald

    CrabEmu is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License version 2 
    as published by the Free Software Foundation.

    CrabEmu is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with CrabEmu; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

int sms_write_cartram_to_file(const char *fn __UNUSED__) {
    vmu_pkg_t pkg;
    uint8 *pkg_out;
    uint8 *comp;
    int pkg_size;
    uint32 len;
    FILE *fp;
    char prodcode[7];
    char savename[15];
    int err;

    if(!cartram_enabled && mapper != SMS_MAPPER_93C46) {
        return 0;
    }

    sprintf(prodcode, "%d%d%d%d%d", (sms_cart_rom[0x7FFE] & 0xF0) >> 4,
            (sms_cart_rom[0x7FFD] & 0xF0) >> 4, (sms_cart_rom[0x7FFD] & 0x0F),
            (sms_cart_rom[0x7FFC] & 0xF0) >> 4, (sms_cart_rom[0x7FFC] & 0x0F));

    sprintf(savename, "/vmu/a1/%s", prodcode);

    comp = (uint8 *)malloc(0x10000);
    len = 0x10000;

    if(mapper == SMS_MAPPER_93C46) {
        err = compress2(comp, &len, (uint8 *)e93c46.data, 128, 9);
    }
    else    {
        err = compress2(comp, &len, sms_cart_ram, 0x8000, 9);
    }

    strcpy(pkg.desc_short, "CrabEmu Save");
    strcpy(pkg.desc_long, prodcode);
    strcpy(pkg.app_id, "CrabEmu");
    pkg.icon_cnt = 1;
    pkg.icon_anim_speed = 0;
    memcpy(pkg.icon_pal, icon_pal, 32);
    pkg.icon_data = icon_img;
    pkg.eyecatch_type = VMUPKG_EC_NONE;
    pkg.data_len = len;
    pkg.data = comp;

    vmu_pkg_build(&pkg, &pkg_out, &pkg_size);

    fp = fopen(savename, "wb");

    if(!fp) {
        free(pkg_out);
        free(comp);
        return -1;
    }

    fwrite(pkg_out, pkg_size, 1, fp);
    fclose(fp);

    free(pkg_out);
    free(comp);

    return 0;
}

int sms_read_cartram_from_file(const char *fn __UNUSED__) {
    vmu_pkg_t pkg;
    uint8 *pkg_out;
    int pkg_size;
    char prodcode[7];
    FILE *fp;
    char savename[15];
    uint32 real_size = mapper == SMS_MAPPER_93C46 ? 128 : 0x8000;

    sprintf(prodcode, "%d%d%d%d%d", (sms_cart_rom[0x7FFE] & 0xF0) >> 4,
            (sms_cart_rom[0x7FFD] & 0xF0) >> 4, (sms_cart_rom[0x7FFD] & 0x0F),
            (sms_cart_rom[0x7FFC] & 0xF0) >> 4, (sms_cart_rom[0x7FFC] & 0x0F));

    sprintf(savename, "/vmu/a1/%s", prodcode);

    fp = fopen(savename, "rb");

    if(!fp) {
        return -1;
    }

    fseek(fp, 0, SEEK_SET);
    fseek(fp, 0, SEEK_END);
    pkg_size = ftell(fp);
    fseek(fp, 0, SEEK_SET);

    pkg_out = (uint8 *)malloc(pkg_size);
    fread(pkg_out, pkg_size, 1, fp);
    fclose(fp);

    vmu_pkg_parse(pkg_out, &pkg);

    if(mapper == SMS_MAPPER_93C46) {
        eeprom93c46_init();
        uncompress((uint8 *)e93c46.data, &real_size, pkg.data, pkg.data_len);
    }
    else {
        uncompress(sms_cart_ram, &real_size, pkg.data, pkg.data_len);
    }

    free(pkg_out);

    cartram_enabled = 1;

    return 0;
}
It should be pretty easy to figure out what you have to do from that, hopefully. Keep in mind that this code is directly from my emulator, so it deals with some things that you (obviously) won't have to deal with. :wink:
Post Reply