Let's move freeorion from C to HTML5/JS/Canvas/WebSockets

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
User avatar
afwbkbc
Pupating Mass
Posts: 96
Joined: Tue Mar 14, 2017 10:47 am

Let's move freeorion from C to HTML5/JS/Canvas/WebSockets

#1 Post by afwbkbc »

So, why not?
I clearly see numerous advantages of this:
1) no need to compile, just download and play
2) freeorion client can be ran from external webserver, so no need to even download
3) crossplatformity/portability guaranteed by browsers
4) FPS increase (canvas is really fast in modern browsers, unlike current UI)
5) no need to have ugly python scripts and having to parse them in C - loading js script by js engine is dead simple
6) development speed increase (js is simpler language, also no need to recompile = huge boost)
7) no memory bugs will be possible anymore (only if there's bug in browser, but it will be fixed by browser maintainers anyway)
8) easier to participate in development for newcomers (js is easier to use)

Disadvantages?
1) some initial effort needed to migrate

So, let's discuss.

User avatar
L29Ah
Space Squid
Posts: 84
Joined: Thu Oct 06, 2016 3:19 pm

Re: Let's move freeorion from C to HTML5/JS/Canvas/WebSocket

#2 Post by L29Ah »

afwbkbc wrote:4) FPS increase (canvas is really fast in modern browsers, unlike current UI)
6) development speed increase (js is simpler language, also no need to recompile = huge boost)
Good joke // fuck off.
Team S.M.A.C.: play multiplayer with us!

User avatar
afwbkbc
Pupating Mass
Posts: 96
Joined: Tue Mar 14, 2017 10:47 am

Re: Let's move freeorion from C to HTML5/JS/Canvas/WebSocket

#3 Post by afwbkbc »

L29Ah wrote:
afwbkbc wrote:4) FPS increase (canvas is really fast in modern browsers, unlike current UI)
6) development speed increase (js is simpler language, also no need to recompile = huge boost)
Good joke // fuck off.
Please be constructive.

o01eg
Programmer
Posts: 2004
Joined: Sat Dec 10, 2011 5:46 am

Re: Let's move freeorion from C to HTML5/JS/Canvas/WebSocket

#4 Post by o01eg »

You are welcome to implement it.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-03-15.b3de094.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

User avatar
afwbkbc
Pupating Mass
Posts: 96
Joined: Tue Mar 14, 2017 10:47 am

Re: Let's move freeorion from C to HTML5/JS/Canvas/WebSocket

#5 Post by afwbkbc »

o01eg wrote:You are welcome to implement it.
There is no point to implement it until core developers agree to move this path. If freeorion-js will have to be constantly patched to match updates in C or python scripts (forever) - maintenance overhead will easily outweight the benefits. So, I need developers' assurance that they will consider continuing development in js (and drop C/python) after its implemented initially.

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Let's move freeorion from C to HTML5/JS/Canvas/WebSocket

#6 Post by Vezzra »

afwbkbc wrote:There is no point to implement it until core developers agree to move this path.
The lack of any comments by said core devs should already give an indication about how seriously they take this proposal.

Without going into detail wrt to all the points you see as advantages (judging by your past ideas and the following discussions you very obviously assess things very differently than the rest of us does), I'm only going to refer to this: you practically ask us to throw out the entire codebase and reimplement everything from scratch in another programming language. The effort of which you assume to be:
afwbkbc wrote:some initial effort needed to migrate
Which, IMHO, is so far out of touch with reality it isn't funny anymore. Some initial effort - seriously???

So, to spare you wasting your time: not going to happen. Sorry.

User avatar
afwbkbc
Pupating Mass
Posts: 96
Joined: Tue Mar 14, 2017 10:47 am

Re: Let's move freeorion from C to HTML5/JS/Canvas/WebSocket

#7 Post by afwbkbc »

you practically ask us to throw out the entire codebase and reimplement everything from scratch
Not really. Existing codebase already have all algorithms and game logic ready, we just need to copy these algorithms and logic to js (so no need to invent or design anything). Well, maybe there are some exceptions, but overall copying existing product is far easier than creating something out of nothing.
And there are lots of C++ to JS compilers available which we can use for initial migration.
And we can also reuse all existing art and sounds, which saves TONS of time.
Some initial effort - seriously???
Well, maybe a week.
Let's imagine I do it, will we continue developing (new features, etc) on JS after that?

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: Let's move freeorion from C to HTML5/JS/Canvas/WebSocket

#8 Post by Vezzra »

afwbkbc wrote:Existing codebase already have all algorithms and game logic ready, we just need to copy these algorithms and logic to js
You essentially want to convert FO into a browser game. Implementation something as a browser app is, let's say, somewhat different from implementing the same thing as a traditional C program. So "just need to copy these algorithms and logic to js" probably isn't going to cut it - at all.

I expect you to diagree on that assessment, but I guess we'll have to settle for agreeing to disagree at this point.
And there are lots of C++ to JS compilers available which we can use for initial migration.
I don't think they'll work for a program as complex as FO.
And we can also reuse all existing art and sounds, which saves TONS of time.
Even if we had to, these would be the least of my concerns.
Well, maybe a week.
A week. You seriously expect we could turn FO into a browser game within a week. Don't be offended, but... to me that sounds utterly insane.

To put it more mildly: I think your estimation to be far off the mark.
Let's imagine I do it, will we continue developing (new features, etc) on JS after that?
Well, a long answer would require discussing the various points you list in favor of such a change, and seeing how far different our assessments are on already quite simple things I don't have the time and nerves to go through that with you. I already know the outcome: we'll have to agree to disagree. So I'm just giving the short answer: no. If anyone of the core devs disagrees with my decision, they may speak up. Not that I expect any of them to actually do that...

Just a simple question, out of curiosity: you do know that there are a lot of applications/programs out there (actually, AFAIK, it's the majority), which are not implemented as browser apps in HTML5/JS, right? If you believe JS to be so universally superior, have you ever wondered why...?

jollasims
Space Krill
Posts: 1
Joined: Fri Aug 25, 2017 7:04 pm

Re: Let's move freeorion from C to HTML5/JS/Canvas/WebSocket

#9 Post by jollasims »

Have to agree with Vezzra that there has to be a consensus among core developers to migrate the project. But I agree with you that JS has a lower leaning curve than C and maybe more developers can contribute to the project. However, just because a language is inherently easier does not make it inherently good.

o01eg
Programmer
Posts: 2004
Joined: Sat Dec 10, 2011 5:46 am

Re: Let's move freeorion from C to HTML5/JS/Canvas/WebSocket

#10 Post by o01eg »

There are possible to write web-server-2-freeorion-client proxy same way it done in freeciv-web.
Gentoo Linux x64, gcc-11.2, boost-1.78.0
Ubuntu Server 22.04 x64, gcc-12, boost-1.74.0
Welcome to the slow multiplayer game at freeorion-lt.dedyn.io.Version 2024-03-15.b3de094.
Donations're welcome:BTC:bc1q007qldm6eppqcukewtfkfcj0naut9njj7audnm

Ophiuchus
Programmer
Posts: 3433
Joined: Tue Sep 30, 2014 10:01 am
Location: Wall IV

Re: Let's move freeorion from C to HTML5/JS/Canvas/WebSocket

#11 Post by Ophiuchus »

I dont think it makes sense to reimplement freeorion server in js.

That said it would be a nice project for somebody learning programming the web stack to implement a freeorion client in html/js.
(I also understand that none of the current devs would work on it.)

The main project maybe would need to work on the communication protocol between client and server, but that probably would be a good thing.

One could start without graphics but giving only a minimal or textual representation.
  1. connect with freeorion server
  2. get the client gamestate and show some info (or other empire wide info like PP/RP)
  3. show the research queue
  4. list the systems and their planets and their info
  5. add some actions
  6. make it complete ;)
another even smaller project which would be very useful could be a html interface for the encyclopedia, we could put it on the project homepage, or one could use a tab next to the computer to look up stuff.

@afwbkbc are you interesting in learning programming? (or you know someone who is?) you could team up with one of your buddys and start this as a project. I/we could help with the connection to the server and you might find a local hacker space or programming meetup for guidance.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.

Look, ma... four combat bouts!

User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Re: Let's move freeorion from C to HTML5/JS/Canvas/WebSocket

#12 Post by The Silent One »

Ophiuchus wrote:@afwbkbc are you interesting in learning programming? (or you know someone who is?) you could team up with one of your buddys and start this as a project. I/we could help with the connection to the server and you might find a local hacker space or programming meetup for guidance.
afw... is a troll who was banned afaik. He only made mock proposals and never contributed anything of value. Don't waste your time on him :)
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

Post Reply