Quantcast
Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
    1. Welcome to GTAForums!

    1. GTA Online

      1. The Diamond Casino Heist
      2. Find Lobbies & Players
      3. Guides & Strategies
      4. Vehicles
      5. Content Creator
      6. Help & Support
    2. Red Dead Online

      1. Frontier Pursuits
      2. Find Lobbies & Outlaws
      3. Help & Support
    3. Crews

      1. Events
    1. Red Dead Redemption 2

      1. PC
      2. Gameplay
      3. Missions
      4. Help & Support
    2. Red Dead Redemption

    1. Grand Theft Auto Series

    2. GTA 6

    3. GTA V

      1. PC
      2. Guides & Strategies
      3. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
      5. GTA IV Mods
    5. GTA Chinatown Wars

    6. GTA Vice City Stories

    7. GTA Liberty City Stories

    8. GTA San Andreas

      1. Guides & Strategies
      2. Help & Support
      3. GTA SA Mods
    9. GTA Vice City

      1. Guides & Strategies
      2. Help & Support
      3. GTA VC Mods
    10. GTA III

      1. Guides & Strategies
      2. Help & Support
      3. GTA III Mods
    11. Top Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. DYOM
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Programming
      5. Movies & TV
      6. Music
      7. Sports
      8. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    3. Gangs

    1. News

    2. Forum Support

    3. Site Suggestions

benjamin94

Offline 2 player mod

Recommended Posts

benjamin94

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
benjamin94

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

Share this post


Link to post
Share on other sites
jedijosh920

You can render a camera and display on screen.

Share this post


Link to post
Share on other sites
benjamin94

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?

Share this post


Link to post
Share on other sites
jedijosh920

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

Share this post


Link to post
Share on other sites
benjamin94

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

Im sorry, can you explain a bit more?

Share this post


Link to post
Share on other sites
benjamin94

I will upload the first test version tomorrow morning!

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
benjamin94

 

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.

Here is the mod (pending approval): https://www.gta5-mods.com/scripts/twoplayermod-net

 

And the video is here:

Share this post


Link to post
Share on other sites
benjamin94

Project is now fully open source: https://github.com/BenjaminFaal/TwoPlayerMod
I dont have much time to maintain but i will let others make pull requests and then i can upload newer versions!

Edited by benjamin94
  • Like 3

Share this post


Link to post
Share on other sites
cp1dell

Project is now fully open source

You're a good guy.

  • Like 1

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
benjamin94

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.

Share this post


Link to post
Share on other sites
LS Savage

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
benjamin94

 

 

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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites
benjamin94

 

 

 

 

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.

Share this post


Link to post
Share on other sites
ikt

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.

Share this post


Link to post
Share on other sites
benjamin94

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.

Share this post


Link to post
Share on other sites
elsewhat

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)

Share this post


Link to post
Share on other sites
benjamin94

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.

Share this post


Link to post
Share on other sites
Jackoozy

 

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.

Share this post


Link to post
Share on other sites
RonnyConny

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

Edited by RonnyConny
  • Like 1

Share this post


Link to post
Share on other sites
ffzero58

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.

Share this post


Link to post
Share on other sites
nkjellman

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?

Share this post


Link to post
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?

Share this post


Link to post
Share on other sites
Ghostt

Please update. This mod was great but no longer works. Really wanna play this with friends :(

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

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