Page 1 of 1

Best Way to Implement Multiplayer?

Posted: Thu Sep 10, 2020 11:21 pm
by Mr Coconut
Hi everyone,

What would you suggest is the best way to implement local play? (And wifi as well, if possible)

Thanks a lot!

Re: Best Way to Implement Multiplayer?

Posted: Fri Sep 11, 2020 5:05 am
by Ruffsta
i am strictly a 4.9 user.. so either James or DigitatalDesignDude - (DDD is strictly a 5.12 user) - could answer you better.. i did message James to respond to this... i don't know when or IF he will.. but maybe DDD will?

Re: Best Way to Implement Multiplayer?

Posted: Sat Sep 12, 2020 3:52 pm
by DigitalDesignDude
Welcome to the forum Mr. Coconut :)

Wish I could be of more help but I never attempted any sort of multiplayer implementation before.

Some of the more experienced Ds game maker users are on gbatemp still so you might get an answer there.

I believe not all the old users are aware of this new forum and fansite yet.

https://gbatemp.net/categories/nintendo ... ssions.37/

Re: Best Way to Implement Multiplayer?

Posted: Sat Sep 12, 2020 4:35 pm
by imadedsgamemaker
"Local play" here seems to mean "Download play". I only used it once in my life. I googled "devkitpro devkitarm download play" and found this: https://devkitpro.org/viewtopic.php?f=23&t=1686&p=3920

TLDR - I don't think it's possible. However, anecdotally, I do remember someone getting it working - but this is just a distant memory, and they may have implemented it over WiFi instead.

What I can talk a bit more about is WiFi. Trigger warning: you are going to need to be able to write C to get anywhere with this, and not trivial C. Whilst devkitARM supports the "internet stack" on the DS it does not give you any nice "high level" HTTP functions; for example, there isn't a nice "get the stuff at this URL" function. PAlib does try to make that possible here: https://sites.google.com/site/palibwiki ... als/day-20

But I wouldn't trust the PAlib wifi code as far as I could throw it. The best thing to do is to get into the PAlib source code and see what they are trying to do in those functions. Check out also "dsgmLib" (not related to DS Game Maker formally in any way) which has some WiFi functions and may have a WiFi example: https://github.com/CTurt/dsgmLib/tree/master/source

My high level advice would be this: make a decent, low latency http server that can manage game state (eg via a username), then have each DS join a game. Each DS could talk to each DS over LAN, but they would have to be on the same LAN (192.168.1.x, typically) and have to know each others' LAN IP address, which probably sucks for your players. Anyway, then go and learn how http requests are made as "plain text" (headers, content-length header, then the payload). My guess is that the PAlib functions assemble that HTTP "plain text" (headers + payload for you). If you send JSON back from your http server you will have to find a way to "parse" that on the DS as well. I don't think anybody in the world has ever parsed JSON on a DS, but there are definitely C libraries that will do that, but it will be difficult to compile them for the DS, and, probably painful to get it working in DSGM as well. So probably best to send some plain text back that's easy to parse eg "1,2,3" - then split that string into numbers, and convert to integers using C function 'atoi'.

In terms of building that http server, I'd recommend building it with node.js since it's super low latency, and deploy it on a digitalocean droplet, or on your own PC, then get the DS to talk to its LAN IP. You could make that server running locally availably globally without deploying to the cloud (digitalocean) through a free ngrok tunnel, but you would have to have your computer on all the time.

Finally, no clue how well the DS will deal with "new" https/ssl certificates, so best to run the whole thing over http rather than https. It will definitely make it quicker.

Re: Best Way to Implement Multiplayer?

Posted: Sun Sep 13, 2020 9:51 am
by Mr Coconut
Thank you everyone for all the help!
Most likely I'll go with wifi over local play (be it ds download or having two cards), as that seems simplest. Local servers will do fine for what I'm thinking of, so I'll begin reading up and experimenting with wifi connectivity on the DS.

Thanks again!