Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

WebGL effort

Information, contacts and source code for ports to Linux, Windows, etc.

Moderators: winston, another_commander

User avatar
Cody
Sharp Shooter Spam Assassin
Sharp Shooter Spam Assassin
Posts: 16073
Joined: Sat Jul 04, 2009 9:31 pm
Location: The Lizard's Claw
Contact:

Re: WebGL effort

Post by Cody »

timer wrote: Mon Apr 03, 2023 5:34 pm
Looks like some of the "oldies" are gone...
Many of the "oldies" are gone!
I would advise stilts for the quagmires, and camels for the snowy hills
And any survivors, their debts I will certainly pay. There's always a way!
User avatar
timer
---- E L I T E ----
---- E L I T E ----
Posts: 336
Joined: Sat Mar 17, 2012 8:26 pm
Location: Laenin spiv club
Contact:

Re: WebGL effort

Post by timer »

Cody wrote: Mon Apr 03, 2023 5:41 pm
timer wrote: Mon Apr 03, 2023 5:34 pm
Looks like some of the "oldies" are gone...
Many of the "oldies" are gone!
this breaks my heart... (((((

PS @0b1 sorry for offtop
Cobra MK III owner since 1994
User avatar
Cholmondely
Archivist
Archivist
Posts: 5122
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: WebGL effort

Post by Cholmondely »

timer wrote: Mon Apr 03, 2023 5:34 pm
@Cholmondely/@hiran suggested XMPP... maybe we could use that as a base? setup our server?
Hiran, not me. I was merely trying to help. And he only went for XMPP because I'm not on e-mail and that limited his options.

He was using the Debug Console to communicate between the games, and managed to do a fair amount:
* We sent e-mails to each other.
* We were able to leave goods for each other at various space stations.

* He was initially unable to allow us to fly/fight in the same game - but he had ideas for how to manage it.

*The project was mothballed because
(i) we could not find anybody else wishing to join in
(ii) problems rejigging my AppleMac debug console to allow it to communicate fully (unlike the Linux debug console which did!).
(iii) problems getting trunk versions for the AppleMac to test new versions of Oolite which allowed better multi-player communications

Hiran was very helpful and was able to talk me through the programming on my computer which needed doing (and cope with all my stupid mistakes)!
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
0b1
Above Average
Above Average
Posts: 22
Joined: Thu Mar 09, 2023 3:14 pm

Re: WebGL effort

Post by 0b1 »

Very encouraging!

Timer: the ZX80, I remember it fondly. Ah, for the days of the 8-bit micro!

One of the reasons I'm looking at the web approach is because it's cross-platform right away. Once I'd fixed my WebGL buffers, my Obelite POC ran on my Windows PC (Ege, FF, Chrome), on my new Mac, and my Android phone. In the past 3-5 years browsers have finally reached parity, and JS has become a powerful, OO language in its own right. Much of the objective C in OOlite is not needed because JS and the browser do it for us. The real question is, could a browser's memory support an interactive multiplayer dogfight with many ships, in proximity to a star or planet? I think it could because, in space, distances are big and few ships in the viewscreen need to be displayed at a full LOD. I also think it's possible to render stars and planets as billboards, drastically cutting the polygon count, but I'm not 100% sure yet.

One thing that came out of COVID is that WebRTC because a ubiquitous browser standard due to the rise in video conferencing. Other than some form of registration board, it's peer-to-peer so it doesn't need a huge infrastructure. It can transfer video, and just about any kind of data from one computer to others (or to multiple) and handles most of the logic under the hood. But it would need infrastructure, and that needs $ and admin. I've spent some time with Web Sockets, and it's a similar - if more feature-rich - technology.

Browsers give us WebGL, of course, and that cuts down on the amount of code to write. We still need shaders, physics, collision detection, etc., but most of the communication with the Graphics card - or the need to account for different drivers - has been abstracted away by WebGL (provided we stick with core features)

Browsers also give us the DOM, forms and styling, for all the non-flight game screens (or text overlays): if you know HTML, CSS, and JS, it's much easier to write - and write reusably. Traditionally browsers have not been used for games because of the different levels of compatibility, but in the past few years, they have much more closely aligned with standards and something that renders on one browser can reasonably be expected to render the same on another. There are still some variations, but not much.

The bottom line is that a browser is now a well-equipped real time media delivery platform, with a lot of advantages that massively cuts down on the amount of code needed to make a complex game work.

As for ads, I agree it is a sensitive topic, especially in a game that's supposed to be Open Source. But the ads could be as simple as "donate" buttons so we can get funds to pay for the infrastructure we'd need for multiplayer. Or videos that play on the face of the station as you are docking. Unless anyone has a rich uncle, or possibly nephew we can get an up-front donation from.

The question is, are there enough of us left to warrant the effort? With the amount of OXP contributors Oolite has had over the years, there are a lot of skillful people out there somewhere.

I can handle most of the coding (although Shaders are a bit of a learning curve) but I have the artistic skills of a myopic slug and not a huge amount of leftover time.

But Elite was such a groundbreaker when it was built, I also feel we have to carry the torch a little further. I beta-backed and played Elite Dangerous. As games go, it was fine. I liked the more realistic distances, expanded roles, and ship maneuvering, but overall there was something unsatisfying about it. Maybe too many features and not enough playability? It was multiplayer, but I never ever met anyone else in the game! It was more than that though - I cannot quite put my finger on it. Perhaps I'm overconfident, but I suspect between the Oolite approach and the ideas in the OXPs there's a better game to be built.
User avatar
0b1
Above Average
Above Average
Posts: 22
Joined: Thu Mar 09, 2023 3:14 pm

Re: WebGL effort

Post by 0b1 »

I was finally able to make some headway - got the commodities screen working.
Image

For the time being, you can get to it (for any system) from the Galactic Chart:
Image

As always, the "playable" demo is auto-published to Github Pages:
https://0bone.github.io/obelite/src/

Thanks to the authors of generator.py and planets.c for helping me get the pricing algorithm right (I will provide proper attribution when I backtrack these files!) -- with an additional bonus: working, accurate goat soup :D . Thanks also to Cholmondley for pointing me in the right direction.

I went with buy/sell buttons for now, for simplicity, and dabbled with json-based elements/styles that configure custom autonomous HTML elements to cut down on the number of disparate languages(no CSS, no HTML), making use of newer element types such as flex and grid. Mostly works on the main four browsers, Mac M2, Android, Windows. I don't have an iPhone to test on, but maybe eventually I'll get one.

Fixed:
- GL Buffer issue causing ships to render with one-another's textures.

Current bugs:
- Stations do not fully render in the Ship Library
- Chart is not working on FireFox (offscreencanvas issues)
- Let me know about all the others

Roadmap (more of a bike trail sketched on a napkin):
- Move PRNG-generatable data out of yaml into code logic
- Sundry screens: load/save commander, manifest, etc.
- Experimental procedural/LOD ship generator *might* be progressed
- Better rotation animators for ships, planets and other bodies
- Fix station rendering
- Planet atmosphere and mercator-puckeration-fixing
- Star generator/renderer
- Random asteroid generator/renderer
- Skybox + nebulae generator
- Almost last, but not least, flight mode, dust, physics, etc.

Eventually, game AI, enemy generation, weapons, missions, pluggable modules, multiplayer, and so on
User avatar
timer
---- E L I T E ----
---- E L I T E ----
Posts: 336
Joined: Sat Mar 17, 2012 8:26 pm
Location: Laenin spiv club
Contact:

Re: WebGL effort

Post by timer »

Right On, Commander!
Cobra MK III owner since 1994
User avatar
0b1
Above Average
Above Average
Posts: 22
Joined: Thu Mar 09, 2023 3:14 pm

Re: WebGL effort

Post by 0b1 »

:lol: :lol: :lol:
User avatar
Cholmondely
Archivist
Archivist
Posts: 5122
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: WebGL effort

Post by Cholmondely »

Alas, the System Atlas does not appear on the page on my trusty AppleMac (using Waterfox). So I can't access your F8 commodities screens.

Otherwise, it works (excepting a prolonged wait for the display of the various items in the ship's library, and your somewhat surreal take on the stations)!

Edited to add - just tried Safari. Nothing. your link above leads to a blank page with nothing on it.
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
0b1
Above Average
Above Average
Posts: 22
Joined: Thu Mar 09, 2023 3:14 pm

Re: WebGL effort

Post by 0b1 »

Thanks for testing, Cholmondley,

Mostly, I am testing on Chrome until I am further along and have proven the browser is capable of the performance needed for flight mode + combat.

For Safari, idky the same link would come up blank, unless there's a JS error somewhere.
if you get time, try https://0bone.github.io/obelite/src/index.html
In the meantime, I will try on my mac and see if I can replicate it.

It transpires Firefox is not compliant with the standards - it doesn't support OffscreenCanvas out of the box, and even if you enable it in the settings, it doesn't have the same methods as other browsers. I will have to downgrade to a hidden CANVAS element to bring FF back into play.
I'm just glad Internet Exploder is no longer on the list of browsers!!

I am spoiled by my high-performance gaming laptop & mac. On all of my devices, including my Android phone, ship library load time is under half a second, so it's hard to replicate the issue. I wouldn't mind seeing some F12 network timings that reflects your experience. that would tell me if its download size/speed, buffer conversion performance, or a mixture. If the problem is prevalent I may have to rethink the ship definition format, which is a bit wordier than I'd hoped:
https://0bone.github.io/obelite/src/dat ... model.yaml
User avatar
0b1
Above Average
Above Average
Posts: 22
Joined: Thu Mar 09, 2023 3:14 pm

Re: WebGL effort

Post by 0b1 »

Image

..stations not quite there, but much better!
User avatar
timer
---- E L I T E ----
---- E L I T E ----
Posts: 336
Joined: Sat Mar 17, 2012 8:26 pm
Location: Laenin spiv club
Contact:

Re: WebGL effort

Post by timer »

0b1 wrote: Fri Apr 28, 2023 9:50 am
..stations not quite there, but much better!
visible progress! )
Cobra MK III owner since 1994
User avatar
Cholmondely
Archivist
Archivist
Posts: 5122
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: WebGL effort

Post by Cholmondely »

Getting there! RH seems fine, and the stations are improved. They looked utterly surreal before.

More power to your elbows!
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
0b1
Above Average
Above Average
Posts: 22
Joined: Thu Mar 09, 2023 3:14 pm

Re: WebGL effort

Post by 0b1 »

Thanks!
Just made another update.
The star chart should be fixed on Firefox. Shame on them for disabling the offscreen canvas by default! I had to polyfill, which I said I wasn't going to do. Ah well, never say never.

Station docks are now aligned, and the stations rotate more authentically.
Wondering if I should tackle star generation next
User avatar
Cholmondely
Archivist
Archivist
Posts: 5122
Joined: Tue Jul 07, 2020 11:00 am
Location: The Delightful Domains of His Most Britannic Majesty (industrial? agricultural? mainly anything?)
Contact:

Re: WebGL effort

Post by Cholmondely »

0b1 wrote: Sun Apr 30, 2023 7:18 am
Thanks!
Just made another update.
The star chart should be fixed on Firefox. Shame on them for disabling the offscreen canvas by default! I had to polyfill, which I said I wasn't going to do. Ah well, never say never.

Station docks are now aligned, and the stations rotate more authentically.
Wondering if I should tackle star generation next
Well done - your stations look good on my AppleMac!

As regards the Galactic Chart, I'm getting no system information, and just the first line (food) for the commodities market. Should I be waiting longer, like I do for the ships/stations in the ship's library?
Comments wanted:
Missing OXPs? What do you think is missing?
Lore: The economics of ship building How many built for Aronar?
Lore: The Space Traders Flight Training Manual: Cowell & MgRath Do you agree with Redspear?
User avatar
0b1
Above Average
Above Average
Posts: 22
Joined: Thu Mar 09, 2023 3:14 pm

Re: WebGL effort

Post by 0b1 »

The commodities yaml is tiny compared to a ship mesh, and should load quickly (and in one go).

What system had you selected?
What browser/version were you using when you experienced the issue?
Are you able to F12 to open the debugger, go to 'console' and see if an error message is present?
Post Reply