potatolain / nesnet

Networking library for the Nintendo NES
MIT License
21 stars 0 forks source link

socket io possible? #1

Open valdirSalgueiro opened 4 years ago

valdirSalgueiro commented 4 years ago

I dont have much experience with this kind of thing, but seeing that socket.io is the standard maybe it could have a example using it, if it is possible?

thanks and great work :D

potatolain commented 4 years ago

Hello!

I can’t say I’ve used socket.io much myself. I don’t support it out of the box right now, but it might be possible. Depending on what you’re doing, it might be easier to write a server that uses socket.io for browser clients, and some http endpoints for the NES library.

That said, do you have a specific project in mind you’d want to use this + socket.io for? I might be able to better recommend options if I understand what you need. I’d be very excited to help you use this!

valdirSalgueiro commented 4 years ago

Hi! thanks for the fast answer. I am working on a NES puzzle game with a small team, so maybe it is not the best suitable game for that, but the possibilities are very interesting :) i also did some testings alone with socket.io and even though i dont know the details thought it could be best suited for an action or even an rpg game because it should be more lightweight since it is more 'raw'?

potatolain commented 4 years ago

So, I looked into how socket.io works a bit. It would definitely be feasible to implement, but would likely be a lot of work. It would end up being a new separate C library, with a different firmware for the photon focused on socket.io. Thankfully there are some socket.io libraries for arduino that might be able to be adapted, so it wouldn't all be from scratch.

Right now, I don't have a ton of time to devote to creating that, so it's unlikely I'll support it/make a new library soon. That said, I do still think you could accomplish quite a bit in a puzzle game with the current library and a regular web server. (In node you could use expressjs, for example) You won't be able to use any popular js game libraries though, which I know will make it a little tougher.

When you get to the point of starting to build network play, let me know! I'd certainly be willing to give some guidance and help. (Or hey, maybe you'll convince me to spend some time with an awesome game)

Be warned I never made a great way to test this on emulators, so you're kind of stuck building the hardware and using a flash cart right now. Networking on the NES is a pretty bumpy road, but it can be an exciting one.

Good luck with your puzzle game!