gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > Multiplayer ROM

#20779 - Pokimon - Mon May 17, 2004 7:42 pm

Hi every one ;)

Any body can help me in this category :

I want make a demo work in multiplayer and I was read GBATech document. But I have some questions:

like which mode i must use and can I test it on the emulator...

Please any one can help do.

#20780 - ScottLininger - Mon May 17, 2004 7:51 pm

No emulator that I know of supports multiplayer, which makes this kind of game a tremendous pain to test/debug. You can use any screen mode for multiplayer, if that's what you're asking.

What kind of equipment do you have? Hopefully you have at least 2 GBAs and some kind of flash cart?

If you want to build a multiboot game that runs multiplayer, you only need one cartridge, because the ROM can download to the slave GBAs via the link cable. If you are running a regular, non-multiboot ROM, then you'll need two cartridges.

You can download a simple demo of multiboot multiplayer from here:

http://www.thingker.com/gba/MultiplayerV1.zip

It took me a long time to get this all to work, so I hope it's helpful to you. I think Johnny North also has some multiplayer code he's willing to share -- do a search on the forums for multiplayer and you should find several threads.

-Scott

#20784 - dagamer34 - Mon May 17, 2004 9:55 pm

Yea, I had a tough time getting multiplayer to work with multiboot (1 cartridge, 2 GBAs). There is currently no publically available emulator that supports multiplayer. You could go look for a free version of No$GBA as it's supports it, but it is out of date, and only opens files less than 256KB. Hardware is the only way to test ROMs. This is why many of us stray away from multiplayer games.

The SGADE lib is a great place to find a working multiplayer module. Since I'm betting you might have 2 GBAs (or access to them) but not 2 flash carts, you are going to have to make the multiplayer module, "multiboot compatible" as I like to say. This will allow you to run a game from a flash cart, and then send a ROM over the cable, like many Nintendo games do (Advance Wars, Super Mario Series).

Sorry, I'm not sure where my code is. It's somewhere on my hard drive. I'll have to look for it. But I redesigned it to fit around my lib, so it would take some time to make generic code out of it. Good luck in your efforts!
_________________
Little kids and Playstation 2's don't mix. :(

#20796 - BeeWarloc - Tue May 18, 2004 12:52 am

Anyone that have looked at the implications yet of having an emulator communicating via a linker cable with a real gba? When looking at the GBATEK specification I don't see why it should be too hard to implement it (at least not supporting just SIO Normal Mode). But there might be some timing issues that I don't see..

We're also very lucky with the best gba emulators being open source :)

#20800 - dagamer34 - Tue May 18, 2004 1:59 am

Anything is possible. Few things are probable.

At least we should have emulator-to-emulator linking done first however, Forgotten, discouraged by the piracy associated with his emulator, refuses to put it in. And I, for one, think he is the only person who could put it in. Sure, it's possible for someone else to do it, but trying to put a new module in to someone else's code is a daunting task, and with multiplayer probably being the hardest thing to emulate correctly with all its checks, such an author probably could have written his own emulator by now. The GBA has been around for 3 years, so something should have come up that's available to all if it were to ever materialize.
_________________
Little kids and Playstation 2's don't mix. :(

#20801 - BeeWarloc - Tue May 18, 2004 2:56 am

That sounds like a challenge ;) But since It's only a week since I first looked at anything regarding gba development just a week ago, I should probably wait another week or two before taking it..

Looking at the vba sources I must say it's pretty clean.. The multiplayer hooks should probably be applied at src/GBA.cpp line 2621 (if you want to take a look). Serial communication could be sent via udp to a link server which is fast (enough?) and non blocking..

Even if emulator to emulator maybe should be done first, I actually think that's where the piracy issues applies the most, as it may make it possible to play games over the internet. However, there would also probably be latency issues with a pure "link cable gateway" over the Internet (most other emus sends over the keys pressed and sync info).

#20803 - tepples - Tue May 18, 2004 3:47 am

BeeWarloc wrote:
Looking at the vba sources I must say it's pretty clean.. The multiplayer hooks should probably be applied at src/GBA.cpp line 2621 (if you want to take a look). Serial communication could be sent via udp to a link server which is fast (enough?) and non blocking..

Given that the latency of even Ethernet exceeds what the GBA requires, an emulator that supports linking would probably have to emulate all four GBA systems on each machine (except for actually rendering video and sound) and then have the machines exchange keypresses.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#20805 - Miked0801 - Tue May 18, 2004 3:55 am

Yep - all Multiplayer code I've ever written is the button press per tic sent across the link type while keeping everyone else in perfect state sync. GBA comms. just suck :)

#20814 - BeeWarloc - Tue May 18, 2004 7:53 am

Well, it could be used for debugging purposes anyway, speed doesn't always matter..

I also think, if interfaced directly to a real gba via a linker, it wouldn't have quite the same speed penalties, even if it might make the emulator a little non responsive under heavy traffic (if using blocking IO, which would be the easiest alternative)..

I think this would be quite useful if someone decides to write a proper gdb stub (for the real hardware), and a serial IO library..

#20823 - Master Mofo - Tue May 18, 2004 1:20 pm

Pokimon: "like which mode i must use"

I think he also wants to know about the basics too. Actually I was hoping to know also because I'm trying to build a sample rom with 2 seperate roms. (Yes I do have 2 Carts) and I am confused about waht kind of approach I should use. This Master-Slave thing, does it matter? Can I ignore it and think about it as if both machines send and recieve data? I may set the Start bit when sending data, and wait for it to be reset when recieving. I appreciate any other info.

Thanks
_________________
"You have to finish what you have started"

#20825 - BeeWarloc - Tue May 18, 2004 1:56 pm

The way I understand it, in normal mode, one system have to be the master, and one system have to ne the slave, at any given time.

When using multiboot, this is easy, as the multiboot system will have the slave byte set, but with two carts there's no way to automatically detect which is the master and which is the slave.

One possible solution to this is to have a screen when the cart starts which says press A for master and B for slave.

After this is taken care of, the master should be exchanging data at a given rate (and the slave has to be ready for this transfer). Here the easiest thing would be to have a pre determined set of variables to exchange, but sometimes this is not feasible. If not other protocol might be used..

Gurus, correct me if anything of the above is wrong... :)

(btw, another ultimate challenge: write a tcp/ip stack for the gb ;)

#20826 - poslundc - Tue May 18, 2004 2:04 pm

BeeWarloc wrote:
(btw, another ultimate challenge: write a tcp/ip stack for the gb ;)


http://www.fivemouse.com/gba/

Dan.

#20829 - Pokimon - Tue May 18, 2004 2:46 pm

just to know (ScottLininger) and every body i have 2 GBA and 2flash carts this material i will work on it.

#20839 - DiscoStew - Tue May 18, 2004 5:20 pm

BeeWarloc wrote:
When using multiboot, this is easy, as the multiboot system will have the slave byte set, but with two carts there's no way to automatically detect which is the master and which is the slave.


I haven't done anything related to multiboot ROMs, but if I remember correctly, whichever GBA has the purple connection of the link cable inserted into the link port, that GBA is the master, and all others are slaves, in order of 1st, 2nd, and 3rd depending on their link order. This applies to the official Nintendo GBA link cable
_________________
DS - It's all about DiscoStew

#20886 - dagamer34 - Wed May 19, 2004 4:41 am

DiscoStew wrote:
BeeWarloc wrote:
When using multiboot, this is easy, as the multiboot system will have the slave byte set, but with two carts there's no way to automatically detect which is the master and which is the slave.


I haven't done anything related to multiboot ROMs, but if I remember correctly, whichever GBA has the purple connection of the link cable inserted into the link port, that GBA is the master, and all others are slaves, in order of 1st, 2nd, and 3rd depending on their link order. This applies to the official Nintendo GBA link cable

True. Don't use 3rd party cables for linking as they are not 100% accurate, especially for homwbrew stuff.
_________________
Little kids and Playstation 2's don't mix. :(