codenamecpp / carnage3d

Reimplementation of Grand Theft Auto 1 [GTA1]
MIT License
470 stars 38 forks source link

Cannot map different players to same keyboard #45

Closed mossymossmoss closed 3 years ago

mossymossmoss commented 3 years ago

In earlier builds, you used to be able to map multiple people to a single keyboard, but that doesn't seem to be the case. Here is my inputs.json file:

{ "player1": { "gamepad_id": "Gamepad1", "actions": [ // common {"action":"NextWeapon", "keycode":"2", "gpbutton":"LeftBumper"}, {"action":"PrevWeapon", "keycode":"1", "gpbutton":"RightBumper"}, // on foot {"action":"TurnLeft", "keycode":"a", "gpbutton":"Left"}, {"action":"TurnRight", "keycode":"d", "gpbutton":"Right"}, {"action":"Jump", "keycode":"q", "gpbutton":"LeftTrigger"}, {"action":"WalkBackward", "keycode":"s", "gpbutton":"Down"}, {"action":"Run", "keycode":"w", "gpbutton":"Up"}, {"action":"Shoot", "keycode":"z", "gpbutton":"B"}, {"action":"EnterCar", "keycode":"e", "gpbutton":"X"}, {"action":"EnterCarAsPassenger", "keycode":"x", "gpbutton":"A"},
// in car {"action":"HandBrake", "keycode":"q", "gpbutton":"Y"}, {"action":"Accelerate", "keycode":"w", "gpbutton":"Up"}, {"action":"Reverse", "keycode":"s", "gpbutton":"Down"}, {"action":"SteerLeft", "keycode":"a", "gpbutton":"Left"}, {"action":"SteerRight", "keycode":"d", "gpbutton":"Right"}, {"action":"Horn", "keycode":"3", "gpbutton":"A"}, {"action":"LeaveCar", "keycode":"e", "gpbutton":"X"} ] }, "player2": { "gamepad_id": "Gamepad2" "actions": [ // common {"action":"NextWeapon", "keycode":"5", "gpbutton":"LeftBumper"}, {"action":"PrevWeapon", "keycode":"4", "gpbutton":"RightBumper"}, // on foot {"action":"TurnLeft", "keycode":"f", "gpbutton":"Left"}, {"action":"TurnRight", "keycode":"h", "gpbutton":"Right"}, {"action":"Jump", "keycode":"r", "gpbutton":"LeftTrigger"}, {"action":"WalkBackward", "keycode":"g", "gpbutton":"Down"}, {"action":"Run", "keycode":"t", "gpbutton":"Up"}, {"action":"Shoot", "keycode":"v", "gpbutton":"B"}, {"action":"EnterCar", "keycode":"y", "gpbutton":"X"}, {"action":"EnterCarAsPassenger", "keycode":"b", "gpbutton":"A"},
// in car {"action":"HandBrake", "keycode":"r", "gpbutton":"Y"}, {"action":"Accelerate", "keycode":"t", "gpbutton":"Up"}, {"action":"Reverse", "keycode":"g", "gpbutton":"Down"}, {"action":"SteerLeft", "keycode":"f", "gpbutton":"Left"}, {"action":"SteerRight", "keycode":"h", "gpbutton":"Right"}, {"action":"Horn", "keycode":"6", "gpbutton":"A"}, {"action":"LeaveCar", "keycode":"y", "gpbutton":"X"} ] }, "player3": { "gamepad_id": "Gamepad3" }, "player4": { "gamepad_id": "Gamepad4" } }

I only have ps4 controllers, so i was trying to map each player to the keyboard and then use a joystick mapper on top of that, however, running this results in this error:

carnage3d-debug: ../src/FileSystem.cpp:250: bool FileSystem::ReadConfig(const std::string &, cxx::json_document &): Assertion `false' failed. ./Play.sh: line 1: 6884 Aborted (core dumped) ./bin/carnage3d-debug -mapname SANB.CMP -gtadata "gamedata/fullversion/GTADATA" -numplayers 2

Any ideas on how to get this to work?

codenamecpp commented 3 years ago

You forgot to put a comma after "Gamepad2". Besides that everything should work fine, i just checked

mossymossmoss commented 3 years ago

Oof, dumb mistake sorry :sweat_smile: