Jump to content

Offline 2 player mod


benjamin94

Recommended Posts

Hey guys,

 

Im working on an offline 2 player mod. Where player 1 will just use mouse and keyboard like normal.

 

Then when the mod is loaded there will be spawned a new random ped. Which can be controlled with an USB gamepad.

 

I currently have the following features for player 2:

  • Walking around
  • Entering/exiting vehicles
  • Controlling vehicles
  • More to come!
Mod: https://www.gta5-mods.com/scripts/twoplayermod-net

 

Sick video :

 

Source code: https://github.com/BenjaminFaal/TwoPlayerMod

Please tell me what i should add or change!

Edited by benjamin94
  • Like 3
Link to comment
Share on other sites

InfamousSabre

Are you doing split-screen, or single camera that zooms in and out keeping both players in the frame?

 

If the former: How are you doing split-screen?

 

If the latter: Controls for both players will need to be changed. How do you plan to accomplish this? With one player driving, and one player doing a drive-by, you'll have to limit the angle the drive-by player can aim so that the drive-by player doesn't aim at something outside the camera view and so that the direction the driving player is driving is never out of the view.

Edited by InfamousSabre
Link to comment
Share on other sites

Are you doing split-screen, or single camera that zooms in and out keeping both players in the frame?

 

If the former: How are you doing split-screen?

 

If the latter: Controls for both players will need to be changed. How do you plan to accomplish this? With one player driving, and one player doing a drive-by, you'll have to limit the angle the drive-by player can aim so that the drive-by player doesn't aim at something outside the camera view and so that the direction the driving player is driving is never out of the view.

Currently im doing nothing special camera wise, but i think its almost impossible to have split screen. That would be very nice though.

Edited by benjamin94
Link to comment
Share on other sites

You can render a camera and display on screen.

I know but also 2 at once? One for the player and one for the second player?

Link to comment
Share on other sites

InfamousSabre

I will upload the first test version tomorrow morning!

Upload a video of it being played as well. I'd like to see what you've got so far.

Link to comment
Share on other sites

InfamousSabre

Looks like you got steering to work? Yeah I'd actually like to help with this. I'm always wanting to play with friends, and I don't like online games.

Link to comment
Share on other sites

Looks like you got steering to work? Yeah I'd actually like to help with this. I'm always wanting to play with friends, and I don't like online games.

Yeah man, take a look at the source code there is much room for improvement.

Link to comment
Share on other sites

Very nice work, always wanted something like this :beerhat:, probably the first of its kind for gta v

 

 

Yeah it's like drawing a rectangle on the screen lol.

Would it be possible to resize the main game camera so the new one doesn't overlap?

Edited by LS Savage
Link to comment
Share on other sites

InfamousSabre

 

Looks like you got steering to work? Yeah I'd actually like to help with this. I'm always wanting to play with friends, and I don't like online games.

Yeah man, take a look at the source code there is much room for improvement.

 

Just checked an I see you're using C#. Not much I can help with there I'm afraid. I might try this in C++ at some point. If I find anything of use, I'll be sure to share. For now, I'd try making Player2 an actual Player instead of just a Ped and go from there. Might help a bit.

Link to comment
Share on other sites

 

 

Looks like you got steering to work? Yeah I'd actually like to help with this. I'm always wanting to play with friends, and I don't like online games.

Yeah man, take a look at the source code there is much room for improvement.

 

Just checked an I see you're using C#. Not much I can help with there I'm afraid. I might try this in C++ at some point. If I find anything of use, I'll be sure to share. For now, I'd try making Player2 an actual Player instead of just a Ped and go from there. Might help a bit.

 

I understand what you mean and i tried it already but its not working, there is almost no way to 'add' that player to the game.

 

Unless ofcourse you know something?

Link to comment
Share on other sites

InfamousSabre

 

 

 

Looks like you got steering to work? Yeah I'd actually like to help with this. I'm always wanting to play with friends, and I don't like online games.

Yeah man, take a look at the source code there is much room for improvement.

 

Just checked an I see you're using C#. Not much I can help with there I'm afraid. I might try this in C++ at some point. If I find anything of use, I'll be sure to share. For now, I'd try making Player2 an actual Player instead of just a Ped and go from there. Might help a bit.

 

I understand what you mean and i tried it already but its not working, there is almost no way to 'add' that player to the game.

 

Unless ofcourse you know something?

 

I don't know how you'd create a new Player. I was just thinking along the lines of Vehicles probably would work properly only if they had a Player in the driver's seat. Really not sure.

Link to comment
Share on other sites

 

 

 

 

Looks like you got steering to work? Yeah I'd actually like to help with this. I'm always wanting to play with friends, and I don't like online games.

Yeah man, take a look at the source code there is much room for improvement.

 

Just checked an I see you're using C#. Not much I can help with there I'm afraid. I might try this in C++ at some point. If I find anything of use, I'll be sure to share. For now, I'd try making Player2 an actual Player instead of just a Ped and go from there. Might help a bit.

 

I understand what you mean and i tried it already but its not working, there is almost no way to 'add' that player to the game.

 

Unless ofcourse you know something?

 

I don't know how you'd create a new Player. I was just thinking along the lines of Vehicles probably would work properly only if they had a Player in the driver's seat. Really not sure.

 

Unfortunately its not that simple, i think it requires some sort of native but to find that it would be really hard.

Link to comment
Share on other sites

I think you could directly control a vehicle if you knew how to access their properties properly? What about spawning a vehicle, getting its' properties that matter and are exclusively related to user input (throttle, brake, steering) and let the script change those values? You'd spawn the vehicle, look at it's data when you do something, then spawn a driving bodyguard and see what a ped does (what instructions/functions write to these properties), and then to figure out how to pass user controls through to a non-player controlled vehicle.

 

This way doesn't use many natives though, and it's a bit low level. You'd need to extract the MemoryAccess class, modify it and re-include it again in your .net script (or make it a library) and from there access the vehicle's memory structure.

Link to comment
Share on other sites

I think you could directly control a vehicle if you knew how to access their properties properly? What about spawning a vehicle, getting its' properties that matter and are exclusively related to user input (throttle, brake, steering) and let the script change those values? You'd spawn the vehicle, look at it's data when you do something, then spawn a driving bodyguard and see what a ped does (what instructions/functions write to these properties), and then to figure out how to pass user controls through to a non-player controlled vehicle.

 

This way doesn't use many natives though, and it's a bit low level. You'd need to extract the MemoryAccess class, modify it and re-include it again in your .net script (or make it a library) and from there access the vehicle's memory structure.

I understand your point but I don't have time to do all this. It seems you know quite much about it so I challenge you to do it if you want. The code is open source on github.com so.

Link to comment
Share on other sites

Very interesting mod.

 

Wasn't aware of the TASK_VEHICLE_TEMP_ACTION native you are using http://www.dev-c.com/nativedb/func/info/c429dceeb339e129

 

As part of the scene director mod I have implemented recording of actions which can then later be replayed.

C++ source is available at https://github.com/elsewhat/gtav-mod-scene-directorand may be relevant here.

 

When attempting to use the natives to replay actions you quickly run into limitations that can be hard to get workarounds for. So I agree with ikt suggestion that the best approach is to not use the natives for such a mod (but have not dwelved into the memory access area myself)

Link to comment
Share on other sites

Very interesting mod.

 

Wasn't aware of the TASK_VEHICLE_TEMP_ACTION native you are using http://www.dev-c.com/nativedb/func/info/c429dceeb339e129

 

As part of the scene director mod I have implemented recording of actions which can then later be replayed.

C++ source is available at https://github.com/elsewhat/gtav-mod-scene-directorand may be relevant here.

 

When attempting to use the natives to replay actions you quickly run into limitations that can be hard to get workarounds for. So I agree with ikt suggestion that the best approach is to not use the natives for such a mod (but have not dwelved into the memory access area myself)

I agree with the spamming native calls, therefore i added an instance variable which stores the latest vehicle action and checks if it differs in the current tick it will call the native otherwise it wont do anything.

Link to comment
Share on other sites

  • 4 weeks later...

 

Yeah it's like drawing a rectangle on the screen lol.

Im sorry, can you explain a bit more?

 

This is something I'm really curious about also.

The possibility of a split-screen experience is very exciting.

 

Apologies for the bump.

Link to comment
Share on other sites

  • 2 months later...
RonnyConny

Got split-screen to work but the controls are f*cked up

Edited by RonnyConny
Link to comment
Share on other sites

Got split-screen to work but the controls are f*cked up

 

This would be a huge boon to the co-op crowd. Even for movie makers. A car chase for the ages.

 

Thanks for the hard work put in so far.

Link to comment
Share on other sites

Got split-screen to work but the controls are f*cked up

I assume that the players can't get to far from each other ether, otherwise the map will start reducing in quality and collisions will disappear for the second player. Am I right?

Link to comment
Share on other sites

RonnyConny

I have it running on two 50 inch LCD TV's. Player one that uses keyboard and mouse works perfect until the player on xbox controller mess it up by controlling them both with the xbox controller.

Here is what i did:

  1. Made a copy of playGTAV.exe (name it whatever).
  2. Started one of the playGTAV.exe.
  3. Make sure auto sign-in is enabled and remember me.
  4. Disconnect from internet or block gta in the firewall.
  5. Start second playGTAV.exe in offline mode.
  6. Disable pause game when alt-tabbed (Settings).
  7. Change player name in the GTACOOPSettings.xml.
  8. Start the server.exe mod-file.
  9. Hit f9 and enter localhost under ip in both games and connect.

Only problem is that my wireless xbox 360 controller controls both of the games.

To solve that tried a cheap solution by using keysticks.

I configured new keyboard keybindings in the non keyboard GTA game and configured the new keys in keysticks.

It worked until I unfocused that game to control the other game with keyboard and mouse.

 

How do I solve this? if only rockstar patched the game so gamepads can be disabled in game it would work flawless.. any other way around? injector?

Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 2 Users Currently Viewing
    0 members, 0 Anonymous, 2 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.