GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Anything to do with GTA1/GTA2 modding (tools, scripts and more).
robotanarchy
Car Jacker
Car Jacker
Posts: 48
Joined: 22 Apr 2013, 22:48
GH nick: robotanarchy
Contact:

GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by robotanarchy »

TL;DR: Mod is in progress, all technically required parts are there, but it needs lots of work! Nothing playable yet! Check the github page for the last version!

2015-08: Summary of what has happened so far.

Hello there, this is my first post!

Although my nickname is registered since 2013-04 (I already forgot about it lol), I haven't really been reading these forums. It is amazing how active the GTA2 community still is, even 15 years after the game has been released!

Anyway, two years ago, I have experimented with a splitscreen mod for GTA2. I was able to start multiple instances and even to mash all window instances into one big window, so it really looks like the real deal. Sound was playing in all instances at once (this is good, we can disable radio anyway), almost everything was working already.

Except for the input, that didn't work at all. When one screen has focus, you can only control that window! Besides, when playing with up to 6 players, we should have some decent gamepad support (which the current GTA2 is lacking of - try to map buttons on a Xbox360 controller and you will see, that you can't even use every single axis).

This has stopped me and I lost interest after a month or so. One year later, the exact same thing happened; I started to rewrite my window merge code to support more than two players and automate some more stuff, but I still couldn't get input working. I had a different approach at this point though (not sure if it was in 2012 or 2013): Use a proxy DLL for dmavideo.dll, that somehow handles the controller input and directly changes the players movement in RAM.

Then again, about two weeks ago, I've picked up interest in the project again. And this time I got the missing piece: I took the code from the proxy DLL I have already made and included a TCP server this time. It might sound strange, but that allows me to keep the code that actually talks to the gamecontroller out of the GTA2.exe process - and even to have just one program, that makes use of all controllers!

Basically, this is the current state of the project.

I would have waited until there's some kind of playable demo, but today I've discovered that there are two threads related to a possible splitscreen mod alone in these forums, so I figured out that it would make sense to publish the current state of my work here, too.

About the project name: To make the splitscreen mod work, we also need the controller abstraction code (which might be useful as standalone, too!). So the "Hackers Remix" is some kind of meta project, that includes both the gamepad mod and the splitscreen mod (later I'm planning to include a custom menu for setting up splitscreen games, that can be controlled with the controller and some other features).

Enough of the introduction, here are the links:
  • github page full of tech info and the source code (I'm a fan of open source software), probably boring if you're not a coder
  • screenshot page, currently only from 2012, 2013
    @Sektor: I circumvented the 'not multiple instances on one PC' issue by connecting to different hostnames. Eg, 127.0.0.1, localhost, $external_ip1, $external_ip2 - this did the trick! I guess it is not needed anymore, but I've planned to either ship OpenVPNs fake TUN adapter to generate fake TCP devices with their own external IP or (even better) to modify the host file and add localhost2, localhost3 etc.
If you have any questions about my implementation, just ask me :)

PS: The idea is not, that everyone starts forking and creating their own splitscreen implementation (although you can do that any time), but that we create one together. And to be honest, I have very strong ideas how it should look like, so just give me some time to implement it ;) If there's something to show or try out, I'll post it in this very thread (at least as long as there is interrest by you, the community)!
Last edited by robotanarchy on 04 Aug 2015, 21:12, edited 2 times in total.
GTA2 Hacker's Remix ...also check out my blog!
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by Cuban-Pete »

Welcome to the forum! Nice first intro post and thanks for making the program open source. :)

It looks like you got most covered already. Also clear Github code explanation!

If you need help with testing, just ask.

As a welcome present, I made a mock-up icon, do with it whatever you want:
splitscreen_icon_preview.png
splitscreen_icon_preview.png (1.16 KiB) Viewed 67512 times
splitscreen icon.7z
(1.6 KiB) Downloaded 2094 times
"Mmmm, your eyes are so beautiful."
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by Sektor »

Great work! I'll see what I can do with that 0x5ecacc input address in a GTA2 script. Your dll proxy method is the better way for this type of mod.

vike removed the multiple gta2.exe instance check in 2010. It's possible to network multiple instances without creating multiple hostnames or using VPNs.
User avatar
Vike the Hube
Hitman
Hitman
Posts: 145
Joined: 28 Feb 2010, 22:34
GH nick: vike

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by Vike the Hube »

Feel free to email me if you want any help finding memory addresses :) I actually think I found a bitfield for the state of all the inputs (special, shoot, etc) when I was trying to fix the flamethrower+door crash. I assume that's what you mean when you say you found the addresses? If not I'll dig it up and send it to you! This is a great project.
robotanarchy
Car Jacker
Car Jacker
Posts: 48
Joined: 22 Apr 2013, 22:48
GH nick: robotanarchy
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by robotanarchy »

Thanks for all the positive feedback!

@Cuban-Pete:
Yes, if there's something to test, I'll post it here :)
And thanks for the icon. I'm not really sure if I'll use it though.

@Sektor: I've removed the quote.
Sektor wrote:vike removed the multiple gta2.exe instance check in 2010. It's possible to network multiple instances without creating multiple hostnames or using VPNs.
I think when I tried it in 2012 and 2013, the game crashed with more than 2 players on the same IP (but it worked with the first external/LAN IP for the third player). But I'll test this again soon :)
Vike the Hube wrote:Feel free to email me if you want any help finding memory addresses :) I actually think I found a bitfield for the state of all the inputs (special, shoot, etc) when I was trying to fix the flamethrower+door crash. I assume that's what you mean when you say you found the addresses? If not I'll dig it up and send it to you! This is a great project.
Yeah, we probably found the same address (2 bytes at 0x5ecacc), here are the possible values. I found that with TSearch.

One thing I did not find though (but it doesn't really have a high priority either) is a way to control the gta2 menu from within the RAM. For example, go up/down in the menu, select an entry etc. But even if we can't find it, this would only be relevant for single player gamepad code - and that could also be done with other methods (eg. AutoIt3 Send()), since the window really is in the focus.

Another thing would be really nice: If it was possible to display a message in the GTA2 window (in the cool GTA2 fonts of course) from within the RAM. To avoid config files for the gamepad mappings, I want to allow switching different mapping profiles by pressing an otherwise unused button on the gamepad. We could display a message, which profile is active now, that would be very useful! (Plus maybe some debug messages that make development easier).

Great job with keeping the GTA2.exe up to date all the time, vike! [respect]
GTA2 Hacker's Remix ...also check out my blog!
robotanarchy
Car Jacker
Car Jacker
Posts: 48
Joined: 22 Apr 2013, 22:48
GH nick: robotanarchy
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by robotanarchy »

Here's the first new screenshot:

https://github.com/Bytewerk/gta2-hacker ... t-63038604

What you see here is playable. I'll probably upload binaries the next few days (when I have time), so you guys can try it out (and give feedback about the controller mapping - I hope everyone has at least one XBox360 compatible gamepad :p). Of course you could compile it yourself, but setting up the Visual C++ 2010 IDE takes forever ;)
Please note, that this is not a network game (yet) and the GTA2.exe instances have to be started manually right now.
GTA2 Hacker's Remix ...also check out my blog!
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by Sektor »

I have 3 x 360 controllers and the wireless dongle for connecting them to a PC, so I'll be able to test it. My laptop with Visual Studio on it is out of action until a replacement AC adapter arrives from China.

I have a memory address for changing ped angle. It can be used for optional directional controls instead of rotational.
robotanarchy
Car Jacker
Car Jacker
Posts: 48
Joined: 22 Apr 2013, 22:48
GH nick: robotanarchy
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by robotanarchy »

Sektor wrote:I have a memory address for changing ped angle. It can be used for optional directional controls instead of rotational.
Nice, I've thought about that too. The forward/backward controls aren't really intultive on the controller (except in cars); but you get used to the controls when playing for some time.

Something to think about: wouldn't this alter gameplay too much? Because suddenly you could turn to any degree you like, without waiting for the player to turn. I'm especially thinking about normal network gaming (with the Game Hunter); the players who do not use a controller would have a disadvantage then.

Also you can't run backwards and shoot at the same time.
GTA2 Hacker's Remix ...also check out my blog!
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by Cuban-Pete »

Nice work. [respect]

I also got two wireless xbox controllers with pc dongle.

My first thought would be to keep the game original in its movement, so only use the D-Pad for movement. I haven't tried playing GTA2 with controller (someone with Playstation experience?), but I think this might be a nice layout:
gta2_controls_xbox.jpg
gta2_controls_xbox.jpg (67.38 KiB) Viewed 67384 times
I presume in the final version, people are able to easily adjust their layout? Perhaps Vike can add it to GTA2 Manager? It already has it!?! Perhaps add a controller image and more options, changing radio and escape/quit for example or not changeable.

Running backwards and being able to shoot at the same time is a MUST! It is used a lot in Mulitplayer!

/edited layout. Version 1.1
"Mmmm, your eyes are so beautiful."
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by Sektor »

robotanarchy wrote:Something to think about: wouldn't this alter gameplay too much? Because suddenly you could turn to any degree you like, without waiting for the player to turn. I'm especially thinking about normal network gaming (with the Game Hunter); the players who do not use a controller would have a disadvantage then.
I would never scrap rotational controls but I don't see a problem with adding optional directional controls. Players could chose if directional is allowed for everyone in a multiplayer match. Directional games would count as a different category for speedruns.
robotanarchy wrote: Also you can't run backwards and shoot at the same time.
You could if a strafe button was also added or if shoot direction was independent of run direction. It would turn GTA2 into just another twin stick shooter but it could be fun to try.

CubanPete, the 360 dpad isn't great, I would only use it for changing radio or weapons. We'll never all agree on a set of controls, so it will need to be configurable at some point.
robotanarchy
Car Jacker
Car Jacker
Posts: 48
Joined: 22 Apr 2013, 22:48
GH nick: robotanarchy
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by robotanarchy »

Cuban-Pete wrote:My first thought would be to keep the game original in its movement, so only use the D-Pad for movement. I haven't tried playing GTA2 with controller (someone with Playstation experience?), but I think this might be a nice layout:
I've looked at the Dreamcast mapping at some point in an emulator (I might even have a screenshot somewhere...) and they used A/B for forward/backward from what I remember.

Personally I don't like the forward/backward stuff on the DPAD, but I've included your controller mapping (at least, what is possible of it with the current code) so everyone can try it out and give feedback.
Cuban-Pete wrote:I presume in the final version, people are able to easily adjust their layout? Perhaps Vike can add it to GTA2 Manager? It already has it!?! Perhaps add a controller image and more options, changing radio and escape/quit for example or not changeable.
Currently it works like this:
We can hardcode an infinite number of "gamepad mappings" (maybe layout is the better word here). The players can cycle through these layouts by pressing the Guide-button (big X in the middle of the controller).
It is easy to add new profiles, but you need to recompile the code.

This way we can avoid saving / loading settings and don't need an extra GUI just for configuring the controller. It is also easy to try out different layouts, as you can switch them easily ingame. And with a decent number of profiles, we should cover most use cases. If someone still likes to have his own layout, he can change the code or fill out a feature request.

However, when it turns out to be really necessary, I might add a config file for these layouts.

If there will ever be a GUI for configuring the controllers, it will NOT be in gta2_manager.exe, because it would work completely different (it really doesn't make sense to me. If you wish, I can give more reasons).

So here is the first PLAYABLE alpha version of gamepad glue!

Please test it and give feedback about the controls. If you don't like the layout, customize it if you can and post yours here!

Also testing with more than 2 controllers (6 preferably) would be great!


Here is my (the default) gamepad layout:

Code: Select all

Triggers (L/R): Forward / Backward
Left stick L/R: Go left, right
DPAD L/R: Previous, Next weapons
A: Shoot
B: Jump / Handbrake
X: Enter Car
LSB: Special 1
RSB: Special 2
Last edited by robotanarchy on 16 Nov 2014, 11:22, edited 1 time in total.
GTA2 Hacker's Remix ...also check out my blog!
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by Sektor »

Can you compile in release mode? Most people won't have the debug dll files.
robotanarchy
Car Jacker
Car Jacker
Posts: 48
Joined: 22 Apr 2013, 22:48
GH nick: robotanarchy
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by robotanarchy »

To be honest, I couldn't get the "Release" configuration to compile and I didn't know that this introduces debug dll dependencies >_>

Anyway, I've recompiled it now and uploaded the new version to github.

Thanks for the hint!
GTA2 Hacker's Remix ...also check out my blog!
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by Sektor »

It works on Windows 8.1 64-bit with 3 xbox 360 controllers. Great job!
gamepadglue.jpg
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by Cuban-Pete »

It also works on Win 7 Professional 64 bit (Service Pack 1) with two wireless Xbox 360 controllers.
itworks.jpg
Thank you, very nice work! :)

Small critique is that the sound does not update on the unfocused screen. Is this also fixable with SDL?

@Vike, does GTA2 also support funky resolutions? Like splitting a screen in half and on one half have GTA2 run in 960x1080 ?
"Mmmm, your eyes are so beautiful."
robotanarchy
Car Jacker
Car Jacker
Posts: 48
Joined: 22 Apr 2013, 22:48
GH nick: robotanarchy
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by robotanarchy »

Sektor wrote:It works on Windows 8.1 64-bit with 3 xbox 360 controllers. Great job!
Cuban-Pete wrote:It also works on Win 7 Professional 64 bit (Service Pack 1) with two wireless Xbox 360 controllers.
Thanks for trying it out and great to see that it works on more recent windows versions, too :)

May I add your screenshots to the github page?
Cuban-Pete wrote:Small critique is that the sound does not update on the unfocused screen. Is this also fixable with SDL?
GTA2 disables the sound, when the window doesn't have focus. One way would be to find the assembly code that does this and change it in RAM (make GTA2 think, that it is always in focus).
But with the code that I used to merge windows together, all windows actually had sound (it must have something to do with starting them at the same time). I'll reimplement that soon, and we will see then how stable this is. Otherwise we'll go for the memory/exe hacking.
Cuban-Pete wrote:does GTA2 also support funky resolutions? Like splitting a screen in half and on one half have GTA2 run in 960x1080 ?
Let me answer that one: yes, GTA2 supports any resolution! For the old screenshots, I have changed the resolution in the Windows registry, and surprisingly GTA2 shows all the HUD elements at the right spot, even if we have some super wide-screen format!

The only thing that did not work out of the box: camera when driving. You could easily go off-screen, when having such a resolution. But I think we can fix that!


Now about the gamepad layouts (switch them with the guide button!):
  • Which one do you guys use?
  • Is there anything to improve (gamepad layout related)?
GTA2 Hacker's Remix ...also check out my blog!
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by Sektor »

You can use my screenshot. I'll probably take a better one during an action scene when other people are actually playing.

When I tried some widescreen resolutions long ago, they cut off mission text at the bottom of the screen.

I like robotanarchy's control scheme. I tried CubanPete's but dpad ruins it.

Dreamcast controls:
gta2-dreamcast-controls.jpg
gta2-dreamcast-controls.jpg (123.93 KiB) Viewed 67280 times
User avatar
Cuban-Pete
Immortal
Posts: 909
Joined: 29 Jan 2010, 15:03
GH nick: Cuban-Pete

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by Cuban-Pete »

You are free to use my screenshot, but it's not that a great shot. Perhaps I can invite some people over so I can try it with four controllers and get a good screenshot. Custom resolutions would give even better screenshot/showcase.

I tried my own controls, they are horrible. D-pad for control is not done. Robotanarchy's is beter. However, I'm not sure about the weapon switching on D-pad. It does make sense, but in my short career in multiplayer games (long time ago), switching weapons should be fast and not mean losing the control for direction (left thumb needs to let go of control to switch weapon). For example a rocket launcher is a no-go in super close combat (possibility of suicide) etc..

I think it would be best if you include in your final release definitely an option for users to change controls. Perhaps with config file or a custom tool, I don't care how, but controls are after all a matter of taste and habit (based on playing other games) and need to be adjustable.

I need some more testing and adjusting before I update my controls (the image above) (and it really does need updating :)). I think it will be closely related to Robotanarchy, but x,y,a,b different and RB, LB.... and perhaps use joystick button... hmm that is still a lot.
"Mmmm, your eyes are so beautiful."
robotanarchy
Car Jacker
Car Jacker
Posts: 48
Joined: 22 Apr 2013, 22:48
GH nick: robotanarchy
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by robotanarchy »

Sektor wrote:When I tried some widescreen resolutions long ago, they cut off mission text at the bottom of the screen.
That is bad, we'll probably need to do some more hacking on the exe file / in the RAM then.
Cuban-Pete wrote:However, I'm not sure about the weapon switching on D-pad. It does make sense, but in my short career in multiplayer games (long time ago), switching weapons should be fast and not mean losing the control for direction (left thumb needs to let go of control to switch weapon). For example a rocket launcher is a no-go in super close combat (possibility of suicide) etc..
This makes sense, how about switching the weapon with the LSB (Left shoulder button, the one above the left trigger) and RSB? Currently they have the "Special 1" and "Special 2" bindings, but we can move them somewhere else (DPAD?).
Cuban-Pete wrote:I think it would be best if you include in your final release definitely an option for users to change controls. Perhaps with config file or a custom tool, I don't care how, but controls are after all a matter of taste and habit (based on playing other games) and need to be adjustable.
I've changed my mind and I will do that (at least with a config file). But only after more of the splitscreen stuff is working, so it will take a while.
Cuban-Pete wrote:I need some more testing and adjusting before I update my controls (the image above) (and it really does need updating :)). I think it will be closely related to Robotanarchy, but x,y,a,b different and RB, LB.... and perhaps use joystick button... hmm that is still a lot.
If it isn't too much work for you, try setting up Code::Blocks as described here, because than you can really test your layout and create a good one :)

Why/how would you switch the X,Y,A,B buttons? (I just picked them, without much comparing to other games, so it would be fine)

I'm looking forward for your new layout!


Oh and I was very surprised that both of you already tried multiplayer games. How well does this work?
On my (XP) development machine, I can start one network game fine, but when I close it and try to start another one right after that, it always crashes.
I need to wait some more time, until I can create a new one (that's probably why I though I'd need virtual network adapters or something).
If this is only an XP issue, it doesn't matter. But otherwise we should fix this (in GTA2.exe? @vike) as good as possible.

PS: Added your screenshots to github and a new one that shows the upcoming alpha GUI. ;)
GTA2 Hacker's Remix ...also check out my blog!
User avatar
Sektor
Boss
Boss
Posts: 1423
Joined: 04 Mar 2008, 06:51
GH nick: Sektor
Location: GTAMP.com
Contact:

Re: GTA2 Hackers Remix (SPLITSCREEN MOD!) in development

Post by Sektor »

robotanarchy wrote:
Sektor wrote:When I tried some widescreen resolutions long ago, they cut off mission text at the bottom of the screen.
That is bad, we'll probably need to do some more hacking on the exe file / in the RAM then.
hifi was working on proper widescreen support. He has made similar tools/hacks for Command and Conquer games. I just sent him an email telling him about your splitscreen mod.
robotanarchy wrote: Oh and I was very surprised that both of you already tried multiplayer games. How well does this work?
On my (XP) development machine, I can start one network game fine, but when I close it and try to start another one right after that, it always crashes.
I need to wait some more time, until I can create a new one (that's probably why I though I'd need virtual network adapters or something).
I couldn't launch more than 1 multiplayer GTA2 on an Athlon XP CPU with Windows XP. The same CPU runs multiple singleplayer windows but too slow to be playable anyway.

I don't think it is a Windows XP limitation, I think multiplayer mode is just coded in such a way that it requires one CPU core for each instance of multiplayer GTA2. It would be nice if vike could remove that limitation but most people have at least dual core CPUs these days. If we can figure out how to control an AI ped with a controller then we could have local multiplayer with a single instance, as long as everyone stayed on the same screen.
Post Reply