Half-Life for Dreamcast has some functional multiplayer components

Discussion in 'Sega Dreamcast Development and Research' started by TerdFerguson, Jul 13, 2015.

  1. -=FamilyGuy=-

    -=FamilyGuy=- Site Supporter 2049

    Joined:
    Mar 3, 2007
    Messages:
    3,034
    Likes Received:
    891
    I think I get it, but how would you decide the order? An alphabetically sorted sorttxt.txt is the same as none...
     
  2. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I honestly have no idea how that works. So again i'll stray away from modding the sort. Thanks for answering my question though

    If Sizious/anyone else needed motivation or another reason why this must work i just found one :
    http://www.moddb.com/mods/chicken-fortress-3

    I'm actually going to look into trying to port this to HLDC from what info i can find online about doing so. But it requires CS on steam, not sure how that affects DC compatibility or if its just texture dependencies. But the mod is still in early alpha. It would be a neat test anyway to see how it runs on dc, if at all. I'll make a separate thread for porting to HLDC when i do


    I don't mean to seem like i'm jumping the gun here. But this now only needs internet connectivity. Or to be tested with internet connectivity. That may be extremely difficult to pull off, but it can't be 100% impossible. I think that's acceptably really exciting. I understand you guys don't want people to start thinking this IS going to work. And make an internet stampede. But we really can't downplay that the connect command looks like it works

    So it's a good idea to start figuring out mod porting, mp mod porting, server mods etc




    One last note to Sizious: I'm not sure if this is now your project or how much more you're working on this, but if you end up doing deep binary editing please put microphone support on the list of things to look into. I mention so whatever you end up making doesn't need to be rewritten if you didn't think of it yourself :cool: But its just an idea, and there's no references to voice unless i overlooked it
     
    Anthony817 likes this.
  3. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Could you try testing it now that the connect commands are re-enabled using the info below?

    'cmdlist' is the command list and 'cvarlist' is the server variable list. That'll probably help too. Setmaster might only work by .cfg file. Through console it changes it to 'loopback' by default. 'logaddress' also changes to loopback by default. So that, and maybe others i haven't tried can be used by cfg
    Edit: (!) Even after running setmaster via cfg, just typing 'setmaster' after still says 'loopback'. Is this another lockout like 'connect is not valid from console'?

    So you'll likely need this guide for compiling the cdi, its what i used : http://pastebin.com/jfFs6jdM
    Edit: Stat at step 22, mount the iso to daemon tools and make a new cdi using discjuggler. Burn with 120% Alcohol with the write method set to RAW DAO.
    'extracted' is the directory of your files, so if the game is in 'C:\files' everything in that folder will be the root of the CD. The command would be
    'mkisofs -C 0,11702 -V HALF_LIFE_LINKA -sort output.txt -l -o data.iso c:\files'



    I posted a zip with all the files to do that a few posts back. You need to use wally to edit the pak file for the cfg, included in the zip. Get the sort file too. Edit the cfg for DC1 settings, and another for DC2 settings and compile them seperately. But be sure to replace the current server cfg. Any new files will break the sort file i think. It might be a good idea to find what settings you want via console before you make the cfg files and recompiling

    There's nothing in the engine for handling the link cable as we know, but it should be tested to know for sure
     
    Last edited: Oct 10, 2015
  4. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I was looking into how mods are ported, here are some useful links. It might be a good idea for someone to back this up somewhere since i needed to use the internet archive to find it. But there's alot of good info on using external DLLs
    https://web.archive.org/web/2011012...piling-hl-sdk-dlls-dc-using-wince-devkit-3567
    https://web.archive.org/web/20101026082941/http://www.dcfan.net.ru/forum/f83
    http://racketboy.com/forum/viewtopic.php?f=1&t=28999
    https://web.archive.org/web/2011091...f83/half-life-1-mapping-tutorial-thread-3501/

    Edit: This is starting to look almost certain. We might just need to make a small mod to use the network hardware. I don't know how much you can do with this info. But there might be alot more to work with than we think
     
    Last edited: Oct 11, 2015
    Anthony817 and SILENT_Pavel like this.
  5. Anthony817

    Anthony817 Familiar Face

    Joined:
    May 12, 2010
    Messages:
    1,078
    Likes Received:
    535
    Wow been years since I made that post at Racketboy lol.
     
  6. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    So what do people think of using custom DLLs like a mod? Couldn't a new DLL be made using the sources in HLSDK to use the network hardware and wininet.dll? This same dll could be used when porting other mp mods if it came down to it

    I want to know others opinion, i feel like this has been figured out
    Edit: I can verify the connect command does work. Here is video https://mega.nz/#!yFQ0gSIC
    Its from the CF3 port i mentioned before but i only have the menu images working that's it. Might take awhile
     
    Last edited: Oct 12, 2015
    Anthony817 likes this.
  7. Anthony817

    Anthony817 Familiar Face

    Joined:
    May 12, 2010
    Messages:
    1,078
    Likes Received:
    535
    Go look at the mod I just posted of Gunman. Dreammatrix added some custom dll's to it and looking at the structure of the files on the disc might be of some help?

    Anyways when I was following the work that Moi was doing about 4-5 years ago I was very optimistic and enthusiastic about him compiling the dll's with the SDK on Win CE. He stated he actually compiled it and got no errors so it was getting closer than I ever thought it could get. I can get you in contact with Moi if you would like to speak to him in person and ask him questions on his methods or if you needed to know anything else really?

    As you can see I am a huge fan of this game on Dreamcast and I love playing the mods as much as you do. Multiplayer is a far off dream for me that I never thought others would even look into get working, but I can see potential there. What, with the Dream PI making getting online easier than ever before there is literally no better time than now to see if something could be done to get online MP enabled and fully working.

    Heck, I would really love to learn how to port mods myself to DC. I know my way around PC's pretty decently, so I would really love to get somebody to sit down and show me step by step how to mod it like they were speaking to a 10 year old as I don't know how to do a lot with it. My short attention span has a lot to do with it.
     
  8. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Yeah I was going to get the sort file from a mod and use that since it has the barney folder with a proper .pak structure. The newest one would probably be best. Having Moi help would be great, if he can compile the DLLs maybe he can compile something for the network. There's plenty of documentation for networking in the WCE kit and example code from KOS. I have zero coding skill so i'm pretty useless testing the dll mod method. That's why i want to know others opinion

    But one other thing; The references to 'net_ws.c' do seem to be from the compiler, and the structure of the references are pretty similar to the source structure in the HLSDK. So it's a good guess to say whatever it is was compiled in the game
    [​IMG]

    Depending what happens with this I might make a guide. I've figured out most of it besides for making WAD files with the PVR textures, proper sound format, and actually compiling the DLL
     
    spinksy and Anthony817 like this.
  9. Anthony817

    Anthony817 Familiar Face

    Joined:
    May 12, 2010
    Messages:
    1,078
    Likes Received:
    535
    Sounds good man, I can mod the hell out of GTA V, Stalker and Skyrim and Fallout NV and I know how to edit variables here and there. Nothing too spectacular but I am sure with concise directions I can get something up and running. I would like to port WW2 singleplayer mods as WW2 games weren't even really popular as much as they were around 2005 or so.

    I will link Moi to this thread and ask him politely if he could share any knowledge with us.

    Edit: Ok I asked him.
     
    Last edited: Oct 12, 2015
    spinksy and TerdFerguson like this.
  10. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I'm looking forward to what he has to say. I'm also hoping someone with skill wants to confirm they will test. Until then I'm going to look into what can be done with the dll, here's interesting things from the HLSDK

    Code:
    HOOK_COMMAND(),  DECLARE_COMMAND()
            These two functions declare and hook console commands into the client dll.
          
            HOOK_COMMAND( char *command, command_name )
                Whenever the user types the 'command' at the console,  the function 'command_name'
                will be called.
                Precondition: There must be a function of the name UserCmd_command_name declared
                for CHud. Eg,  CHud::UserMsg_ShowScores() must be declared if you want to
                use HOOK_COMMAND( "+showscores", ShowScores );
    
            DECLARE_COMMAND( command_name )
                For each HOOK_COMMAND you must have an equivelant DECLARE_COMMAND.  This creates
                a function which passes the hooked commands into the CHud object.
    net_api.h not sure if last section 'APIs' is anything of use
    Code:
    //========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============
    //
    // Purpose:
    //
    // $NoKeywords: $
    //=============================================================================
    
    #if !defined( NET_APIH )
    #define NET_APIH
    #ifdef _WIN32
    #pragma once
    #endif
    
    #if !defined ( NETADRH )
    #include "netadr.h"
    #endif
    
    #define NETAPI_REQUEST_SERVERLIST    ( 0 )  // Doesn't need a remote address
    #define NETAPI_REQUEST_PING            ( 1 )
    #define NETAPI_REQUEST_RULES        ( 2 )
    #define NETAPI_REQUEST_PLAYERS        ( 3 )
    #define NETAPI_REQUEST_DETAILS        ( 4 )
    
    // Set this flag for things like broadcast requests, etc. where the engine should not
    //  kill the request hook after receiving the first response
    #define FNETAPI_MULTIPLE_RESPONSE ( 1<<0 )
    
    typedef void ( *net_api_response_func_t ) ( struct net_response_s *response );
    
    #define NET_SUCCESS                        ( 0 )
    #define NET_ERROR_TIMEOUT                ( 1<<0 )
    #define NET_ERROR_PROTO_UNSUPPORTED        ( 1<<1 )
    #define NET_ERROR_UNDEFINED                ( 1<<2 )
    
    typedef struct net_adrlist_s
    {
        struct net_adrlist_s    *next;
        netadr_t                remote_address;
    } net_adrlist_t;
    
    typedef struct net_response_s
    {
        // NET_SUCCESS or an error code
        int            error;
    
        // Context ID
        int            context;
        // Type
        int            type;
    
        // Server that is responding to the request
        netadr_t    remote_address;
    
        // Response RTT ping time
        double        ping;
        // Key/Value pair string ( separated by backlash \ characters )
        // WARNING:  You must copy this buffer in the callback function, because it is freed
        //  by the engine right after the call!!!!
        // ALSO:  For NETAPI_REQUEST_SERVERLIST requests, this will be a pointer to a linked list of net_adrlist_t's
        void        *response;
    } net_response_t;
    
    typedef struct net_status_s
    {
            // Connected to remote server?  1 == yes, 0 otherwise
        int            connected;
        // Client's IP address
        netadr_t    local_address;
        // Address of remote server
        netadr_t    remote_address;
        // Packet Loss ( as a percentage )
        int            packet_loss;
        // Latency, in seconds ( multiply by 1000.0 to get milliseconds )
        double        latency;
        // Connection time, in seconds
        double        connection_time;
        // Rate setting ( for incoming data )
        double        rate;
    } net_status_t;
    
    typedef struct net_api_s
    {
        // APIs
        void        ( *InitNetworking )( void );
        void        ( *Status ) ( struct net_status_s *status );
        void        ( *SendRequest) ( int context, int request, int flags, double timeout, struct netadr_s *remote_address, net_api_response_func_t response );
        void        ( *CancelRequest ) ( int context );
        void        ( *CancelAllRequests ) ( void );
        char        *( *AdrToString ) ( struct netadr_s *a );
        int            ( *CompareAdr ) ( struct netadr_s *a, struct netadr_s *b );
        int            ( *StringToAdr ) ( char *s, struct netadr_s *a );
        const char *( *ValueForKey ) ( const char *s, const char *key );
        void        ( *RemoveKey ) ( char *s, const char *key );
        void        ( *SetValueForKey ) (char *s, const char *key, const char *value, int maxsize );
    } net_api_t;
    
    extern net_api_t netapi;
    
    #endif // NET_APIH
    ivoicetweak.h access to voice functions, again not sure if this is of any use to adding hardware support
    Code:
    #ifndef IVOICETWEAK_H
    #define IVOICETWEAK_H
    #ifdef _WIN32
    #pragma once
    #endif
    
    // These provide access to the voice controls.
    typedef enum
    {
        MicrophoneVolume=0,            // values 0-1.
        OtherSpeakerScale            // values 0-1. Scales how loud other players are.
    } VoiceTweakControl;
    
    
    typedef struct IVoiceTweak_s
    {
        // These turn voice tweak mode on and off. While in voice tweak mode, the user's voice is echoed back
        // without sending to the server.
        int                (*StartVoiceTweakMode)();    // Returns 0 on error.
        void            (*EndVoiceTweakMode)();
      
        // Get/set control values.
        void            (*SetControlFloat)(VoiceTweakControl iControl, float value);
        float            (*GetControlFloat)(VoiceTweakControl iControl);
    } IVoiceTweak;
    
    
    #endif // IVOICETWEAK_H
    
    Snippet from cdll_dll.h, mentions new commands
    Code:
    // command handlers
        int                            ( *pfnAddCommand )            ( char *cmd_name, void (*function)(void) );
        int                            ( *pfnHookUserMsg )            ( char *szMsgName, pfnUserMsgHook pfn );
        int                            ( *pfnServerCmd )            ( char *szCmdString );
        int                            ( *pfnClientCmd )            ( char *szCmdString );
    It looks like you can make new variables too from a snippet here from voice_status.h
    Code:
    // Setup the voice_modenable cvar.
        gEngfuncs.pfnRegisterVariable("voice_modenable", "1", FCVAR_ARCHIVE);
    
        gEngfuncs.pfnRegisterVariable("voice_clientdebug", "0", 0);
    
        gEngfuncs.pfnAddCommand("voice_showbanned", ShowBannedCallback);
    There's also a lot in that file for mic


    I was looking for things specifically for hardware, there's a lot to look through. But it does look like there's a good chance to add 'dcmodem' and 'dcbba' commands to initialize the network in-game or by calling DC-WindowsCE functions. If so there's probably a chance to add microphone support and a server browser menu too

    But i'm not certain, so i'd really like to hear from someone with skill. This would be really awesome and maybe not as difficult as we thought
     
  11. Anthony817

    Anthony817 Familiar Face

    Joined:
    May 12, 2010
    Messages:
    1,078
    Likes Received:
    535
    Mic support would be interesting. How many games were supposed to support it? Just Alien front Online and Propeller Arena?
     
  12. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    Planet Ring did also. I'm pretty sure if you have a headset with usb power, 1/8" Mic input and a 1/8" audio input, you can use a usb AC adapter to power, plug the headset into the mic input on controller, and audio into RCA to 1/8" femaile. But i haven't tested myself. The point is it might not be as hard to do those things as we thought. But i could be wrong
     
  13. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I have been bumping this thread quite a lot lately,

    But i was looking into the connect commands now that i have CDs. Trying 'connect <anything>' outputs from console : Connecting to <anything>....
    Then, 'Retrying <anything>....' 4 times then says 'Failed to connect to <anything> after 4 retries'

    But running 'connect localhost' doesn't output anything, but after a minute or so it also says 'Failed to connect to localhost after 4 retries'. I tried both of those on pc but it loads infinitely

    Also running the connect command when in a singleplayer game disconnects you from the server ( in this case the SP game was the localserver ) and returns you to console, when replicated on pc this is also the same. Another very interesting thing is before Sizious's patch, just typing 'connect' in console says 'connect is not valid from the console'. Where after the patch just running 'connect' outputs 'usage: connect <server>'. Also replicated on steam pc version

    All further evidence that they function as they should, and should also allow for connecting to another dreamcast over the network with internet




    Edit: My main questions right now for this is are, what exactly can be done with the source in the HLSDK for a new game DLL? Does that allow you control of the OS also? What are the limits as to what can be added into the game engine that way?

    If you can call functions from OS, can't we just make a DLL that calls the CE network functions by running a command though console?
     
    Last edited: Oct 14, 2015
  14. FuzzyFish

    FuzzyFish Rising Member

    Joined:
    May 14, 2014
    Messages:
    56
    Likes Received:
    51
    The HLSDK wasn't meant to be used in that manner so I'm not certain you could hook into the native netcode, but a few mods did do this (MasterSword saves player information to a master server, a one off server mod we used in the 2000's connected to and communicated with a outside application so admins could monitor/interact and to track player data. So it might be entirely possible to use it for initialization of the modem/dialing.
     
  15. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I don't mean to hook the netcode, this is my logic but i have no idea how to code

    example code from hlsdk
    Code:
    int                            ( *pfnAddCommand )            ( char *cmd_name, void (*function)(void) );
    What should be tried
    Code:
    int                            ( *pfnAddCommand )            ( char *dcmodem, void (*WindowsCE_dial)(void) );
    Is it possible to give us some header files or excerpts of code for how 4x4 interacted with the windows ce kernel? I think with that as reference you could define the CE dial function above, then just assign the command. I may even try myself if i can compile the sources with dc-ce kit

    The HLSDK comes with source to compile a new dll for your mod, so it was meant in every way to use it in that manner. You mod that code to compile in DC-CE kit and that is how mods are played on dreamcast
    https://web.archive.org/web/2011012...piling-hl-sdk-dlls-dc-using-wince-devkit-3567

    So in my opinion, if you can use the OS functions or define them in the dll then it should be very possible to call them within the game. There is code to even mod the net api for purposes like you mentioned, but not sure if that allows as much that's needed to pull this off. That is what i'm trying to figure out for sure

    Again i'm being very open ended about this, but if someone wants to give this a try they don't have to figure all this out
     
  16. SiZiOUS

    SiZiOUS Spirited Member

    Joined:
    Mar 26, 2009
    Messages:
    118
    Likes Received:
    166
    The method you're describing here, is the 'hooking method' that I explained few days ago.

    So yes, it's possible. You can 'hook' any OS exported function, for ex DirectSoundCreate, calling your custom code (in our case, calling netplay code), then, calling the original DirectSoundCreate and send the result to the game. But I don't think it will be enough.
     
  17. FuzzyFish

    FuzzyFish Rising Member

    Joined:
    May 14, 2014
    Messages:
    56
    Likes Received:
    51
    I can not distribute it, but here is a summary of how to detect the modem.

    If you can get that to compile in a DLL the game can see, and using the DCSDK have it compile with a function using that code. Then you can use it to test for a modem.
     
    Anthony817 and TerdFerguson like this.
  18. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I must have misunderstood what hooking meant. I thought it was a different more challenging process



    Thanks Fuz for the example. Hopefully the header files are in the CE kit. I'm going to look into getting a new dll to compile. Then figure out how to add new code and compile something like Fuz posted for the modem into it. If anyone else looks into this too, HLSDK\common\net_api.h and HLSDK\common\netadr.h look interesting

    I'm sure someone that's ported a mod to DC already has the code to compile in DC-CE kit. Having the pre-ported code will help tremendously

    I don't mean to bump this thread at annoying levels, but this would be really awesome
     
  19. SiZiOUS

    SiZiOUS Spirited Member

    Joined:
    Mar 26, 2009
    Messages:
    118
    Likes Received:
    166
    No, it's the same technic but at different levels (sorry my english is bad, maybe that's the reason you didn't understood the first time).
    I think that'll need to do 2 things:
    • First of all we need to perform some WinCE API hooking by 'hijacking' imported API functions (DirectSoundCreate, CreateWindow, whatever). I think it's the best place to perform our net initialization code. We'll get an initialized socket from there.
    • Then we need to perform some 'deep hooking' for functions inside the game executable (i.e. not imported functions: internal subroutines) in order to use our 'initialized socket'.
    But maybe the usage of the game_dll directive will make the thing more simpler, I don't know.
    Anyway we need to validate the possibility to load custom game_dll before considering this option.
     
  20. TerdFerguson

    TerdFerguson ls ~/

    Joined:
    Apr 27, 2015
    Messages:
    664
    Likes Received:
    353
    I've been looking into this, but without the pre-ported code it may take a while. At least for myself with zero coding skill. I'm learning as i go along

    If you want to try to look into the custom dll, download the HLSDK http://www.moddb.com/games/half-life/downloads/half-life-sdk-23
    Assuming you have the WinCE kit installed, make a new 'Dreamcast Dynamic Link Library"
    Go to 'File view'
    Right click, 'add workspace into project', select HLSDK\Single Player Sources\dlls\hl.dsp
    By default, the .dsp is configured to a Win32 profile. You have to go into settings and copy the configs from the original Dreamcast DLL project to mimick the WinCE SH4 profile/configuration

    Then the code must be modified to compile on the SH4 configuration. I was trying and i'm at this "hl.dll - 30 error(s), 970 warning(s)"
    There's some info for compiling here https://web.archive.org/web/2011012...piling-hl-sdk-dlls-dc-using-wince-devkit-3567
    Having the SH4 compile ready code available to download will be a tremendous help too. For anyone else to help or try something, or for porting mp mods in the chance that this does work

    I was also looking into trying to import the headers/sources from kallistiOS for BBA/modem. Then assign the initialization functions to a new command. If i had some coding skill i think that could be done. But it might be better to try this using the WinCE functions. Since then there might not be a need for as much 'deep hooking'

    I would like to be able to help more, but all i can do is research. If/when you do look at the hlsdk sources in WinCE kit, let us know what you think can be done or what you will attempt. Thanks for your help Sizious



    Edit: I made a github for this. It will take awhile but at least others can contribute
    https://github.com/FaucetDC/HLDC_SDK
     
    Last edited: Oct 16, 2015
sonicdude10
Draft saved Draft deleted
Insert every image as a...
  1.  0%

Share This Page