C/C++ Test Drive Unlimited 2 Private Server (WIP/Help Required)

Discussion in 'Programming & Scripting' started by xXBeefyDjXx, Jan 9, 2018 with 33 replies and 7,455 views.

  1. xXBeefyDjXx

    xXBeefyDjXx Long time Sinner

    Messages:
    1,385
    Ratings:
    322
    Can any coders help me out? Trying all I know and using google as my friend to make things work, this is my first time coding a game server emulator...

    Me and a few people over at the TDU2 Zone community are getting rather hacked about the Atari servers for the game going offline for weeks if not months on end so I took it upon myself to go make a server.

    I want to be able to make a server that emulates the original in the sense of at least allowing the game to played in online free roam if anything at all.

    I have gone through the process of Reinstalling VS Community and Wire shark.

    The Game Server is offline again, But I now have the full data of the initialisation of the game into online so have enough to build a server that will load your user into free roam using that data.

    I have managed to pick away at the packets to determine what the client game is sending out to the server. I have the Destination IP, the packet that is first sent "Handshake"<?, and thats about it.

    The game sends the Game version, the Activation code and the Username in the initial packet and awaits a reply from the port and IP of the server. This is as far as I have looked into it, but I do now have packet recordings of the game connecting to the server, handshaking, and then loading into online game play.

    I have managed to find a game file decoder called "TDUDEC" which allowed me to decrypt and modify the initial loading config to get the game to point to another IP Address for the server, however when reencrypting the file for the game to run it just doesn't bother. Hmm.

    Debugging the game with the VS Debugger just results in the game soft exiting even with all anti cheats turned off. Again, No idea why?

    I have also made a basic UDP Server that will respond to any incoming requests with 'Welcome to Project Zone'. This is a console based one that spits out when someone is connected via the console screen. Now my speculation is if this works it will either crash the game or the game will try loading further and exit because server is not giving out any further responses the game is asking for...
     
    • Like Like x 1
    Last edited: Jan 18, 2018
  2. Thepredatormlg

    Thepredatormlg IT Master

    Messages:
    249
    Ratings:
    30
  3. OP
    xXBeefyDjXx

    xXBeefyDjXx Long time Sinner

    Messages:
    1,385
    Ratings:
    322
    Test Drive Unlimited 2. any Ideas?
     
  4. Xolitude

    Xolitude Enthusiast

    Messages:
    108
    Ratings:
    15
    Depending on the game, debugging to create an emulator is/can be a relatively simple process. I did it for Minecraft for both an authentication server and an attempt to create a bot. You need to debug both sides, client>server and client<server. C>S will obviously show you what the server (if sent from a vanilla client) expects from the client. You may run into encryption issues as I did while attempting to create a WoW emulator. You'll either need to debug using IDA or do some general research on the game's specifications.

    For example; Older versions of WoW use SRP-6 encryption which is very tricky to dabble in but also very secure, which is why they use it. Older versions of Minecraft, however, use plain-text for the most part so packets like their ping packet are very simple to dissect and take <5 minutes to re-create.

    That being said, console applications are perfectly fine to use/debug packet data as you can view the bytes and their data easily with (usually) simple conversion. Emulation can be a very tricky thing, though. I'd recommend either doing research on the game or just start poking around as you've done. I've no experience with TDU 2, but if you already know what is being sent at least one way, you're off to a very good start.

    In regards to the server being down while dissecting packet data, I'd recommend attempting to poke around in the client itself to see if you can find when and where the client returns recvd information.

    One final thing to note; copy-pasting is not good enough if you do not understand what is going on behind that logic. I learnt everything I know (which is only about 1% of the entire "book" of programming so-to-speak) by going on ~10's of forums, images, stackoverflow (people over here are very friendly FYI), etc,. It can be an... o.k, dodgy start to any project, but will not help you in the long run whatsoever. I've learned this while developing games, the hard way.
     
    • Like Like x 1
  5. OP
    xXBeefyDjXx

    xXBeefyDjXx Long time Sinner

    Messages:
    1,385
    Ratings:
    322
    Very good information.

    From what I have sniffed out using Wireshark (Very good for sniffing packets without doing a ton of proxy work, and also good at dissecting packets) The game is using TCP to send ALL packets so it would need to be a TCP server, It sends the basic handshake using just pure unencrypted data till it sends the login details off, then I presume it is using SSL encryption to send off that data.

    The servers came back online and I sniffed an absolute flood of data from after the initial handshake, Data I presume includes the Co ordinates of the player, what vehicle they are driving, and then data such as player statistics, players around you (Again, Co Ordinate packets) and friends list data. I have yet to go through the data to see what is what as it is all in unencrypted binary but I have not RE'd the game to see what it sends first, and what it retrieves. All I know is it sends a good 6-10 packets and receives a further 4 or so back from the server. there is no encryption on the packets themselves, as Wireshark can make out exactly what is in the packets, but because it doesn't know the game language, it just reads a bunch of characters jumbled up in binary form.
     
  6. Xolitude

    Xolitude Enthusiast

    Messages:
    108
    Ratings:
    15
    TCP is typical for those types of packets. However, position packets and other things within the actual game when you're playing may be sent in UDP from what I've seen from other games so keep that in mind. You can build a UDP layer on top of a TCP server and vice-versa if this is the case but this is quite difficult to achieve, however, more reliable then having just TCP and/or UDP. As for data being encrypted with SSL, I don't know how common this is as I don't believe SSL encryption is very common for typical game><server communication but more so for web traffic. Anyone correct me if I'm wrong. Anyhow, you'll know if data is encrypted with SSL from Wireshark. For example; WoW uses their own encryption methods that Wireshark actually picks up on called, "WOW," rather than the usual TCP, UDP or SSL.

    For the game to send data to your server, you'll have to change the Destination IP/Port to your own. I do not have much experience in this as I haven't gotten that far into emulation as of yet (i.e. using IDA to edit the games structure and functionality). WoW luckily uses a realmlist.wtf file so all you'd have to do is change the IP to yours and bam. Minecraft is Java which is easy enough to break into and modify, not to mention tools exist to decompile Minecraft. TDU2 may have a file that contains the IP but that's doubtful as the game is on steam. You'd have to edit the steam_api extension file I believe. Like I said, I have no experience with TDU2 (although I have played the first one on Xbox 360 and loved it <3). That said, I'll provide as much support as I can in terms of packet structures but once you get the general idea, they're easy enough to replicate.
     
  7. OP
    xXBeefyDjXx

    xXBeefyDjXx Long time Sinner

    Messages:
    1,385
    Ratings:
    322
    TDU2 does not rely on Steam at all. All it does is load the TDU2 Launcher made by atari and launches the activator if it detects the game is not activated.
    You can use the Universal Launcher in replacement of the atari one and steam will still load the game as if it was untouched...

    In terms of getting the game to connect to a custom server, its a case of redirecting the IP to your localhost or ip of the custom server within the HOSTS File of windows for now, until you get a working server then you can look into streamlining the DLLS (I believe thats where the config for this game is) so they point to your game instead.
     
  8. Xolitude

    Xolitude Enthusiast

    Messages:
    108
    Ratings:
    15
    Oop. I only figured since TDU2 was also on Steam that it relied on Steam servers as most online games on Steam are like that; most use Steams backend for networking. You should be able to make easy work of it if redirecting the IP is that easy at the moment. I'll do as much as I can in terms of packet data, if you have questions.
     
  9. OP
    xXBeefyDjXx

    xXBeefyDjXx Long time Sinner

    Messages:
    1,385
    Ratings:
    322
    Yep, the game relies entirely on atari servers, making this easy peasy if you know what to do lmao
    I just do not have the time to sit down and work on learning the code now
     
  10. OP
    xXBeefyDjXx

    xXBeefyDjXx Long time Sinner

    Messages:
    1,385
    Ratings:
    322
    I have updated the original post with the current scenario and what I have or have not done.

    Anyone who can help, please get in touch!
     
  11. Vegeta

    Vegeta 宇宙のマスター

    Messages:
    12,132
    Ratings:
    9,957
    I ****ing love this game, I hope you guys manage to do this because I would love to come back and play.
     
    • Like Like x 2
  12. OP
    xXBeefyDjXx

    xXBeefyDjXx Long time Sinner

    Messages:
    1,385
    Ratings:
    322
    Glad to see someone else here sharing the love for the game.

    When I feel a little more motivated I will strive to make this one man project come on in leaps and bounds. For now it's baby steps since it's just me trying on this project :smile:
     
  13. PASAf

    PASAf Newbie

    Messages:
    1
    Ratings:
    0
    So you know nothing and want to make something? You don't want to 'make', you just want to 'get'.
    It's easier to hack buggy tdu2 website server and look if it has connection to game server to download server from there.

    Look at your thread from side "I've installed VS and Wireshark, how to make server emu?" Seriously?
    x64-dbg / IDA Pro / Ollydbg - that what you need to debug compiled exe's, not VS debugger.
    And you will not see the source code, just ASM instructions, so you need to learn it. So start with "Introduction to Cracking with OllyDbg from Scratch" by Ricardo Narvaja. That is really basic minimum you need to understand of reverse third-party exe.
    Of course you need to understand PE format, DLL import, know hexadecimal. It'll be useful to be good at programming (really good, I mean, you must be at level where you understand which high-level language construction translated in what asm instructions by compiler).
    Win32APIOverride might be useful to easy determine from which functions game making call to send packets.

    And there is no working TDU2 server at the moment, so nothing to debug in traffic for now.
     
  14. Modder v7

    Modder v7 Getting There

    Messages:
    2,064
    Ratings:
    479
    xXBeefyDjXx , this sounds like an interesting project. Given that I absolutely love this game too, and have dabbled in both programming and RE, why don't we discuss this more via PM?

    I currently have a lot of free time these days and am looking for a "project" to practice more in this field.
     
  15. OP
    xXBeefyDjXx

    xXBeefyDjXx Long time Sinner

    Messages:
    1,385
    Ratings:
    322
    First, I'd like to say welcome to Se7ensins.
    Second: I have dumps of the network traffic when the servers were up.
    Third: At least I am trying and willing to learn.

    You've got 2 choices of projects my friend, drop me a PM and I will happily drop the details on both.
     
  16. forcefaction

    forcefaction Newbie

    Messages:
    1
    Ratings:
    0
    I'd also like to help in this project. Pls let me know how I can contribute :biggrin:.
     
  17. Fuse EU

    Fuse EU Newbie

    Messages:
    1
    Ratings:
    0
    Anything else happened with this??
     
  18. OP
    xXBeefyDjXx

    xXBeefyDjXx Long time Sinner

    Messages:
    1,385
    Ratings:
    322
    Sadly not, on the back burner till further notice.
     
  19. Anthony817

    Anthony817 Newbie

    Messages:
    5
    Ratings:
    1
    I just want to say you have my support! I have thousands of hours put into playing both games on Xbox 360 and on PC. I would absolutely LOVE to see this game brought back online on PC! I am seriously starting to miss it greatly.

    And what is this TDU2 Zone community that you speak of? Not seeing anything about it online with a quick Goggle search.
     
  20. Rhoan

    Rhoan Newbie

    Messages:
    1
    Ratings:
    0
    BeefyDj this is not a bad idea. If the servers could be resurrected people would come back to the game.
     

Share This Page