Author Topic: Internet Browser in FSO WIP (+Test builds)  (Read 15929 times)

0 Members and 1 Guest are viewing this topic.

Offline m!m

  • 211
Internet Browser in FSO WIP (+Test builds)
As some of you might know I've been working on integrating the chromium browser engine (or a framework specifically for embedding it) into FSO in an effort to be able to replace the current interface code.
It's far from being complete but I think that it is in a state which can be released for public testing, but first some screenshots:

Browsing HLP while shooting Cylons


Yes, WebGL works

Here are the links to the test builds, as the required libraries and files are quite big I have uploaded them separately so I don't need to update them with the builds.
Installing:
Test Builds: Download (dontcrashdontcrashdontcrashdontcrashdontcrash)
Required additional files: Download

You need both packages but once you have downloaded and unpacked the second package you will not need to download it again, even if the builds are updates. Place all files into the root of FSO while keeping the directory structure.

For those interested: Source code

Building:
Special thanks to ngld for getting these changes to build on linux and also for improving the building process on Windows.
  • To build, first clone the repository above and checkout the branch feature/chromiumInput. Make sure that you also clone the submodules, either by using --recursive while cloning or running git submodule update --init --recursive.
  • Then you need the CEF builds for your platform: http://cefbuilds.com/
    If you are on windows then use the 32-bit versions, FSO doesn't support 64-bit yet :p
    Any branch after and including 1750 should work, if you want the newest features then you can use the trunk builds but those may not work correctly.
  • Unpack the downloaded zip into a directory of your choice
  • Generate your project files using CMake (documentation)
  • You have to set the CEF_PATH variable to the directory where you just unpacked the zip
  • Windows only: If you are not using Visual Studio 2010 open the 3rdparty solution folder and in the properties of the libcef_dll_wrapper change the platform toolset to the one corresponding to the other projects
  • Build the project, you can use the install mechanics of CMake to install the binaries to a directory of your choice


Using the builds:
As chromium uses some resources even if it isn't being used I decided to have it disabled by default so mod that don't use it don't use more resources than necessary. For this I added an option to the game_settings.tbl.
After $FS2NetD port: you have the #CHROMIUM SETTINGS section which currently only has the $Enable Chromium: option which takes a boolean value to enable chromium. You will need this or else the browser won't work.
There are two ways of using the new capabilities:
  • Via lua, I have added the ba.createBrowser() function which will create a browser which can be used to draw the contents anywhere to the screen which includes other textures and probably also texture replacement on ships. Everything should be documented in the scripting documentation.
  • By replacing the state logic: I have added a system which allows to completely overwrite what FSO does in any state it may be in. Currently this only allows to create a fullscreen browser. Fullscreen browsers are different from browsers created by lua, they don't draw the contents to a texture but directly to the screen. This allows for drastic performance improvements for some pages, especially those using WebGL.
    This means that the system can't use the cursor set by FSO as that is overwritten by chromium but this is no problem as you can change the cursor image with CSS (see example package below).
Now let's see what you can do with all that, there is now a new table called states.tbl and the respective modular table *-sta.tbm. Here is an example of what you can do:
Code: (states.tbl) [Select]
#States

$State: GS_STATE_INITIAL_PLAYER_SELECT
+Type: HTML
+URL: http://fso/data/html/playerSelect.html

#End
$State takes a state name (documented on the wiki) and initializes custom logic for that state, currently there is only the type HTML. To configure which URL is used use the +URL option.

As you notice from the example above you can reference files of FSO by using the fso domain. The following path is the full path to the file you want to load relative to your mod directory.

Here is an example of what you can do with the player select screen: http://www.mediafire.com/download/8vcx13q70x1c9hd/browserTest.7z

You can also completely replace the default mainhall, here is an example: http://www.mediafire.com/download/xh2tm35aijm136c/mainhallTest.7z

To communicate with FSO from your JavaScript code there is the fsoApi object within the global scope which has three functions:
  • query: Starts a query for data, the player select example above used the only functions currently available
  • registerCallback: Can be used to call JavaScript code from FSO. Register a function that should be called and then execute that callback from Lua with browser.executeCallback. The function return a value which can be used to unregister the callback again.
  • unregisterCallback: Takes a return value from a previous call to registerCallback to remove that callback again.

I know that this information is a bit sparse but it's a WIP project so all this is subject to change.

Please test the builds, especially without any changes to your mod as I want to make sure that it works the same with unaltered data.

Thank you very much,
Regards,
m!m
« Last Edit: July 14, 2014, 03:07:25 am by m!m »

 

Offline Shivan Hunter

  • 210
  • FRED needs lambdas!
Re: Internet Browser in FSO WIP (+Test builds)
This is amazing (can't wait to see what Axem does with it!)

Also, EVE Online is no longer the only game I know of with an ingame web browser. suck it, goons :7

 

Offline General Battuta

  • Poe's Law In Action
  • 214
  • i wonder when my postcount will exceed my iq
Re: Internet Browser in FSO WIP (+Test builds)
Post doges

 

Offline Mongoose

  • Rikki-Tikki-Tavi
  • Global Moderator
  • 212
  • This brain for rent.
    • Minecraft
    • Steam
    • Something
Re: Internet Browser in FSO WIP (+Test builds)
This is both amazing and frightening.

(stop fapping there co-pilot)

 

Offline T-Man

  • 210
  • I came... I saw... I had a cuppa!
Re: Internet Browser in FSO WIP (+Test builds)
This does look bloody impressive I gotta say; have never even thought something like this was possible. My inner paranoid is worried about security issues (on the one hand AV/Firewalls on heavily protected PCs might throw hissy fits with FSO with lots of these running, on the other hand restricting the security to prevent that might leave big holes onto PCs; one troll with a hijacked file and cue chaos) but I know very little admittedly so they might turn out to be non-issues.

Regardless, this is truly amazing; no exaggeration. It will be fun to see what people create from this. :yes:

(stop fapping there co-pilot)
NO! Fie on you, what has been heard cannot be unheard! :shaking: :lol:
« Last Edit: March 20, 2014, 05:47:32 pm by T-Man »
Also goes by 'Murasaki-Tatsu' outside of Hard-Light

UEF fanboy. Rabid Imagination.

 

Offline Dragon

  • Citation needed
  • 212
  • The sky is the limit.
Re: Internet Browser in FSO WIP (+Test builds)
This is good and all, but does it have any practical applications? :)
Aside from posting testing feedback in real time (I suppose it'd be an improvement for me given that I'm now posting it in imaginary time :) ), I don't really see what an internet browser would be good for in FSO. It probably has some multiplayer implications, but I can't think off anything else.

 

Offline Axem

  • 211
Re: Internet Browser in FSO WIP (+Test builds)
The biggest would be a completely moddable interface. FreeSpace's out-of-mission interface is constrained to what retail was: made for 1024x768 resolutions, no way to change any of the buttons (unless you like mucking around with those mask files), and any custom interface would basically just be a skin.

But this would allow a custom interface (both out-of-mission and in-mission! (yes, hud gauges or in mission prompts)) to be made with HTML. It could scale intelligently to any resolution and aspect ratio. Add new interface screens, new buttons, new features. I mean so far its pretty much proof of concept, but there's a lot of potential.

 

Offline niffiwan

  • 211
  • Eluder Class
Re: Internet Browser in FSO WIP (+Test builds)
...My inner paranoid is worried about security issues...

I believe the intention is to disable access to the network in the final version, i.e. only be able to load data from the filesystem/disk. That should reduce the number of potential security issues.
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline Echelon9

  • 210
Re: Internet Browser in FSO WIP (+Test builds)
...My inner paranoid is worried about security issues...

I am of the view our network or table parsing code has more pressing security bugs than Chromium. Not that we shouldn't try to get those relentlessly out of the code base (cf work done with PVS-Studio, Clang/ASan, Coverity, Valgrind and MSVC Analyze), we should start with a realistic appreciation of the age of the code we inherited and that secure coding considerations weren't prevalent in late 1990s.
« Last Edit: March 22, 2014, 06:30:22 pm by Echelon9 »

 

Offline niffiwan

  • 211
  • Eluder Class
Re: Internet Browser in FSO WIP (+Test builds)
Indeed - I know there's a number of issues in the Coverity report related to accepting untrusted input from the disk or network.
Creating a fs2_open.log | Red Alert Bug = Hex Edit | MediaVPs 2014: Bigger HUD gauges | 32bit libs for 64bit Ubuntu
----
Debian Packages (testing/unstable): Freespace2 | wxLauncher
----
m|m: I think I'm suffering from Stockholm syndrome. Bmpman is starting to make sense and it's actually written reasonably well...

 

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: Internet Browser in FSO WIP (+Test builds)
... with HTML. It could scale intelligently to any resolution and aspect ratio. ....
as someone who has to work with html on a daily basis.... yeahno.
neither on the scale part nor the "intelligently" :p
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline m!m

  • 211
Re: Internet Browser in FSO WIP (+Test builds)
As that is currently a bit lacking here is a quick list of what this can be used for:
  • A new interface which can completely replace the old one. As WebGL works perfectly and also runs pretty fast even 3D Mainhalls are not impossible
  • Ship texture replacement. As the browser is rendered onto a FSO texture it can also be used for texture replacement.
  • Redone HUD gauges with none of the current limitations like bad looking fonts. SVG is also supported so you could replace the radar gauge with a HTML page that uses SVG images for the radar icons

The title of the thread may be a bit misleading but the intent is not to access the internet from FSO and some already have pointed out that every network access will be disabled by default. This also serves as a safeguard against using external resources which would make offline-play impossible.
« Last Edit: March 21, 2014, 05:43:36 am by m!m »

 

Offline T-Man

  • 210
  • I came... I saw... I had a cuppa!
Re: Internet Browser in FSO WIP (+Test builds)
Ah so the base concept is using it as an interface creator? That makes a lot of sense (sorry I got the wrong end of the stick). Definitely a lot of scope with a GUI system like that and the different programs you could run through it, and for all my fears the online possibilities could have some cool uses in the future so it's excellent having it there as a possibility.

But nah, all this is sounding excellent. :yes:
Also goes by 'Murasaki-Tatsu' outside of Hard-Light

UEF fanboy. Rabid Imagination.

 

Offline Shivan Hunter

  • 210
  • FRED needs lambdas!
Re: Internet Browser in FSO WIP (+Test builds)
... with HTML. It could scale intelligently to any resolution and aspect ratio. ....
as someone who has to work with html on a daily basis.... yeahno.
neither on the scale part nor the "intelligently" :p

~responsive web FS interface design~

  

Offline pecenipicek

  • Roast Chicken
  • 211
  • Powered by copious amounts of coffee and nicotine
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • PeceniPicek's own deviantart page
Re: Internet Browser in FSO WIP (+Test builds)
... with HTML. It could scale intelligently to any resolution and aspect ratio. ....
as someone who has to work with html on a daily basis.... yeahno.
neither on the scale part nor the "intelligently" :p

~responsive web FS interface design~
go die in a fire :p
Skype: vrganjko
Ho, ho, ho, to the bottle I go
to heal my heart and drown my woe!
Rain may fall and wind may blow,
and many miles be still to go,
but under a tall tree I will lie!

The Apocalypse Project needs YOU! - recruiting info thread.

 

Offline The Dagger

  • 29
  • I like zod ships
Re: Internet Browser in FSO WIP (+Test builds)
This looks very promisig indeed  :yes:.
However, I did found some strange behaviour. First, after the intro video FSO just stop for me. I thought it just crashed but if I Alt+Tab to get to Windows desktop and back to FSO I get a nice grass field in front of me (I guess it's a OpenGL example, really nice BTW). Also, I don't know if it's intended but I get duplicate chromiumprocess_3_7_1_SSE2.exe processes running according to Windows task manager.

 

Offline m!m

  • 211
Re: Internet Browser in FSO WIP (+Test builds)
:hopping: I though I fixed that!
Multiple chromium processes are intended, it's doing the same thing as Google chrome.

 

Offline m!m

  • 211
Re: Internet Browser in FSO WIP (+Test builds)
This looks very promisig indeed  :yes:.
However, I did found some strange behaviour. First, after the intro video FSO just stop for me. I thought it just crashed but if I Alt+Tab to get to Windows desktop and back to FSO I get a nice grass field in front of me (I guess it's a OpenGL example, really nice BTW). Also, I don't know if it's intended but I get duplicate chromiumprocess_3_7_1_SSE2.exe processes running according to Windows task manager.
I tried to reproduce your issue but I couldn't. I have encountered that problem and though I had fixed it. Just to be sure I uploaded new builds which are the same that I used for testing.

 

Offline The Dagger

  • 29
  • I like zod ships
Re: Internet Browser in FSO WIP (+Test builds)
I've just redownloaded the exe and it's still the same. Is there anything I could do to help you find the cause of the issue?

 

Offline m!m

  • 211
Re: Internet Browser in FSO WIP (+Test builds)
Just to confirm that it's the same bug I "fixed" earlier, can you try to run FSO in windowed mode?
If this can't be resolved, I will have to revert to another method which is slower and limits some functionality of the browser until we can fix this issue.