Author Topic: nwncx webkit  (Read 10747 times)

Legacy__Cyan_

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
nwncx webkit
« Reply #15 on: February 09, 2016, 08:04:45 pm »


               


That is cool! If only there was nwncx for Linux...





Port could be done as it doesn't rely too much on nwn symbols, most are opengl and netlayer could be done hooking directly on socket.


               
               

               
            

Legacy__Cyan_

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
nwncx webkit
« Reply #16 on: February 25, 2016, 10:14:59 am »


               

I am not dead, i am going to fork nwncx on git as fast as i can.


I have some issue with CNWMessage on server side on windows (it works but nwserver crashes when all players log out).



               
               

               
            

Legacy__Cyan_

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
nwncx webkit
« Reply #17 on: February 25, 2016, 09:49:55 pm »


               

Here you go, this is the client plugin, in the next days ill'post my test plugin to handle gui messages on nwnx (some issues to be fixed first).


The plugin is not stable and the code need to be optimized and find better ways to do something.


https://github.com/S...c/plugins/webui



               
               

               
            

Legacy__Cyan_

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
nwncx webkit
« Reply #18 on: March 02, 2016, 09:29:34 pm »


               

https://github.com/S...gins/webui/Demo


UPDATE :


I added a zip containing precompiled binaries and a demo module plus awesomium binaries (for convenience) and a basic htmlui using jquery (also included in the archive).


The plugins on the archive are :


- nwncx_webui (the client plugin for nwncx)

- nwnx_webui (a demo plugin i made to make the gui share data between client and nwserver).


The server plugin is unstable and is just a demo, it may cause nwserver to crash.


 SETUP :


Extract all the files into nwn installation folder, create a subdir called webui (also into nwn installation dir) and put  hud.html and jquery-xxxxx.js in there.


Launch webui_demo.mod with nwnx2 and startt nwn to play with nwncx.


Weh in game type /hud on chat and a player sheet overlay should appear on the left upper corner.


The nwscript is self explanatory and feel freeto try to make more sophisticated interfaces to fityour needs.


HOW IT WORKS :


I hooked wglSwapLayerBuffers to render the offscreen webview surface to a gl quad.The overlay quad occupies the entire viewport (so if you play at 1024x768 the overlay covers the entire screen so 1024 width and 768 height).


As webview get upated or some pixel change it's state the quad is re-rendered.Transparency (alpha channel setted to 0.0) let mouse click to pass through unhooked.


The only input event hooked is mouse left button click and dbl click (i am figuring a way to handle all mouse events).


When you exit nwn to main screen the gui is still there (i am working on this studying the code of nwshader, btw is a lot of code and the wrapper covers almost every Open gl state and it needs a lot of time).


As it's now i make a new glcontext and draw the gui there, btw when you change area the gui disappears to reappear when the next area is loaded.


The html is self explanatory, i make a global js object called WebUI with some methods to share things with nwserver.


When the packet reachs the server a local string var is setted on the calling character to check which widget posted the message.


The script to handle the protocol is webui (which fires everytime we make a request by the gui).


Response format should be json, I haven't included a json parser but nivmade a good one for nwscript, try to use it or just make the string yourself.



               
               

               
            

Legacy_niv

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
nwncx webkit
« Reply #19 on: March 03, 2016, 02:56:44 pm »


               

Hey there,


 


had a good look and it looks pretty awesome (get it?). I'd want you to know that I've decided to run with the basic idea your code, but there are a few of things that need tweaking.


 


Specifically, I've long been sitting on some patches that allow nwnx_connect to speak to it's client part nwncx_connect bidirectionally through custom netlayer messages. This is exposed through pluginlink on both ends, so any plugin on the server can send messages to any plugin on the client and vice versa with no hook hackery required. This will replace all the netlayer code you've pulled in with two simple HookEvent() calls. I will be cleaning that up and PR it upstream Any Day Now™ and then let you know here.


 


I'm also poking at completing the missing features, like keyboard input, form focus, right-click, and so on. For this, there might be some core patches to NWNCX necessary (a lot of plugin depend on these, I would think), so exposing them as PL events makes a lot of sense.


 


Thirdly, adding a cache dir for awesomium to store it's session data will do a world of good and allow getting rid of the layouts scheme, and instead let servers just tell the client to load a specific URL/execute raw JS, making it much more flexible for new PWs to implement.


 


All this will be a fair few days because I'm rather occupied otherwise real-life-wise. If you want to chat though, go on and grab me on IRC!


 


Cheers, niv


 



               
               

               
            

Legacy__Cyan_

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
nwncx webkit
« Reply #20 on: March 03, 2016, 03:37:09 pm »


               


Hey there,


 


had a good look and it looks pretty awesome (get it?). I'd want you to know that I've decided to run with the basic idea your code, but there are a few of things that need tweaking.


 


Specifically, I've long been sitting on some patches that allow nwnx_connect to speak to it's client part nwncx_connect bidirectionally through custom netlayer messages. This is exposed through pluginlink on both ends, so any plugin on the server can send messages to any plugin on the client and vice versa with no hook hackery required. This will replace all the netlayer code you've pulled in with two simple HookEvent() calls. I will be cleaning that up and PR it upstream Any Day Now™ and then let you know here.


 


I'm also poking at completing the missing features, like keyboard input, form focus, right-click, and so on. For this, there might be some core patches to NWNCX necessary (a lot of plugin depend on these, I would think), so exposing them as PL events makes a lot of sense.


 


Thirdly, adding a cache dir for awesomium to store it's session data will do a world of good and allow getting rid of the layouts scheme, and instead let servers just tell the client to load a specific URL/execute raw JS, making it much more flexible for new PWs to implement.


 


All this will be a fair few days because I'm rather occupied otherwise real-life-wise. If you want to chat though, go on and grab me on IRC!


 


Cheers, niv





I'm glad you are interested in this, i have very short time to develop on nwn and i really wanted to make a custom gui system so i took every helpful snippets and put the puzzle pieces together.


Probably you'll do a good job as you already know nwn internals (for me, open the debugger and debug/hook from the ground is pretty expensive in terms of time and don't want to reinvent the wheel).


Btw I'd like to be an active part  on its grow-flow.


'<img'>


               
               

               
            

Legacy_niv

  • Jr. Member
  • **
  • Posts: 62
  • Karma: +0/-0
nwncx webkit
« Reply #21 on: March 03, 2016, 04:29:49 pm »


               


I'm glad you are interested in this, i have very short time to develop on nwn and i really wanted to make a custom gui system so i took every helpful snippets and put the puzzle pieces together.


Probably you'll do a good job as you already know nwn internals (for me, open the debugger and debug/hook from the ground is pretty expensive in terms of time and don't want to reinvent the wheel).


Btw I'd like to be an active part  on its grow-flow.


 '<img'>




 


Absolutely. I'll have to spend a few days working on it on and off (due to mentioned other commitments), but I will definitely keep you posted once I have things sorted. Nothing to worry. '<img'>


               
               

               
            

Legacy_Valgav

  • Full Member
  • ***
  • Posts: 118
  • Karma: +0/-0
nwncx webkit
« Reply #22 on: March 12, 2016, 11:24:40 pm »


               

First of all: great project!


 


Which files in demo are server side and which are client side? I'm curious because I'm using different installations for server and client and want to install that correct.


 


Also is there any chance to force to occupy only part of screen? For most cases I think that something round 600x600 is enough.


 


My first idea for that overlay is custom spellbook. We have nwnx funcs to set spells we can use databases to store known spells and now we can have gui overlay to manage remembered spells. It's huge!


 


Also we can have custom gui for crafting, trading even implement custom card game like pazaak from kotor or gwent from witcher.


 


I think that making this project stable is what could make nwn finally immortal and most simple game for builders.



               
               

               
            

Legacy__Cyan_

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
nwncx webkit
« Reply #23 on: March 14, 2016, 01:35:04 pm »


               


First of all: great project!


 


Which files in demo are server side and which are client side? I'm curious because I'm using different installations for server and client and want to install that correct.


 


Also is there any chance to force to occupy only part of screen? For most cases I think that something round 600x600 is enough.


 


My first idea for that overlay is custom spellbook. We have nwnx funcs to set spells we can use databases to store known spells and now we can have gui overlay to manage remembered spells. It's huge!


 


Also we can have custom gui for crafting, trading even implement custom card game like pazaak from kotor or gwent from witcher.


 


I think that making this project stable is what could make nwn finally immortal and most simple game for builders.




Hi, the demo binaries I uploaded are just a taste of what can be done with the plugin.I am not developing any further on the server plugin because niv is writing a new interface between nwncx and nwnx on version 2.8.


I doubt will be a full stable windows version of nwnx plugin (server side).


To run with the binaries i released just download the .zip and extract nwnx_webui.dll and nwncx_webui.dll (plus all the deps of awesomium) in the installation folder, make a webui dir in the same folder and put the .html, .js files there.


Run the demo mod with nwnx2 and launch the clint with nwncx, then type /hud in chat and the ui will show.


For the resolution :


If you know a bit of html, if we have a surface of 1024x768 and we render in a smaller viewport we loss the ratio so is a bit tricky to place elements or resizing them using percentage.


The viewport will cover all the render surface, then you simply set a transparent background on your page and draw just the elements you need where you need using percentage, pixels or whater you want.



               
               

               
            

Legacy_Valgav

  • Full Member
  • ***
  • Posts: 118
  • Karma: +0/-0
nwncx webkit
« Reply #24 on: March 14, 2016, 10:03:29 pm »


               

Damn I would really die for windows version of that plugin. There's no chance at all? '<img'>


 


Also in html 5 you don't really have to use em or rem to scale. You could use vw and vh to determine sizes depending on viewport size without even using javascript.



               
               

               
            

Legacy__Cyan_

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
nwncx webkit
« Reply #25 on: March 15, 2016, 08:35:36 am »


               


Damn I would really die for windows version of that plugin. There's no chance at all? '<img'>


 


Also in html 5 you don't really have to use em or rem to scale. You could use vw and vh to determine sizes depending on viewport size without even using javascript.





Awesomium doesn't support vh and vw units.


               
               

               
            

Legacy_Valgav

  • Full Member
  • ***
  • Posts: 118
  • Karma: +0/-0
nwncx webkit
« Reply #26 on: March 18, 2016, 10:36:31 pm »


               

Damn that's bad '<img'>


 


Also is sad that nwnx developers now don't focus on windows. Currently pc is capable of handling server so it would be nice to have full nwnx support on home machine to setup for friends. I would hyelp with windows version by i have absolutely no idea about nwnx hooking but i could help with network stuff.



               
               

               
            

Legacy_OldTimeRadio

  • Hero Member
  • *****
  • Posts: 2307
  • Karma: +0/-0
nwncx webkit
« Reply #27 on: March 19, 2016, 09:39:06 pm »


               

@Valgav - NWNX development has always moved along a lot more briskly on the Linux side.  I mean, at least for the last 8+ years.  As far as I know, there also may be some technical reasons why this is the case.  I have, in the past, set up Linux servers and clients and it's not that hard.  Though it's unsupported, I'm reasonably sure that you can still download and utilize NWN in-a-box (which uses Virtualbox) from here.



               
               

               
            

Legacy_Valgav

  • Full Member
  • ***
  • Posts: 118
  • Karma: +0/-0
nwncx webkit
« Reply #28 on: March 19, 2016, 09:55:52 pm »


               

Sure I know linux and that's not a problem. My main problem are functions that hasn't been ever ported from windows to linux like hooking learning of spells from scrolls or changing time of day which both I find very useful.



               
               

               
            

Legacy_Shadooow

  • Hero Member
  • *****
  • Posts: 7698
  • Karma: +0/-0
nwncx webkit
« Reply #29 on: March 19, 2016, 10:18:15 pm »


               


@Valgav - NWNX development has always moved along a lot more briskly on the Linux side.  I mean, at least for the last 8+ years.  As far as I know, there also may be some technical reasons why this is the case.  I have, in the past, set up Linux servers and clients and it's not that hard.  Though it's unsupported, I'm reasonably sure that you can still download and utilize NWN in-a-box (which uses Virtualbox) from here.




there are two reasons for that


 


1) linux version of nwserver has open sourcecode - that makes any third party development easier


2) majority of the nwnx developers are working and hosting their nwserver under linux