September 20, 2017, 12:32:16 AM

Author Topic: Gnomoria Web Server  (Read 15060 times)

Roest

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: Gnomoria Web Server
« Reply #15 on: August 01, 2015, 06:43:04 AM »
That error you mentioned from the linqpad script indicates that it can't find the gnomorialib.dll file.

The linqpad script can be ran from anywhere, the path just needs to be set to the gnomoria installation path.

I pushed an update to the Linqpad script here: https://github.com/Rychard/GnomeServer/blob/GnomeApp/Injector/inject.linq, and it may output some useful information.

Yea, that's clear and it points to the gnomoria dir. That's why I don't understand why it's throwing that error.

Edit:
Ok so instead of having it in C:\Program Files (x86)\Steam\SteamApps\common\Gnomoria I made a new Steam folder in D:\ and installed it there.
That solved the linq issue. Just to make it clear. The path in the linq file pointed there and it was finding the Gnomoria.exe and the GnomoriaInjection.dll.

Anyway now that this is solved I am back to the "No resource is available..." error. So it doesn't seem to be a problem with the language settings.

Rychard

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Gnomoria Web Server
« Reply #16 on: August 01, 2015, 06:47:49 AM »
That error you mentioned from the linqpad script indicates that it can't find the gnomorialib.dll file.

The linqpad script can be ran from anywhere, the path just needs to be set to the gnomoria installation path.

I pushed an update to the Linqpad script here: https://github.com/Rychard/GnomeServer/blob/GnomeApp/Injector/inject.linq, and it may output some useful information.

Yea, that's clear and it points to the gnomoria dir. That's why I don't understand why it's throwing that error.

Edit:
Ok so instead of having it in C:\Program Files (x86)\Steam\SteamApps\common\Gnomoria I made a new Steam folder in D:\ and installed it there.
That solved the linq issue. Just to make it clear. The path in the linq file pointed there and it was finding the Gnomoria.exe and the GnomoriaInjection.dll.

Anyway now that this is solved I am back to the "No resource is available..." error. So it doesn't seem to be a problem with the language settings.

It should be creating a GnomeServer.log file.  Delete that file, and replicate the issue once more.  Put that log on PasteBin, or a Github Gist, and hopefully it will point us in the right direction.

For comparison, here's my log: https://gist.github.com/Rychard/4afd3af7776e15757c36

Edit: The GnomeServer.log file should be located in your game save location (Documents\My Games\Gnomoria by default)
« Last Edit: August 01, 2015, 06:50:39 AM by Rychard »

Roest

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: Gnomoria Web Server
« Reply #17 on: August 01, 2015, 06:54:13 AM »
https://gist.github.com/rschurade/57a24051fa41baa003a7

Nothing in there that looks supicious.

Also the message is in the browser, so it was served by the GnomeServer. That part at least is working.

Rychard

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Gnomoria Web Server
« Reply #18 on: August 01, 2015, 06:57:31 AM »
https://gist.github.com/rschurade/57a24051fa41baa003a7

Nothing in there that looks supicious.

Also the message is in the browser, so it was served by the GnomeServer. That part at least is working.

Ah, I see.

The server relies on convention to resolve the URL to the appropriate method.  When no method is found (again, by convention), it tries to serve the request as a static file (this allows for the hosting of JavaScript/CSS/html files).

Anyways, keeping it simple, just drop the "Controller" from the url.

Try this: http://localhost:8081/Gnome

Roest

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: Gnomoria Web Server
« Reply #19 on: August 01, 2015, 07:01:44 AM »
localhost:8081/Gnome serves a json file

military just an empty array []

and the  other two an error

Code: [Select]
An error has occurred!

System.InvalidOperationException: Die Sequenz enthält kein übereinstimmendes Element.
   bei System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   bei GnomeServer.ConventionRoutingController.Handle(HttpListenerRequest request) in e:\devel\workspace\GnomeServer\GnomeServer\ConventionRoutingController.cs:Zeile 61.
   bei GnomeServer.IntegratedWebServer.HandleRequest(HttpListenerRequest request, HttpListenerResponse response) in e:\devel\workspace\GnomeServer\GnomeServer\IntegratedWebServer.cs:Zeile 183.

Rychard

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Gnomoria Web Server
« Reply #20 on: August 01, 2015, 07:11:01 AM »
localhost:8081/Gnome serves a json file

military just an empty array []

and the  other two an error

Code: [Select]
An error has occurred!

System.InvalidOperationException: Die Sequenz enthält kein übereinstimmendes Element.
   bei System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
   bei GnomeServer.ConventionRoutingController.Handle(HttpListenerRequest request) in e:\devel\workspace\GnomeServer\GnomeServer\ConventionRoutingController.cs:Zeile 61.
   bei GnomeServer.IntegratedWebServer.HandleRequest(HttpListenerRequest request, HttpListenerResponse response) in e:\devel\workspace\GnomeServer\GnomeServer\IntegratedWebServer.cs:Zeile 183.

It seems like it's working right now, albeit with a few minor issues (the error you mentioned is because the URL couldn't be resolved to a single endpoint; it either found 0 or >1).

Adding Gnomes, and auto-assigning Gnomes to Jobs/Military appears to not work right this second due to a route issue.  I'll see what I can do about getting those fixed.

When I update the code, you only need to compile and copy over the updated assemblies into your Gnomoria directory, you won't need to run the Linqpad script again until an update to Gnomoria is released.

I'll post in the thread when I've fixed those issues.


Rychard

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Gnomoria Web Server
« Reply #21 on: August 01, 2015, 02:31:26 PM »
I just pushed some more commits that should fix the routing issues.

I'm still in the GnomeApp branch (https://github.com/Rychard/GnomeServer/tree/GnomeApp) since I'm not quite ready to merge this back into master, but I'm close!

I'd really like to include something like a paper-doll to help visualize the health of a Gnome.  Ideally it would be split into the various body parts and they'd be colored to indicate the health of that body part, with accompanying hover/tooltip text to provide detailed information.  There's just so many body parts for each Gnome, listing them all out like this takes an awful lot of space that I feel could be better spent on something else.

I'm starting to implement the ability to interact with the game via buttons and such, as you can see in the screenshot below:


Roest

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: Gnomoria Web Server
« Reply #22 on: August 02, 2015, 12:56:42 AM »
Still no luck. I tripple checked I'm in the GnomeApp branch, redownloaded Gnomoria, cleared everything, used release and debug compiles. It still ends with the same result.




Rychard

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Gnomoria Web Server
« Reply #23 on: August 02, 2015, 06:03:17 AM »
Just as a debugging measure, I've packaged up the compiled versions of everything (minus the modified Gnomoria.exe assembly) and temporarily put it up on dropbox if you'd like to give it a shot.

https://www.dropbox.com/s/prmxono5a0c0awu/GnomeServer.zip?dl=1

Inside there's two directories.  The Gnomoria folder goes to your installation directory.  And the wwwroot folder should go in your settings directory.


Roest

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: Gnomoria Web Server
« Reply #24 on: August 02, 2015, 06:14:58 AM »
Ok that works, at least the gnome adding and game speed. Home, military and world seem to do nothing.

Rychard

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Gnomoria Web Server
« Reply #25 on: August 02, 2015, 06:16:52 AM »
Ok that works, at least the gnome adding and game speed. Home, military and world seem to do nothing.

Yep, it's all a bit of a work-in-progress.

I'm curious as to what I've left out of the installation procedure that prevented you from being able to build a working copy on your machine.

Any thoughts?

Roest

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: Gnomoria Web Server
« Reply #26 on: August 02, 2015, 06:22:41 AM »
Quote
Any thoughts?

I had no wwwroot folder before. Should that be created, copied from somewhere or is it neccessary at all?

Edit: well technically I had one, but it was empty

Other than that no idea, the solution compiles just with two warning of unused variables, the linq script runs fine ... nope, no thoughts at all.
« Last Edit: August 02, 2015, 06:24:42 AM by Roest »

Rychard

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Gnomoria Web Server
« Reply #27 on: August 02, 2015, 06:32:00 AM »
Quote
Any thoughts?

I had no wwwroot folder before. Should that be created, copied from somewhere or is it neccessary at all?

Other than that no idea, the solution compiles just with two warning of unused variables, the linq script runs fine ... nope, no thoughts at all.

The wwwroot folder contains the JavaScript web application.  Without it, it will only expose the raw API.  The Web Application is located in the data directory to allow users to customize the application. 

The solution should have a GnomeApp project in it, which I've used TypeScript to create.  After building that project, you should just be able to copy the entire GnomeApp folder to your data directory (rename it to wwwroot) and it should work the same way as the one I provided on Dropbox.  The one I provided was the "publish" version so it doesn't include everything; just the necessary files to make it work.

I'm trying to determine a development roadmap moving forward, since I'm not exactly sure what kinds of information are useful to other players.  If you have any suggestions, feature requests, or just anything that you think should be prioritized, let me know; It would be nice to hear what others are looking for. :)

Roest

  • Jr. Member
  • **
  • Posts: 84
    • View Profile
Re: Gnomoria Web Server
« Reply #28 on: August 02, 2015, 06:58:37 AM »
Well I just tried it again, compile, linq and copy the GnomeApp dir as /savedir/wwwroot.
Still the same result as before. But at least I have your working copy.

For things to implement, I'd say the functionality of the existing editor would be nice

Gome:
spawning
stat editing
stats should be separated into civilian and combat stats
gnome repairing, replace missing linmbs

World:
item spawning
changing the type of neighbouring kingdoms for trade

Combat:
spawn enemies
kill enemies

Or am I confused and it should be just an info tool, but you added gnome spawning so maybe not.

Edit: Interesting, just noticed the discipline skill in your overview. That's not shown in game. Wonder what it does.
« Last Edit: August 02, 2015, 07:09:36 AM by Roest »

Rychard

  • Newbie
  • *
  • Posts: 25
    • View Profile
Re: Gnomoria Web Server
« Reply #29 on: August 02, 2015, 07:54:15 AM »
Well I just tried it again, compile, linq and copy the GnomeApp dir as /savedir/wwwroot.
Still the same result as before. But at least I have your working copy.

What version of Visual Studio are you using? (2012/2013/2015 as well as Community/Professional/Ultimate)
If using VS2013, you may need to install the update for TypeScript: https://visualstudiogallery.msdn.microsoft.com/2d42d8dc-e085-45eb-a30b-3f7d50d55304
If using a version prior to VS2013, I'm not sure if TypeScript (or at least, TypeScript 1.4) is available.

Keep in mind that the latest version of Visual Studio (VS2015) is available in a Community Edition: https://www.visualstudio.com/en-us/downloads/download-visual-studio-vs.aspx

Gome:
spawning
stat editing
stats should be separated into civilian and combat stats
gnome repairing, replace missing linmbs

World:
item spawning
changing the type of neighbouring kingdoms for trade

Combat:
spawn enemies
kill enemies

Here's the issues I've created for these requests on Github:

Or am I confused and it should be just an info tool, but you added gnome spawning so maybe not.

Accessing the information is the easy part, but editing it is when things get fun.  :)

I'd like for this to be a tool used to help manage your Gnomes.  The stuff you can do using the in-game interfaces tends to become quite tedious.

Edit: Interesting, just noticed the discipline skill in your overview. That's not shown in game. Wonder what it does.

It's defined in skill.xml:194 and referenced in jobsettings.xml:32.  I'm not sure what it does; I don't see any references to it in the code, but if it's referenced in the code, the string literal has most likely been obfuscated and my deobfuscator wasn't able to pick it up.

Maybe RoboB0b will pop in and let us know.