{"author_link":"\/users\/dock-frankenstein","author_name":"Dock Frankenstein","author_uid":"dock-frankenstein","comments":[],"epoch":1664394103,"event":"LD51","format":"md","ldjam_node_id":300615,"likes":3,"metadata":{"p_key":"166699","p_author":"Dock Frankenstein","p_authorkey":"1121145","p_urlkey":"393114","p_title":"Fixing my Input System for Ludum Dare Day 3","p_cat":"LDJam ","p_event":"LD51","p_time":"1664394103","p_likes":"3","p_comments":"0","p_status":"WAYBACK","us_key":"1121145","us_name":"Franciszek Pyr\u0107","us_username":"franciszek-pyrc","event_start":"1664496000","event_key":"114","event_name":"Ludum Dare 51"},"node":{"_collation":{"body_sanitizer":"TextUtils::SanitizeHTML via existing importer","event":"LD51","removed_author":false},"_superparent":296586,"_trust":8,"author":121145,"body":"Welcome back to this weird series where **I refuse to just use Unity's Input System and crunch before jam for no reason**. Luckily, I have made good progress this day, so I hope the pain will go away soon :)\n\n# Reading input\nFinally, **I am able to read device input**. It was surprisingly easy, as I had all of the device code already written. I just had to modify a couple lines of code to make it work with the recent changes and here we are.\n\n![IMG_20220928_213035595.jpg](\/\/\/raw\/939\/d1\/z\/4ee93.jpg)\n\nFor reading gamepads **I'm using Unity's Input Manager, which isn't great**. The main issue with it is that **it changes it's mappings between operating systems**. It's working ok on my windows computer, but I have no idea what will happen if someone plays my game on a macbook. This is why I need XInput, because I do not have the resources nor time to worry about this (also, you can't use vibration for some reason).\n\n![IMG_20220928_213050687.jpg](\/\/\/raw\/939\/d1\/z\/4ee94.jpg)\n\n**Gamepad deadzones are also working**. Even **my drunk xbox360 controllers stay on 0,0 when I'm not touching them**. This was also quite easy to setup, as I just copied code from [Unity's own Input System](https:\/\/github.com\/Unity-Technologies\/InputSystem\/blob\/develop\/Packages\/com.unity.inputsystem\/InputSystem\/Controls\/Processors\/AxisDeadzoneProcessor.cs#L54).\n\n# Saving & loading\n**I have managed to add a very temporary save system**. In the old version of Cablebox, you can select how the preferences get saved. In this version I want to allow people to even make custom providers. However: I don't have time for this, so I settled on **a basic json serializer**.\n\n![Screenshot 2022-09-28 213141.png](\/\/\/raw\/939\/d1\/z\/4ee92.png)\n\n**Cablebox also has multiplayer support**, which means that there can be multiple players with different inputs and bindings. **I temporary forced Cablebox to add every device to the first player, because of saving**. It's not like I'm gonna be making a multiplayer game any time soon (and especially on LD).\n\n# Remaining systems\nI am really close to finishing and I have 2 main features remaining:\n- input remapping\n- xinput gamepads\n\nInput remapping should be easy (famous last words) and I will have to look into how xinput works. For now, that's all I have. See you tomorrow\n\n![Screenshot 2022-09-28 213748.png](\/\/\/raw\/939\/d1\/z\/4ee95.png)","comments":4,"comments-timestamp":"2022-09-29T11:00:29Z","created":"2022-09-28T16:30:48Z","files":[],"files-timestamp":0,"id":300615,"love":3,"love-timestamp":"2022-09-28T20:48:06Z","meta":[],"modified":"2022-09-29T11:00:29Z","name":"Fixing my Input System for Ludum Dare Day 3","node-timestamp":"2022-09-28T19:41:43Z","parent":296630,"parents":[1,5,9,296586,296630],"path":"\/events\/ludum-dare\/51\/estolec\/fixing-my-input-system-for-ludum-dare-day-3","published":"2022-09-28T19:41:43Z","scope":"public","slug":"fixing-my-input-system-for-ludum-dare-day-3","subsubtype":"","subtype":"","type":"post","version":925666},"node_metadata":{"n_key":"300615","n_urlkey":"393114","n_parent":"296630","n_path":"\/events\/ludum-dare\/51\/estolec\/fixing-my-input-system-for-ludum-dare-day-3","n_slug":"fixing-my-input-system-for-ludum","n_type":"post","n_subtype":"","n_subsubtype":"","n_author":"121145","n_created":"1664382648","n_modified":"1664449229","n_version":"925666","n_status":"WAYBACK"},"source_url":"https:\/\/ldjam.com\/events\/ludum-dare\/51\/estolec\/fixing-my-input-system-for-ludum-dare-day-3","text":"Welcome back to this weird series where **I refuse to just use Unity's Input System and crunch before jam for no reason**. Luckily, I have made good progress this day, so I hope the pain will go away soon :)\n\n# Reading input\nFinally, **I am able to read device input**. It was surprisingly easy, as I had all of the device code already written. I just had to modify a couple lines of code to make it work with the recent changes and here we are.\n\n![IMG_20220928_213035595.jpg](\/\/\/raw\/939\/d1\/z\/4ee93.jpg)\n\nFor reading gamepads **I'm using Unity's Input Manager, which isn't great**. The main issue with it is that **it changes it's mappings between operating systems**. It's working ok on my windows computer, but I have no idea what will happen if someone plays my game on a macbook. This is why I need XInput, because I do not have the resources nor time to worry about this (also, you can't use vibration for some reason).\n\n![IMG_20220928_213050687.jpg](\/\/\/raw\/939\/d1\/z\/4ee94.jpg)\n\n**Gamepad deadzones are also working**. Even **my drunk xbox360 controllers stay on 0,0 when I'm not touching them**. This was also quite easy to setup, as I just copied code from [Unity's own Input System](https:\/\/github.com\/Unity-Technologies\/InputSystem\/blob\/develop\/Packages\/com.unity.inputsystem\/InputSystem\/Controls\/Processors\/AxisDeadzoneProcessor.cs#L54).\n\n# Saving & loading\n**I have managed to add a very temporary save system**. In the old version of Cablebox, you can select how the preferences get saved. In this version I want to allow people to even make custom providers. However: I don't have time for this, so I settled on **a basic json serializer**.\n\n![Screenshot 2022-09-28 213141.png](\/\/\/raw\/939\/d1\/z\/4ee92.png)\n\n**Cablebox also has multiplayer support**, which means that there can be multiple players with different inputs and bindings. **I temporary forced Cablebox to add every device to the first player, because of saving**. It's not like I'm gonna be making a multiplayer game any time soon (and especially on LD).\n\n# Remaining systems\nI am really close to finishing and I have 2 main features remaining:\n- input remapping\n- xinput gamepads\n\nInput remapping should be easy (famous last words) and I will have to look into how xinput works. For now, that's all I have. See you tomorrow\n\n![Screenshot 2022-09-28 213748.png](\/\/\/raw\/939\/d1\/z\/4ee95.png)","title":"Fixing my Input System for Ludum Dare Day 3","wayback_source":[]}