What am I getting myself into....libgba looks like a wasteland!!

I really like DevKitPro and the libraries and tools it comes with for most consoles, but it really seems the GBA is barely getting attention with libgba. It looks more like a collection of header files than a library to help homebrew development. Maybe it's because the system is old and less popular but the NDS has many helper functions to handle sprites and effects. The GBA with libgba has exactly ZERO functions to help you setting this up!! Maybe they removed it or because of the low memory they did not want to include too much or something, I don't know. :wtf:

I thought...let's be helpful and contribute to the GBA examples by porting the simple ones from the NDS that just use the 2D engine and not require touch. Even the one called "simple" is very hard to get working because you have to setup the sprites yourself. To be fair there is also libtonc that seems to provide these functions, but the entire API is different and incompatible with libgba. I got TONS of errors and warnings because stuff gets declared twice by them. All I wanted is a way to initialize the OAM and reserve some VRAM for my sprite which in this example was just a single colour!

Is there really so little homebrew going on for the GBA these days that nobody cares or noticed this earlier? Or is it because of this that there is not much homebrew for the GBA????

Only these options are left I guess:
- make a fork of libgba to add the missing functions
- switch over to libtonc
- write my own helper functions
- "borrow" libtonc functions and modify to work in libgba :evil:

I am not really liking option 2 and 3 for a couple of reasons, and option 1 is going to take a bunch of time!! :cry::angry: Option 4 is kind of evil but will get me further a lot sooner that doing it all on my own I think. The best way is to make it as compatibly as I can to the NDS so the examples are easily ported over. The reason for porting by the way is also to get experience with the GBA and the libraries. Helping others by providing the examples later is just a nice additional bonus. ;)

Originally I had many ugly words planned towards libgba but I think I managed to keep myself under control. Right? :rofl:




EDIT1: After considering a few options and testing stuff out....the first example called "simple" from the NDS examples has been ported to the GBA now :D
EDIT2: It took a while longer but the "Sprites" part of the "fire_and_sprites" example is ported too.
View attachment 214512View attachment 214544
NB: This is not WinXP (just to be clear) but a theme on XFCE ;)
  • Like
Reactions: 2 people

Comments

Yeah libgba/devkitarm/devkitpro's GBA offerings are a bit thinner, especially compared to the DS efforts, and were more something of a latecomer to it all.

I don't know if I would necessarily recommend them but
https://sourceforge.net/p/devkitadv/activity/
https://en.wikibooks.org/wiki/GBA_Development/HAM_IDE
https://www.aaronrogers.com/ham/Day8/day8.php
Those were the more popular things among the GBA if you are maybe wanting something to pull from.

I assume you also have a copy of
http://www.coranac.com/tonc/text/setup.htm
 
  • Like
Reactions: 2 people
Looking back in the threads and history it seemed Devkitpro evolved around the time the DS came out so it makes sense I guess. Well I have been using so much opensource stuff over the years, maybe it's time to return the favor. :wink:

Considering how popular devkitpro is (I think) it makes more sense to create a fork of libgba and add the missing functions. Trying to keep to their coding standards as much as I can which is a challange. And if I am happy with it I might do a pull request to get my changes into the official repository. That would be awesome I think :D

Thanks for the links, I did ofcourse have the tonc website and the demo's there are really awesome. Even "hello world" does not have to be dull anymore it seems. :wink: (for those that do not know check it out! The letters drop down and bounce with some gravity. Really cool!!) My only problem/issue with libtonc is the different API and function names and that I can not use libgba and libtonc at the same time. I will use the other sites to see if they give me a different view on how to get sprites showing.
 
  • Like
Reactions: 1 person
While I have massive misgivings with devkitpro in recent times (their handling of old versions really rubbed me the wrong way) they do generally do still/did still make nice things (there is a reason they were as popular as they were) so if you did see some nice examples and libraries winging their way into it then that would be cool.
 
  • Like
Reactions: 2 people
@Archerite:

Option 5:

https://github.com/PeterLemon/GBA

from a guy that runs gbadev.org

wink wink, trust me, you DON'T want to waste precious time setting up libraries and testing compatibility. So you can focus into programming right at once.

This library seems to be closer to bare metal coding, at least in the API stuff. Since it's assembly it should save quite some memory as opposed to using newlib (like you instantly eat 110K or so just by linking glue code, but you get to compile C code. I'm not sure said GBA Library allows to compile C(89) code)
 
  • Like
Reactions: 2 people
I just started on GBA programming too, and was struck by how sparse libgba mostly is compared to the 3DS and Switch libraries I've previously dabbled with. Thankfully the game I'm writing is relatively simple in terms of graphical output, so it hasn't been too hard to get that going myself. What I am grateful for tho is MaxMod, it's an absolute godsend being able to play samples and music with a few simple commands rather than writing my own audio mixer and hammering the hardware registers. Sounds like MaxMod is also available for the DS, so we're fortunate we got a GBA version too.
 
  • Like
Reactions: 2 people
@FAST6191: Until I tried the GBA part of Devkitpro I was really happy about it. I did read about homebrew for Wii or GameCube that was written for older versions might not compile anymore. I have not run into issues like that myself yet....but maybe you meant something else. I'll see what I can do about extending the current minimal list of examples provided for the GBA :D (it might take a while though)

@Coto: I am assuming the "wink wink" means that's your site than? I get you're point about wasting time...but I see it as an opportunity to learn more about the GBA hardware. That is my number one goal here...but if something useful comes from that it would be nice ;)That is a really cool set of examples all written in assembly :O....AWESOME!!!! Since the GBA is really low level and "simple" hardware it's perfect to write things in assembly....and I love how small things can be when you do. I can read it a little and understand what an instruction does....but something as complex as that is beyond me, hahaha. That it can be accessed by C code is great but I have my doubts the assembler used is compatible with GCC. Since I am on Linux that is my go to compiler and DevKitArm is perfect for me in that way :D. Reading the hardware documentation and understanding it somewhat is great....but seeing examples...even in assembly of how to use it makes all the difference! Thanks for the link, more reading and studying to do! B-)

@hippy dave: Cool! What are you working on? I have used Devkitpro for GameCube, Wii, 3DS and a small time also NDS so I had the same impression about libgba. My blog post here is just my frustration and a way to let it out :). I have not even looked at sound yet beyond the provided examples and it did seem simple to use. Unfortunately for my homebrew game I would need MikMod because of the weird tracker formats used in Batterycheck and Jazz2. (ok, maybe not weird just old ;)) For many legal reasons I need to convert graphics and sound on the device instead off at compile time....that's why I need it. :)I am not even sure if the GBA is fast enough to run it, but if I can convert into something that is supported than that would be fine to. Sound effect's are just raw PCM streams so that should be easy enough with MaxMod I hope.

About "Writing my own version of libgba" the examples for the GBA that come with Devkitpro is disappointing, so I want to port the ones for the NDS that only use 2D features the GBA can handle. My main goal would be compatibility with libnds as much as possible to make porting those examples easier. I have a feeling that if you strip the oamMain and oamSub engines from the libnds functions it's a direct match with the GBA and that is what I am looking at now.

I wanted to attach a file here but it seems that needs to be attached to the main blog post then;). The first example has been ported to the GBA!!!:D


Sorry about the long post :shy:
 
  • Like
Reactions: 1 person
I'm porting a puzzle game I wrote a few years ago for a game jam. I've been meaning to improve and expand it for years, I did a primitive Switch homebrew version that was never complete enough to go public, and started a Unity version with the hopes of improved graphics and easy porting to multiple platforms, but have yet to finish the basic gameplay on that one. Oddly it turns out the motivation I needed was buying a Game Boy Micro (wanted one partly for the novelty I think, but partly because it's really the most portable game system available and still plays a huge library of awesome games), and wanting to play my own game on it, so now I've got the basic port of the prototype done hopefully I will keep working on it with improvements that can be ported back to future versions...
 
  • Like
Reactions: 2 people
@Archerite No, that is not my site. Where did you get that idea from??!! lol

The """"wink wink"""", comes from the false sense of creating a library will give you more experience in game programming. At best you'll learn to code for a specific hardware, but until you create a lot of examples around Game AI, you'll learn very little. That's where the term comes from. I could say I am barely a game programmer even if I have reverse engineered TON of game code, including RISC4300i assemly, PPC, ARM, etc, because I know more or less the big picture, but subtle details, such as how a texture coordinate is applied between different hardware, regardless if OpenGL or similar API", or "how to draw particles using the 3D engine on the NintendoDS", which differs from ES Open GL 2.0 standards.

I've invested about 6 years in fully understanding C/C++ programming, from bottom up and after 6 years I can barely say I can create a 3D game. Part of that is I focused too much on the hardware things and very little from game development.

So if you have little time available, the best strategy is find something already baked, which compiles and works for you. That's my point.
 
  • Like
Reactions: 2 people
@Coto: The way you promoted that site in combination with the "wink wink" that was unrelated I guess. Sorry:shy:

It's true that just creating writing a library will not teach you anything about game programming, but I don't even remember saying that. Did I?:blush: What I have said more than once in my threads and blogs is that I have a weird kind of interest in gaming consoles and want to program on them. While Assembly is really cool, fast and awesome....writing a complex game in it as homebrew on my own is not something I see happening any time soon. I do really appreciate the link to the ASM library you gave me, so when I want to I can dive into it later. But to get started I just want to load a sprite into memory and show it on screen. The existing examples of libgba do not provide this...and that is what "pushed" me into this direction :unsure::D

I can confidently say I have experience from my "homebrew adventure" on multiple platforms (PC, Rpi, 3DS, Wii,Gamecube and PSP) that even have different architecture, speeds and API's and available RAM. What they do share for the most part is similar 3D capabilities and what I have done is create my own wrapper functions around their native API. That allows me to adopt a new system easily and the reasons my homebrew runs on many platforms already. The PSP is an exception as it's GPU requires a bit more work to setup...which is why that port is not finished yet.:blush:

In a way I have created my own abstraction to a native API on each system. Especially on the 3DS I had to dive DEEP into the source code of Citro2d and it's dependency libraries to figure out how textures are created and loaded. It took me 1,5 months to find the solution and not rely on pre-rendered graphics attached to my 3dsx file anymore. The reason why I kind of explained above but I do not own the rights to distribute the graphics, since it's a remake of an old game. The most difficult thing on the 3DS was the way textures need to be sorted in VRAM (using Z-ordering). If I had not written my own library I would have never known or learned about this :D

I feel like I am trying to find reasons to prove you wrong, but I am not.Really! I hope you're not offended by my explanation above as I am just trying to explain my reasons for going this route :) I understand your point about using something existing rather than reinventing the wheel. If libgba would have had as nice of a sprite API as libnds does I would not have cared to look into it I think. But since there is almost noting like it....and I would like to stay with devkitpro and libgba....there is not much else I could do.

My suspicions about the NDS and GBA being so much the same that I could just re-use stuff from libnds seems to be true!! I almost literally just copied in the code from libnds and disabled a bunch of lines and fixed some of the memory addresses etc.....but I think 80-90% is still the same code! The obvious stuff that's disabled is related to the bottom screen and some missing defines. With a lot of tweaking I did solve the errors and warnings enough to get the examples to compile and work just like on the DS (see my post for the screenshots and downloads :D) When I have more time I will clean up the code and make a fork on github to share it...eventually. IN it's current state is a perfect example of bad coding habits here and there :blush:

@Mythical : I am assuming you mean "libgba" right? The last few changes I see on github are just maintenance to keep it compiling with the latest devkitpro. It really lacks examples on how to use sprites and it does not even have functions to make this easier.

@hippy dave: I am curious what it looks like but if it's not ready for public yet that's fine too. :)I did release a few preview versions of my game on the platforms mentioned above, but the source code is not ready for release yet. It's too specific and messy to serve as an example :blush: I have thought really long about getting a micro...and it came in only a few days ago...so I know what you mean. I really LOVE that screen...too bad it's so tiny! It makes up in brightness and clarity for the short time I actually played on it so far.:D

I tried to keep it short....failed again!!:shy::rofl2:
 
  • Like
Reactions: 1 person
I'm gonna develop it a bit more before I put it out into the world, but you can google Cellephant if you want to see the old Pico-8 prototype in action. Fair warning - the music is loud!


What game are you remaking?
 
  • Like
Reactions: 1 person
Haha, found it here! Must have been awesome see people try your game and almost dismiss it as "not interesting" and then they keep playing it for 5 minutes! :DI almost did the same...sorry...but seeing them play and struggle gave me a good idea what the game is about. Looks really challenging and I will try it out later.

I am recreating a platform game that came out in 1998 called BatteryCheck. It's created using the same game engine as Jazz Jackrabbit 2 and the game files are almost identical. My remake is a game engine that loads these original files and it works on the platforms I mentioned. The main version is this one for the Wii and most discussion about my version is in there. There is a video review of the original PC version in the 4th post in that thread if you like to see it. or you could try out the Wii version yourself, instructions are provided. :)
 
  • Like
Reactions: 1 person
Thanks! Games about batteries are obviously the way forward B-) Couldn't watch the video as I'm on mobile data at the park, but I like a good puzzle platformer, will check it out later! I look forward to seeing it on GBA too :yay:
 
  • Like
Reactions: 1 person
@Archerite: I am not offended at all. But i'm stating DON'T waste too much time improving libraries... thanks to that 6 years have passed already, of wasted time. That's what I was saying.

Given I saw a very simple 2d demo you made in the other thread/blog. And all these things you mention points towards game dev anyway.
 
  • Like
Reactions: 1 person

Blog entry information

Author
Archerite
Views
2,173
Comments
28
Last update

More entries in Personal Blogs

More entries from Archerite

Share this entry

General chit-chat
Help Users
  • K3Nv2 @ K3Nv2:
    I don't care about the square screen it's just nice to hold something you don't have to stretch your arms a foots length
  • K3Nv2 @ K3Nv2:
    All these things expecting to be super huge is overrated just run a type c cable to your TV if you want a big display or in my case screen mirror it
  • BigOnYa @ BigOnYa:
    On the go tho I meant, I use my 10" tablet and a Bluetooth controller for retro gaming while sitting on my porch or on long car rides sometimes. Easier on my eyes than the Switch screen.
  • K3Nv2 @ K3Nv2:
    My point is we already have enough shit with big displays having something pocketable with up to ps2 would be fine on the go
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Ken unless the games are made for that screen size most suck on a screen that size... Having a square screen and being brighter and higher res helps but it's not a cure all, text is tiny bullets are tiny, your.... Well lol
  • K3Nv2 @ K3Nv2:
    You can stretch to fit probably it's not all bad that they make it seem to be
  • K3Nv2 @ K3Nv2:
    People always yap about oh but you loose pixels but yeah it won't look awful either
  • Psionic Roshambo @ Psionic Roshambo:
    I like filters :P
  • K3Nv2 @ K3Nv2:
    Filters are why you don't go on 2nd dates
  • Psionic Roshambo @ Psionic Roshambo:
    Lol nahhh it's because I usually get what they want on the first date lol
  • Psionic Roshambo @ Psionic Roshambo:
    I swear if I hear "I don't usually do this on the first date" on more time... I am going to start counting
  • K3Nv2 @ K3Nv2:
    I bought you McDonald's even tho you lied about your pics I still deserve this
  • Psionic Roshambo @ Psionic Roshambo:
    No no continue, I hear these things women say so often I decided to start counting
  • K3Nv2 @ K3Nv2:
    I tried that new Pepsi lime it just taste like pepsi
  • DTApple @ DTApple:
    With lime, right?
  • K3Nv2 @ K3Nv2:
    Just pepsi lol
  • K3Nv2 @ K3Nv2:
    Oh yeah it's D-Days 80th anniversary today
  • BigOnYa @ BigOnYa:
    I drink the Coke with lime all the time, in my Spiced rum (Captain Morgans) I hate pepsi
  • K3Nv2 @ K3Nv2:
    Probably better just to jizz a lime squeeze inside it
  • DinohScene @ DinohScene:
    volvic > anything else
  • K3Nv2 @ K3Nv2:
    My piss is water
    K3Nv2 @ K3Nv2: https://computers.woot.com/offers/linksys-dual-band-mesh-wifi-6-router-10?utm_medium=share&utm_so...