Live data from Hacker News

Show HN: Full Freeciv client running on WebAssembly

freecivweb.com

11–20 of 33 posts

Re: Show HN: Full Freeciv client running on WebAssembly

#11

I'm curious how human multiplayer works with webassembly. I assume it uses websockets, but how does the code hook into it? How does the original code compile?

Qt and emscripten took care of the bulk of it. Emscripten turns socket calls into websocket somewhat "transparently". The error handling is slightly different, but it only took minor code changes to get that working. More effort was involved in making the Qt event loop play nicely in the browser. Freeciv is based on a server-client model, we host servers that the wasm clients connect to via websockets.

Re: Show HN: Full Freeciv client running on WebAssembly

#13

I'm curious how human multiplayer works with webassembly. I assume it uses websockets, but how does the code hook into it? How does the original code compile?

Qt and emscripten took care of the bulk of it. Emscripten turns socket calls into websocket somewhat "transparently". The error handling is slightly different, but it only took minor code changes to get that working. More effort was involved in making the Qt event loop play nicely in the browser. Freeciv is based on a server-client model, we host servers that the wasm clients connect to via websockets.

> we host servers that the wasm clients connect to via websockets.

would it be possible to make this completely p2p so that another browser hosts the server and connect to it via webRTC style?

Re: Show HN: Full Freeciv client running on WebAssembly

#14
I've been playing Freeciv for years, but was disappointed that the pool of players was dwindling. A few of the members of the community stepped up to work on revitalizing the project. We decided to focus on WebAssembly to run on browsers, dropping support of the GTK+ and SDL clients in favor of the Qt client that we decided would make it easier to create a Wasm port, and eventual mobile apps. There's still a lot of UX tuning to do, but we wanted to put this out there today to get some early feedback.

Re: Show HN: Full Freeciv client running on WebAssembly

#15
post #13

Earlier quoted context omitted.

Qt and emscripten took care of the bulk of it. Emscripten turns socket calls into websocket somewhat "transparently". The error handling is slightly different, but it only took minor code changes to get that working. More effort was involved in making the Qt event loop play nicely in the browser. Freeciv is based on a server-client model, we host servers that the wasm clients connect to via websockets.

> we host servers that the wasm clients connect to via websockets. would it be possible to make this completely p2p so that another browser hosts the server and connect to it via webRTC style?

It should be possible, but it would take more invasive netcode changes to be able to handle webRTC. Emscripten does not do similar translation of socket calls to webRTC.

Re: Show HN: Full Freeciv client running on WebAssembly

#16

I've been playing Freeciv for years, but was disappointed that the pool of players was dwindling. A few of the members of the community stepped up to work on revitalizing the project. We decided to focus on WebAssembly to run on browsers, dropping support of the GTK+ and SDL clients in favor of the Qt client that we decided would make it easier to create a Wasm port, and eventual mobile apps. There's still a lot of U…

What kinds of games are being played? How is longturn? Regular multiplayer?

When I played some multiplayer freeciv, the playstyle was weird to say the least, a lot of early agression. Then I spectated a lot of the extreme island/race to stealth fighters games too.

Re: Show HN: Full Freeciv client running on WebAssembly

#17
post #9

Earlier quoted context omitted.

Freeciv is about 85% C: https://github.com/freeciv/freeciv

We have forked it and are allowing more C++, but it is still mostly C style. https://github.com/longturn/freeciv21

Who is "we" and what is the original freeciv project doing? Also alive?

Re: Show HN: Full Freeciv client running on WebAssembly

#18

Does not work on firefox

Admittedly we have not tested on firefox as much, but I suspect that is happening is that we have a race condition in waiting for the 30+MB package of wasm and data files to load.

This is impressive and shows a lot of dedication!

How are you hosting the site and assets?

Re: Show HN: Full Freeciv client running on WebAssembly

#19
Is this project related to freecivweb.org ? If so, how? If not, isn't there room for a fair amount of confusion there? What are the main differences from .org that players should be aware of?

Is there a FAQ somewhere? I couldn't see a link to any help or anything.

Re: Show HN: Full Freeciv client running on WebAssembly

#20
post #18

Earlier quoted context omitted.

Admittedly we have not tested on firefox as much, but I suspect that is happening is that we have a race condition in waiting for the 30+MB package of wasm and data files to load.

This is impressive and shows a lot of dedication! How are you hosting the site and assets?

Hetzner, with Cloudflare to do the CDN for such large game assets.
Post reply on HN