Jump to content

[C&C95] Enabling hidden LAN netcode


Guest cncNetServer

Recommended Posts

The following are my research notes on the topic of enabling the RA style netcode in C&C95.

 

UPDATE: The following is only for adjusting the wchat level of netcode, to enable the LAN netcode, look at my post below.

---------------------------------------------------

loc_47B313:

- maxAhead (0047B35A)

Change the edx assignment to the number of frames you want the eventengine to skip ahead (to provide a buffer)

 

loc_455241:

- EnableSendRate (00455247)

Change the EnableSendRate to 2 to activate the netcode

[C6 05 CA 05 54 00 02](7 bytes) is needed so, noop the xor above

OR REPLACE WITH

[b7 02] (if your using 1.06 exe)

- SendRate (00455252)

Change the sendRate to apply a divisor to the packets per second (1=~32 per second, 5=5 per second)

---------------------------------------------------

*note* If you enable the sendrate, the maxahead will adapt based on the ping of the clients to eachother. I have noted that Red alert's settings add 3 to the maxahead compared to C&C95.

 

 

Thanks to Nyerguds for his assistance, Pichorra for his persistance and Tore for his patience.

Link to comment
Share on other sites

An incomplete hidden code on C&C95.EXE to make the game more "faster" (it decreases the LAG by ajusting the SendRate as the opponents Ping), but it has been disabled by the DOS compatibility or by an failed attempt to make the game faster as Red Alert. It simple can't be enabled by a missing Timer (cause Out of Syncs because the packets aren't arriving on time, blame Time Zone).

Link to comment
Share on other sites

  • 3 weeks later...

DONE! :-)

 

I decided to take a different approach and follow the scent of the "Generating timing packet" string after following the buffer from my attempts to port hifi's "thipx32" to VC++.

 

HOW TO ENABLE THE SMOOTHING NETCODE FOR LAN:

 

I was pleasently suprised to find that simply changing:

Location 004912CD

cmp     bl, 2 to cmp     bl, 0 enabled the auto-detection scheme built in for LAN.

 

Me and Tore did a few tests and there seemed to be no sign of desync and it ran a heck of alot smoother!

 

The change was confirmed by running C&C95 in DEBUG mode.

GAME.LOG output

"C&C95 - Changing MaxAhead to 6 frames

C&C95 - Generating timing packet - MaxAhead = 6 frames"

 

To do this, for those who don't know, make a shortcut to C&C95 and add "DEBUG" to the end of the target with a space before it.

Link to comment
Share on other sites

Well, i'm still doing some research to make the game adapts more faster, or by an smother way...

 

Changed: 0006B75B(hex) 0047B35A(dasm) to 40, this make the game adapts from a smother way, but while an unit do not move, everything takes a some seconds (2, maybe 3) to respond... Probably it is because my Ping with Tore, not sure... i need to make a few more tests to make sure about it.

Link to comment
Share on other sites

this make the game adapts from a smother way, but while an unit do not move, everything takes a some seconds (2, maybe 3) to respond... Probably it is because my Ping with Tore, not sure... i need to make a few more tests to make sure about it.

 

Well, you're the only one who seems to be having that affect. If you watch my YouTube video (which is below), in the beginning. It only takes about 5 seconds for the game to smoothen out. It's maybe something on your end. But the whole thing isn't really that big of a deal...

Video removed... go to my YouTube for my latest CnCNet videos.

Link to comment
Share on other sites

The "netcode smoothing" kicks in when the number of in-game events reaches 5 or more, theres a tiny check for it above the first jump in the section of code that you enable the netcode itself in.

 

I think its a nice thing to have, cause it shows the contrast and it feels a bit more like RA.

 

There could be a good timing reason for it being 5 and I don't think its a good idea to change it at all.

Link to comment
Share on other sites

Done: Netcode Smooth.

 

Changes:

(did that with DOS Hackers View (HVIEW))

004912D0                 jnz      short loc_491324

to

004912D0                 jz      short loc_491324

(well, it comes in my mind i was needing to change this jump... if there are something you guys do not agree, tell me.)

 

0x000816CF 06

 

It need to be the same exe file, since if they are different we will get a crash while joining.

What does it do : Remove the 5-seconds or the needing of an unit to Move to smooth the game.

 

Thank you to Godly-Cheese, Myg and Tore for Testing with Me

 

 

Link to comment
Share on other sites

oh, it's definitely going in, no question about that :)

 

I just changed the variable loaded into bl (which is checked) to 00640029 (189629), which I set to 1. This way the system still acts exactly the same, but it checks my variable :P

I'll make an ini key for it in some ini (rules or conquer), just so we can still control it somehow.

 

As quick 'n' dirty method, I made this small app to apply an enabling hack:

http://nyerguds.arsaneus-design.com/cnc95upd/netcode.zip

It toggles the hack on and off, and is designed so it won't work on the new version I'm making now.

Link to comment
Share on other sites

I found why Westwood disabled this code, :D i've compared the performance of the 2 netcode (the original and Myg one (later My modified one and Nyerguds modified one) The one who gets better performance was the Original Unmodified Westwood Netcode... If you guys want to compare, fell free to do that.

 

Nyerguds : Maybe you can make the game change this code when simple the "CnCNet" option is enabled.

 

And i agree with westwood for that... They did even know "CnCNet" will be make, and also, the "netcode" make the LAN performance a little slow. If it is a LAN function, why enable something what would get the performance poorly? "let's disable that!".  :P

 

 

Link to comment
Share on other sites

  • 4 weeks later...

I discovered some intersteating things (if myg do not know then first), anyway it is an Explanation of How the NetCode works (if anyone is intersteated on that)

 

1° - The MaxAhead(6B75B(47B35B)) is the intial value for MaxAhead, this mean the game starts addapting the game from this value, from 02 to FF.

 

2° - The "MaxAhead" at 816CF(0912CD) mean the Final Value for MaxAhead, this mean the game will set the MaxAhead to the current value and wouldn't change it at all.

 

3° - What happens when i Change the 6B75B to 00? The game will connect, but will always wait for connections.

 

4° - What happens when i Change the 816CF to 00? The game uses the value at 6B75B and can change the final one until the game get smother, because there's no value at 816CF (00).

 

This mean the thing i've done into this post

Done: Netcode Smooth.

Changes: 
(did that with DOS Hackers View (HVIEW))
004912D0                 jnz      short loc_491324
to
004912D0                 jz      short loc_491324
(well, it comes in my mind i was needing to change this jump... if there are something you guys do not agree, tell me.)

0x000816CF 06

 

Is that: It WON'T addapt the game, it will set the MaxAhead Value to 6, where the game be smoother at ALL the cases. This mean LAN game will be poor like it would be if the MaxAhead would be set to 2, and the game will always lag if the required MaxAhead would be 7 (but changing the 6B75B to 07 and 816CF to 00 fix it, since the game will keep addapting from 06 IF the game still lags) just figured it today.

 

What we could do, but keeping the smoother at game begin:

 

1° - Make on option on Nyerguds's CCSetup that would change the Netcode mode to those settings:

Addaptation mode:

  -Adapt the MaxAhead (recommended if you are near of your Opponent player)

  -Set the MaxAhead to an fixed value (recomended if you always are far far away from the Opponent player, since the adaptation code will always get the game thing).

 

2° - Make the game uses the MaxAhead=2 for LAN and MaxAhead=6 for CnCNet games.

 

 

My code is a joke...  :(

 

Link to comment
Share on other sites

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...