Archived

This topic is now archived and is closed to further replies.

Sandstone

VS 03; DX SDK Update (Sum. 2003) DirectPlay Project

Recommended Posts

Hey all, So I have Visual Studio 2003, and am using C++ with my game. I have downloaded and installed the DirectX 9 Summer Update SDK. Once this is installed, you can create a new project framework based on DirectX that sets up an entire sample game for you, complete with DirectMusic, Direct3D, DirectInput, and DirectPlay. It all works great, except for the DirectPlay part. :/ If you compile the program it creates for you, and then start it up, you can select a few networking options: Lobby, TCP, etc. If I copy this program to two computers that are guaranteed networked, and try to have them connect, they cannot. The app that''s searching for the existing game doesn''t see it, no matter which computer I run it from. What is wrong with the example compiled program, that it can''t connect to another version of itself? Has anyone else had any success with the Summer Update DirectX 9 SDK using DirectPlay? I just can''t get it to work. Sandstone

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hi

Im having the exact same problem so hopefully someone can help! When using any of the sample programs over my network they work fine but the applications created using the App wizard wont work over the network??

If anyone has any ideas please help?

Cheers
Dave

Share this post


Link to post
Share on other sites
Dave,

I think I''ve found the problem, and a workaround, although it''s not necessarily a good solution.

First of all, I found that you can do a network test using dxdiag.exe. Head to the network tab once you''re running dxdiag, and start the test by clicking ''Test DirectPlay'' You''ll see that the dialog boxes in this test are similar to the ones in the framework... except that there is an input box for the port. I was able to get this test to work between two computers (and itself using the network simulator).

Also, you can do a test with the ChatPeer sample app provided in the SDK. You''ll notive that it has the same kinds of dialog boxes as the framework, but with a few more options and that magical port input box. This test also works on my computer.

As another test, I built an app using the framework, and didn''t change it at all. It DID NOT work - and I noticed that it DID NOT have the port input box.

SO. I hypothesized that it might be simply a fact that the port isn''t being set. Sure enough, if you track the value of the port (held in the variable m_dwPort), it stays at zero. Now, I''m pretty sure that TCP/IP connections require SOME port, and I don''t think zero works. So what I did is I searched for any place where this variable was being reset.

I found that if you comment out one line, in the function CreateSessionDlgPort, in the file netconnect.cpp, and set the default value of the port to be 2502 (instead of zero - you can set this in the function CNetConnectWizard in netconnect.cpp), the game connects succesfully to another copy of itself!

The line to comment out is:
m_dwPort = _ttoi( strPort );

I used 2502 because one of the tests I did used it as the default port. Any port would work, I guess.

This line sets the port to the value collected in some dialog box - this dialog box is never launched in the game(!), even though the game collects a value from it. It gets the value zero, because it was never set.

So that''s the work around - just stop it from getting the zero value from the dialog box. BUT - why can''t we see the dialog box? What do we have to do to launch it, so we can actually enter a port number? I haven''t figured that out yet.

Incidently, if you comment out this line:
m_bMigrateHost = ( IsDlgButtonChecked( hDlg, IDC_MIGRATE_HOST ) == BST_CHECKED );

... then host migration will work, as well. This is another value collected (incorrectly) from that mythical dialog box. Apparently, that box contains many options that you can set. But why isn''t it launching?

If you figure out how to display it, let us know.

Thanks!

-Brew

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hey Brew

Thanks mate, got it working now! Is strange about the dialog box, will have a look today and if i solve it ill let you know.

Thanks again mate
Dave

Share this post


Link to post
Share on other sites