Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Launch custom front end from Lich UI?

  1. #1

    Default Launch custom front end from Lich UI?

    I'm in the early stages of making a WPF/.NET/C# based front end for GS. Basically, in theory, I'd like to make (a subset of) Stormfront without the memory leaks. And in theory a more flexible layout. Right now I'm setting up the UI stuff to make sure WPF can handle it performance wise. I added/removed about a million lines of text (including hyperlinks) in a FlowDocumentScrollViewer and after all that the app was using ~70MB of memory. Seems like it shouldn't need that much, but hey, it hasn't ballooned to 2GB like Stormfront does sometimes.

    I would make this in Ruby/GTK because then it would be truly cross platform (WPF is anything but) and it would be the same language/stack as Lich but I don't know anything about GTK, I only know enough Ruby to do simple scripts and I'm just way more fluent in C# (and XAML). Maybe I should just force myself to learn GTK... but... I'm lazy.

    Of course my front end would be useless without a connection to Lich so I'm trying to get that wired up right. Right now I'm running Lich in "profanity mode", where I'm giving it the args "--login=Foo --detachable-client=8000 --without-frontend" and then launching my front end. That works but I'd really like it to act more like an "attached" front end and have the game disconnect when I close it. I'd also like to be able to use Lich's GUI login tool. How can I do that?

    If I select "custom launch command" and give Lich the path to my .exe (and accept the port/host args), should that work? I tried that but I was getting a shell execute error. I wonder if Lich is trying to launch my exe and failing, or if it's trying to do something like launch the game launcher (which I definitely don't need). Maybe Lich is just ignoring the path I give it since the pre-populated texts (wizard.exe, stormfront.exe) don't include any path.

    I can always read the code, just thought I'd ask for some pointers. Thanks for your time in making this thing.

  2. #2

    Default

    You ever make any progress with this?

    I'm about to start down a similar path, looking to build something on the Universal Windows Platform so I can have GS on a RaspberryPi running Windows Core.
    Make Shattered a $5 stand-alone subscription!

    [Shattered]-GSF:Wiggles: "How come all the groups that make enemies with Ifor end up quitting Shattered once he decides to eliminate them? I'm not saying he's a secret GM, but if he was a secret GM...."

  3. Default

    Quote Originally Posted by Drunken Durfin View Post
    You ever make any progress with this?

    I'm about to start down a similar path, looking to build something on the Universal Windows Platform so I can have GS on a RaspberryPi running Windows Core.
    That sounds like a super cool project. Keep us updated

  4. #4

    Default

    I'm a database / utility coder. I don't know beans about TCP, Sockets and Ports, which is making the initial step into this process very difficult. That and I don't have a lot of free time to research this stuff. So, if someone wants to throw me a bone it will be humbly appreciated.

    I'm using the "lich.rbw --login [charactername] --without-frontend --detachable-client=8000" command line option with Lich, and I'm able to see the game feed in a browser pointing to http://127.0.0.1:8000/ so I know that I'm connected.

    Unfortunately this is where I currently am with the project:

    Code:
     private void btnSendCommand_Click(object sender, EventArgs e)
            {
                TcpClient tcpClient = new TcpClient("127.0.0.1", 8000);
                using (NetworkStream ns = tcpClient.GetStream())
                {
                    using (BufferedStream bs = new BufferedStream(ns))
                    {
                        byte[] messageBytesToSend = Encoding.UTF8.GetBytes("say hello from C#");
                        bs.Write(messageBytesToSend, 0, messageBytesToSend.Length);
                    }
                }
    
                Console.WriteLine("Operation complete.");
            }
    This is giving me a wonderful error:

    An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in System.dll

    Additional information: No connection could be made because the target machine actively refused it

    System.Net.Sockets.SocketException was unhandled
    ErrorCode=10061
    Message=No connection could be made because the target machine actively refused it 127.0.0.1:8000
    NativeErrorCode=10061
    Source=System
    If someone can get me started here it would be greatly appreciated. Once I'm able to receive the game stream, and send commands back up the line, it will progress fairly quickly. The learning curve up to that point is a tad steep right now. Once I have XML stream to work with I'll be able to ramp this up pretty quickly.

    I'm coding this in C#, so any assistance will need to be of that flavor to be helpful.

    Thanks in advance for any constructive help.
    Make Shattered a $5 stand-alone subscription!

    [Shattered]-GSF:Wiggles: "How come all the groups that make enemies with Ifor end up quitting Shattered once he decides to eliminate them? I'm not saying he's a secret GM, but if he was a secret GM...."

  5. #5
    Join Date
    Nov 2006
    Location
    Potato
    Posts
    2,606

    Default

    Lich's TCP server is single threaded, so if you are connected to it in the browser, it won't accept anymore connections.

    Also, not that it matters for your current problem, but I am fairly sure you want ASCII encoding (because that's what GS sends), not UTF-8. You might end up with some garbed characters otherwise.

    Yeah, ASCII: https://github.com/matt-lowe/Lich/bl...ter/lich.rb#L2
    Last edited by m444w; 12-12-2016 at 08:09 PM.
    Discord: Ondreian#3875

    I have turned PMs off on these forums, if you want to chat, use Discord to contact me.

    knifty

  6. #6

    Default

    Well, that totally worked, thanks!

    Dropped the browser connection and I was able to send commands. Granted I could not see anything, had someone else in game watching for my actions.

    So, what is the deal if it won't accept more than one connection from the FE? I have to disconnect the incoming game stream, send my command up, then reconnect? That seems kinda error prone.
    Make Shattered a $5 stand-alone subscription!

    [Shattered]-GSF:Wiggles: "How come all the groups that make enemies with Ifor end up quitting Shattered once he decides to eliminate them? I'm not saying he's a secret GM, but if he was a secret GM...."

  7. #7

    Default

    You use the same TcpClient for read and write. See this StackOverflow question/answer: http://stackoverflow.com/questions/3...sing-tcpclient

    Alternately, check out the MinimalisticTelnet at https://www.codeproject.com/script/A...aspx?aid=19071, particularly TelnetInterface.cs

    EDIT: The MSDN async socket example also has some reasonable code: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
    Last edited by Jymamon; 12-12-2016 at 11:49 PM.

  8. #8

    Default

    Quote Originally Posted by Jymamon View Post
    You use the same TcpClient for read and write. See this StackOverflow question/answer: http://stackoverflow.com/questions/3...sing-tcpclient

    Alternately, check out the MinimalisticTelnet at https://www.codeproject.com/script/A...aspx?aid=19071, particularly TelnetInterface.cs

    EDIT: The MSDN async socket example also has some reasonable code: https://msdn.microsoft.com/en-us/lib...v=vs.110).aspx
    Thanks for this. The MSDN stuff looks promising.
    Make Shattered a $5 stand-alone subscription!

    [Shattered]-GSF:Wiggles: "How come all the groups that make enemies with Ifor end up quitting Shattered once he decides to eliminate them? I'm not saying he's a secret GM, but if he was a secret GM...."

  9. Default

    Which Pi are you using?

  10. #10

    Default

    I don't have one for this project yet. Waiting to see if I can actually get the app to work well first.
    Make Shattered a $5 stand-alone subscription!

    [Shattered]-GSF:Wiggles: "How come all the groups that make enemies with Ifor end up quitting Shattered once he decides to eliminate them? I'm not saying he's a secret GM, but if he was a secret GM...."

Similar Threads

  1. Custom Launch Commands
    By cwolff in forum The Lich Project
    Replies: 7
    Last Post: 04-05-2018, 11:34 AM
  2. Lich Issue - launch error
    By bremerial in forum The Lich Project
    Replies: 0
    Last Post: 04-02-2018, 04:06 AM
  3. Replies: 7
    Last Post: 10-31-2016, 03:57 PM
  4. Lich quick game entry won't launch wizard
    By Drew in forum The Lich Project
    Replies: 26
    Last Post: 02-28-2013, 09:05 PM
  5. Lich Launch
    By HermieTheDentist in forum The Lich Project
    Replies: 4
    Last Post: 08-11-2011, 11:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •