CodeWalrus

Development => Consoles => Topic started by: Ivoah on October 30, 2015, 02:57:24 am

Title: Ivoah's GBA programming thread [GBA]
Post by: Ivoah on October 30, 2015, 02:57:24 am
I recently got an EZ-Flash IV GBA flash cart. It lets me run custom roms on real GBA hardware. So far this is what I've made:
[video width=480]https://sr.ht/G6_p.webm[/video]

You just move the '#' around with the dpad.
Title: Re: Ivoah's GBA programming thread
Post by: DJ Omnimaga on October 30, 2015, 03:00:07 am
I'm glad that you got into console homebrew. I notice that movement seems very fast. I am curious about how fast it would be with a tiled grass background and a walrus, for example. You could maybe make some game where Walrii is underwater and must catch as many fishes as he can to not starve (his stamina would decrease over time, faster and faster, and would be replenished as you eat).
Title: Re: Ivoah's GBA programming thread
Post by: Ivoah on October 30, 2015, 03:01:41 am
Quote from: DJ Omnimaga on October 30, 2015, 03:00:07 am
I'm glad that you got into console homebrew. I notice that movement seems very fast. I am curious about how fast it would be with a tiled grass background and a walrus, for example. You could maybe make some game where Walrii is underwater and must catch as many fishes as he can to not starve (his stamina would decrease over time, faster and faster, and would be replenished as you eat).


Currently I'm not doing any actual graphics, there's an ANSI console library which lets me just treat it like a terminal screen. I'm sure it would be able to run your suggested game just fine, I mean, look at games like MK:SS and the Mario games.
Title: Re: Ivoah's GBA programming thread
Post by: DJ Omnimaga on October 30, 2015, 03:02:29 am
Ooh I see. Now I got an idea, but that might be too big as first project :P

First Fantasy: Mana Force :trollface:
Title: Re: Ivoah's GBA programming thread
Post by: Ivoah on October 30, 2015, 03:03:13 am
I may try porting sl or nyancat, two of my favorite console programs :D
Title: Re: Ivoah's GBA programming thread
Post by: DJ Omnimaga on October 30, 2015, 09:57:21 pm
If you do Nyan Cat, you should do it like the Nspire and CSE versions. :)
Title: Re: Ivoah's GBA programming thread
Post by: Streetwalrus on October 30, 2015, 10:01:06 pm
The GBA has hardware acceleration for drawing 2D sprites, no problem at all with maps and such.
Title: Re: Ivoah's GBA programming thread
Post by: Max Leiter on October 30, 2015, 10:16:11 pm
if you ever make a super Mario sunshine remake youll be my favorite person ever <3
Title: Re: Ivoah's GBA programming thread
Post by: Ivoah on October 30, 2015, 10:35:09 pm
Quote from: DJ Omnimaga on October 30, 2015, 09:57:21 pm
If you do Nyan Cat, you should do it like the Nspire and CSE versions. :)


Well, I was talking about the terminal version, but I've given up on it because I realized that the ansi_console library probably doesn't support color. And what Nspire version are you talking about?
Title: Re: Ivoah's GBA programming thread
Post by: DJ Omnimaga on October 30, 2015, 11:37:42 pm
Levak's. The only Lua program for Nspire that was actually fullscreen.
Title: Re: Ivoah's GBA programming thread
Post by: Ivoah on October 31, 2015, 12:02:04 am
Quote from: DJ Omnimaga on October 30, 2015, 11:37:42 pm
Levak's. The only Lua program for Nspire that was actually fullscreen.


How'd he manage fullscreen?
Title: Re: Ivoah's GBA programming thread
Post by: DarkestEx on October 31, 2015, 12:08:03 am
Can't wait to try your games and demos yourself as I am getting myself an EZFlash 2015.
I also plan developing GBA games at some point as I bought and restaurated a GBA a few weeks ago.
Title: Re: Ivoah's GBA programming thread
Post by: Ivoah on October 31, 2015, 12:24:29 am
Quote from: DarkestEx on October 31, 2015, 12:08:03 am
Can't wait to try your games and demos yourself as I am getting myself an EZFlash 2015.
I also plan developing GBA games at some point as I bought and restaurated a GBA a few weeks ago.


I can't guarntee anything I make will be fun :P
Title: Re: Ivoah's GBA programming thread
Post by: DJ Omnimaga on October 31, 2015, 05:19:45 am
Quote from: Ivoah on October 31, 2015, 12:02:04 am
Quote from: DJ Omnimaga on October 30, 2015, 11:37:42 pm
Levak's. The only Lua program for Nspire that was actually fullscreen.


How'd he manage fullscreen?
Via some exploit or glitch in Nspire Lua interpreter on OS 3.0.1. I don't remember if the bug still works.

Here is the game, by the way (it even had sound in OS 3.0.1): https://tiplanet.org/forum/archives_voir.php?id=3707
Title: Re: Ivoah's GBA programming thread
Post by: Ivoah on November 02, 2015, 02:46:16 am
Woo! I got sl running (albeit very slowly)
[video]https://sr.ht/ChFX.webm[/video]
Title: Re: Ivoah's GBA programming thread
Post by: alexgt on November 02, 2015, 02:55:57 am
O.O cool
Title: Re: Ivoah's GBA programming thread
Post by: DJ Omnimaga on November 02, 2015, 04:08:40 am
OOh that looks cool. :D Do you think the text speed can be improved?
Title: Re: Ivoah's GBA programming thread
Post by: Ivoah on November 02, 2015, 04:09:52 am
Quote from: DJ Omnimaga on November 02, 2015, 04:08:40 am
OOh that looks cool. :D Do you think the text speed can be improved?


I'm sure it could be improved, but I probably won't bother. Here's the rom for anyone that's interested: https://sr.ht/qrIf.gba
Title: Re: Ivoah's GBA programming thread
Post by: DJ Omnimaga on November 02, 2015, 04:27:19 am
As long as games that you make don't have text this slow I am fine :P (sprite-based games I mean. Imagine if the score took longer to display than the map XD)
Title: Re: Ivoah's GBA programming thread
Post by: Streetwalrus on November 02, 2015, 09:07:55 am
I suppose this text library uses software rendering which should explain why it's so slow.
Title: Re: Ivoah's GBA programming thread
Post by: DJ Omnimaga on November 03, 2015, 04:27:44 am
YEah that could be it. That reminds me, have you gotten any luck displaying sprites, ivoah? Also does the GBA have scrolling routines?
Title: Re: Ivoah's GBA programming thread
Post by: Ivoah on November 03, 2015, 04:29:49 am
Quote from: Streetwalrus on November 02, 2015, 09:07:55 am
I suppose this text library uses software rendering which should explain why it's so slow.


I've changed some code up a bit and now it runs much better:
(https://sr.ht/GYRb.gif)

I replaced
int mvaddch(int y, int x, const char ch)
{
    if (x >= COLS || x < 0 || y >= LINES || y < 0) return ERR;
    iprintf("\033[%d;%dH%c", y, x, ch);
    return OK;
}

int my_mvaddstr(int y, int x, char *str)
{
    for ( ; x < 0; ++x, ++str)
        if (*str == '\0')  return ERR;
    for ( ; *str != '\0'; ++str, ++x)
        if (mvaddch(y, x, *str) == ERR)  return ERR;
    return OK;
}


with
int my_mvaddstr(int y, int x, char *str)
{
    for ( ; x < 0; ++x, ++str)
        if (*str == '\0')  return ERR;

    if (x >= COLS || x < 0 || y >= LINES || y < 0) return ERR;
    iprintf("\033[%d;%dH%.*s", y, x, COLS - x, str);

    return OK;
}


Quote from: DJ Omnimaga on November 03, 2015, 04:27:44 am
YEah that could be it. That reminds me, have you gotten any luck displaying sprites, ivoah? Also does the GBA have scrolling routines?


I haven't gotten around to doing anything beyond messing with the text output yet.
Title: Re: Ivoah's GBA programming thread
Post by: DJ Omnimaga on November 03, 2015, 06:51:18 am
I see. By the way nice speed improvement. Does the text engine support background color for individual characters and foreground?
Title: Re: Ivoah's GBA programming thread
Post by: Streetwalrus on November 03, 2015, 11:16:49 am
I don't think it needs any kind of scrolling routines, the hardware is designed to draw sprites at any place on the screen. If I recall correctly it supports a couple background and map layers, and standalone sprites. So whatever you do it's going to be fast.
Title: Re: Ivoah's GBA programming thread
Post by: DJ Omnimaga on November 03, 2015, 06:15:52 pm
Yeah I was wondering because I wasn't sure if redrawing a tilemap every frame caused massive slowdowns.