Update for Half-Life 1.1.1.1 and client library for Mac/Linux

MilaniumMilanium Join Date: 2012-12-27 Member: 176388Members
edited February 2013 in NS General Discussion
http://store.steampowered.com/app/70/ is available for Mac/Linux now. You can install the Linux server binary, but it won't start from the Steam GUI.

f48ab9d0fb12de880235ab9692fb79.png

If you try to do so via the command-line it backfalls to Half-Life 1 (player models are barneys, VGUI is broken, ...) because the cl_dlls is Windows-only.

003671e1561774ce67eb7954f15b3a.jpg

As a huge fan I offer my help to port Natural-Selection 1. Can you publish the source code of the client library?
«13

Comments

  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    edited February 2013
    I'm far from an expert in these matters, but...

    What about creating a linux shared object .so that "tunnels" the client.dll through it, returning whatever function calls the game needs to the linux binaries?
  • GISPGISP Battle Gorge Denmark Join Date: 2004-03-20 Member: 27460Members, Playtest Lead, Forum Moderators, Constellation, NS2 Playtester, Squad Five Blue, Squad Five Silver, Squad Five Gold, NS2 Map Tester, Reinforced - Onos, WC 2013 - Gold, Subnautica Playtester, Forum staff
    The best way to get your hand on the sourcecode, if its even posible, would be to email Charlie expressing your interests. Some examples of previus work would work wonders aswell.
  • MilaniumMilanium Join Date: 2012-12-27 Member: 176388Members
    edited February 2013
    I don't have a FPS shooter development or GoldSrc modding resume that would impress anyone. My GitHub account will only show that I am an active contributer to http://www.open-ra.org/ Already sent an e-Mail to Flayra and got ignored. Guess they don't care for their HL 1 mod anymore since the development of NS 2 started.
  • Darklord42Darklord42 Join Date: 2013-02-20 Member: 183230Members
    You mean we can potentially play NS on OSX now? Awesome! Oh on HL on OSX is great too XD
  • IeptBarakatIeptBarakat The most difficult name to speak ingame. Join Date: 2009-07-10 Member: 68107Members, Constellation, NS2 Playtester, Squad Five Blue, NS2 Map Tester, Reinforced - Diamond, Reinforced - Shadow
    I heard a while back that the source code was lost, it was mentioned in some discussion about bringing game balance values from ns1.

    I could be wrong though.
  • MilaniumMilanium Join Date: 2012-12-27 Member: 176388Members
    edited February 2013
    The people at Valve who did the GoldSrc port might help us a little, but they need some kind of an okay from the mod devs. I had a look at the ns mod folder because I thought at first that the missing models/animations indicate path problems only. In fact you already can play NS 1 v3.2 on Linux (and probably Mac, too) it is only insanely glitchy. I found some problems in https://developer.valvesoftware.com/wiki/The_liblist.gam_File_Structure of the NS 3.2 release. Obviously the url_dl is broken because of the numerous website updates, but Charley also inserted a string for the cldll= settings which is a boolean value: should be "1" instead of the name of the dll, but I guess the GoldSrc engine interprets it as true.
  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    edited February 2013
    Well, lets, as a community, write a HL dll to so wrapper!

    MPlayer does something similar with video codecs from win32 dll's using winelib, so I don't see why it's not possible here.

    Here's a list of function calls from ns/cl_dlls/client.dll
    http://bordersonabsurd.com/ns/Exported Functions List.html

    Call the client.dll into a .so and divert the calls from vgui.dll to vgui.so or something.
  • MilaniumMilanium Join Date: 2012-12-27 Member: 176388Members
    According to http://www.winehq.org/docs/winelib-guide/winelib-introduction you need the source code of your Win32 application to compile with WineLib for Unix. I also expect no platform depended source code in the mod's DLL. Well, if Charley lost the code.. I think we are fucked, but I can't believe this. They must have stored this in source code management repositories on servers and Natural-Selection was not a 1 man project. How can everybody have lost the code.
  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    I know, I'm talking about creating a native shared object from scratch, that will use winelib to call the functions in client.dll (560 of them...), and then link that new shared object against vgui.so provided with the linux client.
  • MilaniumMilanium Join Date: 2012-12-27 Member: 176388Members
    I have no experience in this. Maybe we could use http://metamod.sourceforge.net/files/sdk/hlsdk-2.3-p3.tar.gz as a template. It is the old Windows SDK with patches. There is no SDK for Linux yet.
  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    edited February 2013
    I too have no experience in this, I don't know a whole lot of C or C++ beyond the basic syntax (I can make it work, just takes time, buried in documentation for me to make things happen), just a bit of JavaScript and Python. I had already downloaded the Windows SDK from ModDB before you posted that link, what sorts of patches are in there?

    Also, check this out. http://wine-wiki.org/index.php/WineLib#Running_a_Dll

    So long as client.dll doesn't call kernel32.dll (It doesn't as far as I can tell) it should be possible.

    I have, with that, created a shared object from the dll, edited liblist.gam to include cldlls_linux, but the engine doesn't load it.
    http://bordersonabsurd.com/ns/cl_dlls.tar.gz

    Also, what command did you use to launch NS (albeit broken) from the terminal?
  • MilaniumMilanium Join Date: 2012-12-27 Member: 176388Members
    Caboose wrote: »
    I had already downloaded the Windows SDK from ModDB before you posted that link, what sorts of patches are in there?

    According to the README he added some patches Valve added without releasing a new SDK version and silenced gcc compiler warnings.
    Caboose wrote: »
    Also, what command did you use to launch NS (albeit broken) from the terminal?

    Steam has to be running.
    $ ~/.local/share/Steam/SteamApps/common/Half-Life> LD_LIBRARY_PATH=~/.steam/bin:. LD_PRELOAD=gameoverlayrenderer.so ./hl_linux -game ns
    

    according to http://www.reddit.com/r/linux_gaming/comments/17ahm3/how_to_install_and_run_half_life_mods_on_steam/ but you can short it up with
    $ ~/.local/share/Steam/SteamApps/common/Half-Life> ./hl.sh -game ns
    
    Caboose wrote: »
    I have, with that, created a shared object from the dll, edited liblist.gam to include cldlls_linux, but the engine doesn't load it.
    http://bordersonabsurd.com/ns/cl_dlls.tar.gz

    It won't work for me, too. Says "could not load library /home/matthias/.local/share/Steam/SteamApps/common/Half-Life/./ns/cl_dlls/client.so" if I try to load the game with client.so copied to cl_dlls folder. This is my liblist.gam:
    ////////////////////////////
    // Natural Selection      //
    //   by Charlie Cleveland //
    ////////////////////////////
    game "Natural Selection"
    developer "Unknown Worlds"
    developer_url "http://www.unknownworlds.com/ns/"
    url_info "http://www.unknownworlds.com/ns/"
    url_dl "http://unknownworlds.com/ns/download-files/"
    icon "ns"
    version "v3.2"
    size "165000000"
    svonly "0"
    secure "0"
    cldll "1"
    hlversion "1111"
    // How to allow training but disable "New game"?
    type "multiplayer_only"
    // Don't show models in browser
    nomodels "1"
    nohimodel "1"
    // Only show NS-compliant maps
    mpentity "info_mapinfo"
    // Using HPB_bot support for now
    gamedll "dlls\ns.dll"
    gamedll_linux "dlls/ns.so"
    // Training map
    //trainmap "ns_training"
    fallback_dir "ns"
    

    My guess is that this is not a real wrapper, but still depended on Wine somehow. Is there anything left to do with those files except copying them to ~/.local/share/Steam/SteamApps/common/Half-Life/ns/cl_dlls/?
  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    edited February 2013
    Any wrapper will depend on wine/winelib, but only for the game logic, not for the engine. I'm going to do a bit of studying the MPlayer codec loading bits, I doubt I'll understand it, but...

    Ignore the .so I posted earlier.

    I'm using 64 bit Ubuntu, which has been causing trouble. I set up a 32 bit install last night.

    I don't suppose there are any more experienced programmers who care to comment?

    Also, here is the output of '# objdump -x' on valve/cl_dlls/client.[so/dll]
    :edit: jjust text files, BTW
    http://bordersonabsurd.com/ns/client.dll.lookatme
    http://bordersonabsurd.com/ns/client.so.lookatme

    It looks like the dll IS linked to kernel32.dll after all...
  • MilaniumMilanium Join Date: 2012-12-27 Member: 176388Members
    edited February 2013
    I doubt it will work that way: http://forum.winehq.org/viewtopic.php?t=14307#p70330 The winelib solution is extremely ugly. It requires a specific version of wine and it is not stand-alone plus it will be problematic together with GUI and networking. Might be easier to rewrite the cl_dll as it consists only of the VGUI and weapon animation scripts. If we don't replicate it exactly this might not matter.
  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    edited February 2013
    Ok, well, if we compare ns's client.dll, with the 1.1.1.1 valve client.dll, we can probably determine which functions they share, and wouldn't need to rewrite. Valve's .so depends on
      NEEDED               libstdc++.so.6
      NEEDED               libdl.so.2
      NEEDED               libpthread.so.0
      NEEDED               vgui.so
      NEEDED               libsdl2-2.0.so.0
      NEEDED               libc.so.6
    
    the .dll on:
    KERNEL32.dll
    USER32.dll
    vgui.dll
    WSOCK32.dll and
    SDL.dll

    then, make a client.so that depends on winelib and windows.h

    Use LoadLibrary("client.dll") then to call only the functions from ns's client.dll that are specific to, or significantly differ in some way from valve's.

    But, as I said, I'm by no means an expert, just an optimist.

    :edit 2:

    ns's client.dll depends on:
    WINMM.dll Joystick stuff
    WS2_32.dll
    vgui.dll
    KERNEL32.dll
    SER32.dll
    GDI32.dll

    If someone could objdump -x the 1.1.1.0 dll, I'd bet the SDL stuff isn't there so really, just need to call the ns specific game functions, I think, unless my understanding of computers is wrong, which it may be.

    I guess the first step then would to build a vanilla client.so like it was a new mod.
  • MilaniumMilanium Join Date: 2012-12-27 Member: 176388Members
    Have you tried to decompile it?
  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    edited February 2013
    Yes, but decompiled code is pretty unreadable. I'm working on compiling a working hldm client.so because I think the winelib hack is the best bet.
  • puzlpuzl The Old Firm Join Date: 2003-02-26 Member: 14029Retired Developer, NS1 Playtester, Forum Moderators, Constellation
    It should be really straight forward to port ns1 to linux. We have previously ported all OS calls to their steam equivalent years ago when we had ns1 installing over steam. I still have ns1 source, but don't have a working build system. I'm very busy at work at the moment, but when things ease up a bit I'll put a build together.
  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    That's great, because I more or less gave up on this entirely.
  • puzlpuzl The Old Firm Join Date: 2003-02-26 Member: 14029Retired Developer, NS1 Playtester, Forum Moderators, Constellation
    Okay, so I had a quick look at this tonight just to get an idea of what is involved. I tried to build on my ubuntu gaming laptop and had to install a fairly old version of gcc just to get past a few gazillion compile errors due to changes in C++ over the last few versions of gcc.

    After that, the build was looking better but I realised fairly quickly that I only archived the main NS source repository and not the tools repository, which contains all our dependent libraries. I disabled some of the ones that aren't really necessary ( Lua??? ) but I can't find the library we used for managing particle systems. FYI, I'm simply trying to rebuild the linux server to start with before I even consider looking at building the linux client. I'm wondering if it will be even possible to do this cleanly. Do any of you know of another HL1 Mod that has realised a client.so since Valve released a native linux client for steam? I'm worried that there are some updates to the SDK that haven't been released to the public yet.

    I might send a mail off to some of our old contacts at valve.. but last time we spoke the dinosaurs roamed the earth.. so I doubt they'll even recognise my name.

    I guess the other option is to build a clean windows client.dll. NS makes some direct windows32 calls to do some stuff to files and sockets etc, and back when we did the work to get NS on linux we rewrote all that stuff to use the Steam equivalent. I'm guessing that if I rebuild for windows with no direct calls to win32 that you guys will have a lot easier a time getting ns to run in a wrapper.
  • CabooseCaboose title = name(self, handle) Join Date: 2003-02-15 Member: 13597Members, Constellation
    Maybe, if we could overload(?) the valve client.dll, that has already presumably replaced those calls with the equivalent Linux ones already.

    It looks like they replaced Winsock with libpthreads, and it also looks like you guys used winsock2 (I honestly don't know how significant that is). They also use SDL instead of GDI it appears for both Windows and Linux now.

    The whole winelib thing still confuses me a bit, though.
  • MilaniumMilanium Join Date: 2012-12-27 Member: 176388Members
    You might get help or at least find the right person to send an e-Mail to on #steamlug at irc.freenode.org

    The other possibility I see is you Open Source everything preferably on http://www.github.com so that the community can help fix up the build and whatever else is broken.
  • PyromaniacPyromaniac Join Date: 2009-02-20 Member: 66498Members
    edited April 2013
    There are currently a number of issues with the new halflife client in NS even on windows, so the NS1 community has moved back to the older version. They are still compatible for online play, but they have two different voice codecs so mic support between versions does not work.
  • tschumanntschumann Australia Join Date: 2010-05-26 Member: 71862Members
    puzl wrote: »
    Do any of you know of another HL1 Mod that has realised a client.so since Valve released a native linux client for steam? I'm worried that there are some updates to the SDK that haven't been released to the public yet.

    I don't think any mods have been released with Linux/Mac support yet.
    Apparently an updated SDK will be released once everything is more stable. It didn't say whether this SDK update would include Mac/Linux support but I'd assume it would.
  • RegnarebRegnareb Join Date: 2007-08-26 Member: 62008Members, NS2 Playtester
    Pyromaniac wrote: »
    There are currently a number of issues with the new halflife client in NS even on windows, so the NS1 community has moved back to the older version. They are still compatible for online play, but they have two different voice codecs so mic support between versions does not work.
    I don't have any issue on NS1, what are these?

  • puzlpuzl The Old Firm Join Date: 2003-02-26 Member: 14029Retired Developer, NS1 Playtester, Forum Moderators, Constellation
    Milanium wrote: »

    I can't make an progress until we resurrect the original NS1 sources from source control. Looking at that repo anyway, it is just HL SDK 2.3, which is years old and doesn't provide anything for building on the new platforms anyway.


  • ninjinninjin Join Date: 2013-04-16 Member: 184854Members, Reinforced - Diamond
    Just dropping a line of encouragement, any effort put towards bringing NS1 to Linux are very much appreciated. I do have some experience porting software (moving C++ code between GCC versions... *shrugs*) and I am sure that there are plenty of others willing to help with testing as well if it can be of any help at a later stage.
  • noregnoreg Join Date: 2012-09-15 Member: 159425Members
    puzl wrote: »
    I can't make an progress until we resurrect the original NS1 sources from source control.
    Any luck yet?
  • rea987rea987 Germany Join Date: 2014-01-02 Member: 191467Members
    puzl wrote: »
    ...
    I might send a mail off to some of our old contacts at valve.. but last time we spoke the dinosaurs roamed the earth.. so I doubt they'll even recognise my name.

    ...

    Hey there,

    Is there any development in the case of porting the mod into GNU/Linux and OS X? I have applied the installation which was proposed in Reddit and as Jan 2014 the results are more or less the same as the beginning of last year.

    - I extracted the mod files via WINE/PlayOnLinux.
    - I moved the "ns" folder into "~/.local/share/Steam/SteamApps/common/Half-Life" folder.
    - I copied the "ns_i386.so" file to "~/.local/share/Steam/SteamApps/common/Half-Life/valve/dlls" from "~/.local/share/Steam/SteamApps/common/Half-Life/ns/dlls".

    The mod appears on Steam and is successfully launched. However; it lacks both Marine and Alien models; there's no crosshair; weapon and malee attack sounds are missing; marine weapons cannot be reloaded...

    In short, the mod works but not in playable level.

    I use Linux Mint 13 32 bit and here is the version output of the Half-Life that I have:
    ] version
    Protocol version 48
    Exe version 1.1.2.2/Stdio (valve)
    Exe build: 13:14:09 Aug 29 2013 (6153)
    

    That would be wonderful if I can play my favourite Half-Life mod after many years. I own Natural Selection 2 but my computer is 7 years old and can never run it. I have no plan to return unreliable Windows and not in a condition to buy a new computer in near future...

    So, is that still not possible to port the mod for GNU/Linux and OS X?

    Thank you.
Sign In or Register to comment.