• View unanswered postsView active topics

  • [WIP] SplitWolf with separate game controllers

    No "Sonder" discussion is allowed here! Posts will be deleted

    Postby lazd 23 Oct 2018, 08:12

    After talking with @DoomJedi and @linuxwolf about wolf4sdl on RetroPie, I decided to implement separate game controller support for SplitWolf, so now you can plug in a couple USB gamepads and start splattering Nazis with your friends on the big screen.

    Several new control settings have been added, including the ability to disable forward/back mouse movement:
    Image

    Gamepads can be bound with all sorts of actions:
    Image

    Keyboards got some love too, with the ability to map new actions:
    Image

    The code is here: https://bitbucket.org/lazd/split_wolf4s ... rc/master/

    I've implemented the following:

    Features:

    • GameController support with SDL2
    • Embedded GameController_DB SDL2 mappings for all known gamepads
    • Support multiple gamepads
    • Support remapping all 13 supported gamepad buttons
    • Support gamepads with dpad only
    • Support mapping strafe left/right, weapon prev/next, minimap, escape to gamepad buttons
    • Support mapping strafe left/right and weapon prev/next to keyboard keys
    • Support enabling/disabling moving with mouse
    • Let any gamepad control menus by pressing a button°
    • Let any gamepad pause/escape the game
    ° Also switches control context for remapping controls, unless you're actively remapping controls

    Chores:
    • Moved to SDL2
    • Reorganize control menu so Split Screen Settings is on top
    • Make menus more maintainable with UI constants
    • Consistently print ? for unbound mouse/gamepad buttons instead of blank space

    Bug fixes:
    • Fix segfaults on macOS
    • Fix menu item borders and gun overdraw
    • Allow exiting Split Screen Settings with gamepad
    • Use correct control style, sound, and text gap for radio buttons
    • Workaround RetroPie's triggers_to_buttons breaking XBox One controllers †
    † This will need to be done manually for other controllers that have analog triggers if we want to support them on RetroPie, otherwise users will have to edit /etc/modprobe.d/xpad.conf and set triggers_to_buttons=0 for SDL to recognize their controller

    Testing

    Here's how to test it on *nix.

    Code: Select all
    cd ~/RetroPie/roms/ports
    git clone --revcursive https://bitbucket.org/linuxwolf6/splitwolf.git
    cd splitwolf
    sudo apt-get install libsdl2-dev libsdl2-mixer-dev
    make DATADIR="./"
    # copy your game files directly into the splitwolf folder
    ./splitwolf-wolf3d_full --split 2 --splitlayout 2x1


    Here's how to test it on RetroPie (or other *nix). Run the following commands over SSH, restart Emulation Station, then select SplitWolf or SplitWolfSOD from the Ports menu.

    1. Optional: Copy all of your Wolf3D Full and SoD game files to roms/ports/splitwolf/
    2. Run these commands
    Code: Select all
    cd ~/RetroPie-Setup
    git remote add lazd https://github.com/lazd/RetroPie-Setup.git
    git fetch lazd
    git checkout splitwolf

    3. Run RetroPie Setup
    4. Select "Manage Packages" -> "Manage optional packages" -> "splitwolf" -> "Install from binary" or "Install from source"

    Here's how to test it on macOS. Run the following commands in the Terminal:

    Code: Select all
    git clone --revcursive https://bitbucket.org/linuxwolf6/splitwolf.git
    brew install sdl2 sdl2_mixer
    make DATADIR="./"
    # copy your game files directly into the splitwolf folder
    ./splitwolf-wolf3d_full --split 2 --splitlayout 2x1


    It should build fine on any *nix, but I haven't done anything to fix cross-compiling as I've never dealt with development in Windows before. With a little guidance, I'm sure I can make it work, or maybe @linuxwolf can make it happen more easily than me.

    I've tested it on macOS and RetroPie (Raspbian Stretch) on a Raspberry Pi 3 B+, and it's working great. I've tested the following controller configurations:

    • XBox One Controller over USB
    • Logitech Dual Action Controller
    • Retrolink SNES Controller (iNNEXT)
    • Keyboard
    • Keyboard and mouse

    Remaining Issues

    • ◻️Ability to assign mouse to a given player
    • ◻️Ability to choose which player uses which gamepad (maybe?)
    • ☑️Fix joysticks coming in with random order (gamepad 0 can be gamepad 1 between runs)
    • ☑️Add per-gamepad sensitivity settings (so you can turn faster without pressing run)
    • ☑️Ability to map minimap to button on gamepad
    • ☑️Fix feel of analog triggers (too sensitive)
    • ☑️Ability to map pause to button on gamepad
    • ☑️Ability to zoom minimap with gamepad
    • ☑️Ability to map change player color key on gamepad
    • ☑️Ability to map strafe left / right buttons on gamepad
    • ☑️Ability to map turn left / right buttons on gamepad
    • ☑️Test UI with Spear of Destiny (menus are likely totally messed up)
    • ☑️Fix incorrect (zoomed in) display at resolutions other than 640x400
    • ◻️Test on Windows
    • ◻️Test UI with Japanese release
    • ◻️Test UI with Spanish internationalization
    • ◻️Make sure all GameController_DB entries are being read in correctly (existing solution is super hacky, relies on grep), or switch to gamecontrollerdb.txt
    • ◻️Window cross-compilation support
    • ☑️Code review! I've hacked my way through this, and I doubt I've done it the most optimal way. My C++ skills aren't the best either, so I'm sure I've done a few things wrong.
    • ☑️Proper RetroPie package, installation, and setup scripts
    • ◻️Fix crash when resuming 1 player game after changing Split Screen Settings player count to 2
    • ◻️Fix SoD logo disappearing when navigating back to main menu

    Please test this and let me know what you think! I look forward to addressing any feedback and getting this contribution up to Team RayCast standards!

    Thanks

    Big thanks to @DoomJedi and @linuxwolf and the rest of Team RayCast for their amazing work on SplitWolf and for sharing the code. Thanks to @ioan-chera his SDL2 port of wolf4sdl, it was instrumental and making this happen.
    Last edited by lazd on 03 Nov 2018, 19:25, edited 26 times in total.
    lazd

     
    Posts: 23

       

    The following user would like to thank lazd for this post
    DoomJedi

    Postby DoomJedi 23 Oct 2018, 08:27

    Cool news, will have to try it *Joystick*

    Is it the time to post the news on retropie groups? We can get much wider testing with their help
    DoomJedi
    User avatar
    Administrator
    Administrator
     
    Posts: 14227
    Location: Israel

        

    Postby lazd 23 Oct 2018, 08:43

    DoomJedi wrote:Is it the time to post the news on retropie groups? We can get much wider testing with their help


    Not yet, let me see what is involved to make a RetroPie package, perhaps we can make the install easier. Right now, let's test this with the various supported game files and fix a few things first. I'm sure we'll find issues that we need to correct right away, better to get those fixed now then have them complicate wider testing.
    lazd

     
    Posts: 23

       

    The following user would like to thank lazd for this post
    DoomJedi

    Postby DoomJedi 23 Oct 2018, 20:39

    Image
    DoomJedi
    User avatar
    Administrator
    Administrator
     
    Posts: 14227
    Location: Israel

        

    Postby lazd 23 Oct 2018, 21:00

    DoomJedi wrote:Image

    Weird, that output looks fine, wonder why WinSCP doesn't like it.

    Get PuTTY so you can properly SSH in: https://www.chiark.greenend.org.uk/~sgt ... atest.html

    Get on Discord and I'll help you in real time.
    lazd

     
    Posts: 23

       

    Postby DoomJedi 23 Oct 2018, 21:01

    I try to run it, it works fine it seems, it's just that I don't get splitscreen. Just single player.
    How to get splitscreen?
    DoomJedi
    User avatar
    Administrator
    Administrator
     
    Posts: 14227
    Location: Israel

        

    Postby lazd 23 Oct 2018, 21:05

    DoomJedi wrote:I try to run it, it works fine it seems, it's just that I don't get splitscreen. Just single player.
    How to get splitscreen?


    You need to go into Control -> Split Screen Settings -> Players -> 2

    Either that, or edit the shell script to pass the following when running the executable: --split 2 --splitlayout 2x1

    Does your game controller work??
    lazd

     
    Posts: 23

       

    Postby DoomJedi 23 Oct 2018, 21:18

    Got splitscreen to work.
    Controllers work.

    Player sprites do not display right sprite but "Demo" sprite.
    Something wrong with lwmp folder integration, sprites from there do not load, none of those.

    Also player hand is grey and not green.
    SplitWolf also has "c" key to change player skin colors, can this be implemented too? Players looking same color is confusing.
    DoomJedi
    User avatar
    Administrator
    Administrator
     
    Posts: 14227
    Location: Israel

        

    Postby lazd 23 Oct 2018, 21:21

    DoomJedi wrote:Got splitscreen to work.
    Controllers work.

    Player sprites do not display right sprite but "Demo" sprite.
    Something wrong with lwmp folder integration, sprites from there do not load, none of those.

    Also player hand is grey and not green.
    SplitWolf also has "c" key to change player skin colors, can this be implemented too? Players looking same color is confusing.


    Glad to hear controllers work!

    Sounds like copying the lwmp/ folder did not work. Make sure it's there, I copied mine from the Splitwolf release package and it worked perfectly (I had the demo issue too until I did this). I think the one included in the games/lwmp/ folder is missing tons of stuff, upload it manually using the lwmp/ folder from a Splitwolf release.

    Yes, I can add support for binding the player skin color change, but they will be correct colors by default once you have the lwmp/ folder in there properly.
    lazd

     
    Posts: 23

       

    Postby DoomJedi 23 Oct 2018, 21:24

    The folder is on retropie, I checked it before, all the art is there.
    Maybe it's installed by default in the wrong folder/subfolder?
    DoomJedi
    User avatar
    Administrator
    Administrator
     
    Posts: 14227
    Location: Israel

        

    Postby lazd 23 Oct 2018, 21:26

    DoomJedi wrote:The folder is on retropie, I checked it before, all the art is there.
    Maybe it's installed by default in the wrong folder/subfolder?


    Hmmm, delete the lwmp/ folder and reupload it from a Splitwolf release. I just checked, and the folder that my instructions copies has only 120 sprites, whereas the Splitwolf release has 145. That is definitely the problem.
    lazd

     
    Posts: 23

       

    Postby DoomJedi 23 Oct 2018, 21:38

    Reuploaded the dropbox art folder I have, doesn't help.
    Can LinuxWolf supply the definite art folder his code refers to?
    ...also I'm not sure that's the issue.
    What is the chance for all player sprites (!) and for flag carrying sprites to happen to be part of those non-copied files?

    Also, SplitWolf defaults to 1 player each time, doesn't save 2-player config settings.
    DoomJedi
    User avatar
    Administrator
    Administrator
     
    Posts: 14227
    Location: Israel

        

    Postby DoomJedi 23 Oct 2018, 21:43

    Game Mode icons are not there, all art that I know IS in those retropie folders is not loaded...none of it
    DoomJedi
    User avatar
    Administrator
    Administrator
     
    Posts: 14227
    Location: Israel

        

    Postby lazd 23 Oct 2018, 21:45

    DoomJedi wrote:Game Mode icons are not there, all art that I know IS in those retropie folders is not loaded...none of it


    This is very odd, it works perfectly here. Go here and download the Splitwolf release, and upload that lwmp/ folder: https://www.moddb.com/mods/splitwolf/do ... litwolf-10
    lazd

     
    Posts: 23

       

    Postby lazd 23 Oct 2018, 21:46

    DoomJedi wrote:Reuploaded the dropbox art folder I have, doesn't help.
    Can LinuxWolf supply the definite art folder his code refers to?
    ...also I'm not sure that's the issue.
    What is the chance for all player sprites (!) and for flag carrying sprites to happen to be part of those non-copied files?

    Also, SplitWolf defaults to 1 player each time, doesn't save 2-player config settings.


    Yeah, it defaults to one player every time. You can modify the shellscript to enable two players by default like I mentioned.

    Maybe your lwmp/ folder is named wrong? or uppercase? It's working here on multiple platforms using the lwmp/ folder from the Splitwolf release, so the issue is definitely on your end.

    I just did a side-by-side comparison of what is in the lwmp/ folder in SplitWolf release and what is there in the repo: It is indeed missing all of the flag carrying sprites as well as the icons for game modes. This is definitely the issue.
    lazd

     
    Posts: 23

       

    Next

    Return to Team Raycast Mods Discussion


    Who is online

    Users browsing this forum: No registered users and 7 guests

    cron