WiFi in DS Game Maker

Show us what you're making.

Re: WiFi in DS Game Maker

Postby WillWill56 » June 21st, 2013, 11:42 am

You're correct about the C part, I dunno about C99, but it's running on Linux. Mainly because the server I use for hosting all of my stuff is a Linux server, but also because it's a little simpler coding C for Linux than for Windows, or something.

Sending a struct is fairly difficult, thanks to padding and other compiler-specific things, and also if it has arrays or pointers in it and/or can vary in size. Storing data as a struct is fine, but when it comes to sending it, I find it's best to serialise each variable in the struct (or even just the important variables) one by one into something like a char array. And not in a human readable format like a string, but in the way that an integer will take up 4 chars.

I've sorted out basically all of the server requests and some of the server responses, just working on the best way to format server responses that contain a list of things e.g. game rooms or players. I've got an idea how to do it though, just need to get it down in code.
WillWill56
 
Posts: 152
Joined: April 15th, 2011, 3:02 pm

Re: WiFi in DS Game Maker

Postby WillWill56 » June 21st, 2013, 4:54 pm

Oh, I don't remember ever using C++? The last code snippet I posted (http://pastebin.com/MVEUZrQg) was in C, just using a lot of structs and magic.

Okay, I lied about the magic.

Here's some source files I've mostly finished for you to look at anyway. It's just to do with data. When you get the chance, you can just extract it to a folder on Linux and run 'make' (probably).
SomeCode.zip
(9.24 KiB) Downloaded 281 times


I'll post the network-related source files when I've got a working version :P.
WillWill56
 
Posts: 152
Joined: April 15th, 2011, 3:02 pm

Re: WiFi in DS Game Maker

Postby JanMulder » June 23rd, 2013, 6:33 pm

I remember making the server was the hardest part. Our local network is kind of complicated, so that didn't help either. However, I know I managed to make it work one way. Unfortunately the opposite direction didn't work. The DS's didn't seem to both send and receive. Or the server didn't seem to send or receive both DS's data.

If needed, I might be able to help. Too bad I'm not able to run a server at my place.
here and yet not here
JanMulder
 
Posts: 738
Joined: December 30th, 2010, 3:08 pm

Re: WiFi in DS Game Maker

Postby WillWill56 » June 25th, 2013, 2:51 pm

I did get a simple 2 player version of MPDots working using a server in between two DSs (which meant no port forwarding :grin:). The server was just a simple C socket demo that I copy-pasted off a website. Both sending and recieving were working perfectly fine, but thanks to timezones or something, I never got the chance to test it with any DSGM members. The server is probably still running if you're interested. More than two players at once will result in undefined behaviour though, so don't all jump on at once.

I've nearly got the first working version of the new server sorted. I did some very brief documentation on the format of command inputs/outputs so I could focus on actually coding them. Once I get it working, there's the DS side of things, and I think predictable server responses will come in handy.

I really want to see this server up and running, and being the one making it, I have to make sure I'm actually working on it and not just sitting there thinking about when it's finally finished.
WillWill56
 
Posts: 152
Joined: April 15th, 2011, 3:02 pm

Re: WiFi in DS Game Maker

Postby BLsquared » June 25th, 2013, 3:11 pm

Sounds like you've got it all worked out. Great job.
You may call me BLsquared, Commodore, or TexasBatman. Preferably BLsquared.
My avatar was made by this guy: http://christianmanga.com/smf/index.php ... bum;in=374

"Every puzzle has an answer." - Professor Layton
"In war, there is indeed no substitute for victory." - Douglas MacArthur
"Love and Peace!" - Vash the Stampede
"It's High Noon!" - McCree
Member of Memefefe's Squad
User avatar
BLsquared
 
Posts: 997
Joined: August 10th, 2011, 4:39 pm
Location: United States of America

Re: WiFi in DS Game Maker

Postby WillWill56 » July 2nd, 2013, 9:50 am

Gah, so close! Just a few more little things and the alpha version of the server could be complete!

Also, I just used "LoopUser->CurrentGameRoom->Owner->Socket" as a variable. It's perfectly fine, but it kinda hurts my brain...
WillWill56
 
Posts: 152
Joined: April 15th, 2011, 3:02 pm

Re: WiFi in DS Game Maker

Postby WillWill56 » July 2nd, 2013, 3:39 pm

Oh, uh... it, um, it compiled. I... um... what do I do? :shock:

I did promise all the sauce when I had a working version. I dunno if (compiling == working) but here, have a peek anyway. It's a very messy alpha version, with at least one feature left unimplemented and a lot of room for improvement, but all the basics are there.

I just ran the freshly compiled server and it seems to handle raw socket connections and disconnections without crashing.

Edit: Updated with non-segfaulting version of server.
Attachments
MultiplayerServer.zip
(20 KiB) Downloaded 228 times
Last edited by WillWill56 on July 4th, 2013, 10:19 pm, edited 1 time in total.
WillWill56
 
Posts: 152
Joined: April 15th, 2011, 3:02 pm

Re: WiFi in DS Game Maker

Postby WillWill56 » July 3rd, 2013, 12:15 pm

Happily working away on a little demo in DSGM to test out the newly made server, I decide to compile it.

Le wild "Length cannot be less than zero" error appears.

Edit: Nevermind.
WillWill56
 
Posts: 152
Joined: April 15th, 2011, 3:02 pm

Re: WiFi in DS Game Maker

Postby WillWill56 » July 3rd, 2013, 3:38 pm

So I've made a nice little demo, and it works great. It connects to the server, performs a handshake, sends its username (from the DS's settings), and receives its UID.

The problem comes when the demo requests a global user list. The demo does the request fine, but then the server segfaults. But hey, it's an alpha, it's not like this was unexpected.

Unfortunately I'm off to the Simpson Desert (Australia) tomorrow, and will be gone for about two weeks, so this is kinda frustrating. I wanted to have a little demo where you could all connect to the server and see a list of each other's usernames and UIDs while I was gone. Oh well.

After I get back, I think I'll have about two weeks to fix whatever I've screwed up with the user listing functions of the server.
WillWill56
 
Posts: 152
Joined: April 15th, 2011, 3:02 pm

Re: WiFi in DS Game Maker

Postby WillWill56 » July 3rd, 2013, 5:51 pm

Oh wow. Fixed that bug pretty quickly. Less compiler warnings as a bonus. And the demo works properly.

Well, kind of. It seems another bug has just made itself known. Eh, too tired.

Edit: Updated the sauce post with the version of the server that doesn't segfault.
WillWill56
 
Posts: 152
Joined: April 15th, 2011, 3:02 pm

Re: WiFi in DS Game Maker

Postby WillWill56 » July 16th, 2013, 12:27 am

YoshiInAVoid wrote:Never mind (not that anyone ever minded in the first place), I fixed it.


I would've minded, had I had mobile reception sooner...

I wouldn't mind hearing that solution, as the problem went away when I put a server between the two DSs, and it would be nice to make sure that the problem never returns.
WillWill56
 
Posts: 152
Joined: April 15th, 2011, 3:02 pm

Re: WiFi in DS Game Maker

Postby WillWill56 » July 17th, 2013, 9:05 am

I'm back from my random trip to the Simpson Desert, and I'm making progress on the user list demo, one bug at a time.

Here's a rather interesting excerpt from the server output:
Code: Select all
New connection from 10.1.1.13 on socket 12
WillWill56 performed a handshake
Listing 10 users:
UID: 0 Name: Server
UID: 1 Name: liliana
UID: 2 Name: liliana
UID: 3 Name: liliana
UID: 4 Name: liliana
UID: 5 Name: WillWill56
UID: 6 Name: WillWill56
UID: 7 Name: WillWill56
UID: 8 Name: WillWill56
UID: 9 Name: WillWill56
WillWill56
 
Posts: 152
Joined: April 15th, 2011, 3:02 pm

Re: WiFi in DS Game Maker

Postby boe6eod7nty » July 17th, 2013, 1:34 pm

9 users from 2 DS's? (excluding the server) why is that?
that akward moment when somthing akward happens.....
wait.....
what?
boe6eod7nty
 
Posts: 209
Joined: September 11th, 2012, 4:28 pm
Location: USA. WI.

Re: WiFi in DS Game Maker

Postby boe6eod7nty » July 17th, 2013, 8:57 pm

ohh okay, lol, i was just wondering if i could learn anything simple quickly :D
but prob. shouldn't expect much, considering that this is WIFI in DSGM, and i'm just learning basic C, lol
that akward moment when somthing akward happens.....
wait.....
what?
boe6eod7nty
 
Posts: 209
Joined: September 11th, 2012, 4:28 pm
Location: USA. WI.

Re: WiFi in DS Game Maker

Postby WillWill56 » July 18th, 2013, 5:20 am

Fixed the last known server bug. Hooray! Now to find out why the DS demo client keeps disconnecting after a random number of user list requests...

The server handles disconnection just fine, except for when you press the power button on your DS out of curiousity and/or laziness, which is how I got the server to think there were 9 users (they don't have to be DSes...). I might need to add some kind of idle timeout at some point.
WillWill56
 
Posts: 152
Joined: April 15th, 2011, 3:02 pm

Re: WiFi in DS Game Maker

Postby DaPorkchop » April 26th, 2015, 7:13 am

No downloads for the demo anymore... sad. :(
User avatar
DaPorkchop
 
Posts: 2
Joined: April 26th, 2015, 7:07 am

Previous

Return to Work In Progress

Who is online

Users browsing this forum: No registered users and 1 guest

cron