Jump to content
  • Advertisement

Archived

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

Juz

Seperating Threads in VB

This topic is 5759 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Greetings, I''m hoping you can all be of assistance to me... Recently I''ve been dabbling in Dirext8, Winsock, and VB. As you may have guessed, this combo has lead to a simple 3d online ''game'' in which players can run around a small area. This is all fine and dandy, but I''ve noticed a very annoying problem creeping up on my as my network traffic increases to allow for more and more interaction. My network code and render code don''t seem to like eachother. While the programming is rendering a frame, the networking code does not download new packets sent from the server. Instead, it waits until the frame is done before recieving and processing, which leads to one player seeing the others moving around either very choppily or very quickly. The funny thing is, though, that this only happens when the application is active. Once it''s running in the background (and still rendering), the networking code and render code get along peachy, and others players zip around just fine. After talking with a C++ programming friend of mine, he''s suggested that I ''seperate the threads'' so that my rendering pipeline and network code are on seperate threads, however, I''m not sure how I''d do this... So therein is my problem, and I''m seeking a solution - any solution - that you can offer. Thanks in advance, - Juz PS. Here''s a screenshot of a recent build, just for kicks: http://www.swgalaxies.net/test/jmud_multi2.jpg . The little arrow boxes are players.

Share this post


Link to post
Share on other sites
Advertisement
VB 6 is not thread safe - you can manually create threads (ask in the MS support newsgroups for this), but a lot of operations using VB intrinsic functionality will crash when used by more than one thread.

Thats the price you pay for using a RAD language instead of a lower level language.

You can, though, go to VB.NET - this does not have this problems.


Regards

Thomas Tomiczek
THONA Consulting Ltd.
(Microsoft MVP C#/.NET)

Share this post


Link to post
Share on other sites
I think you may be able to get it to work by separating threads into separate ActiveX objects. With that said, I hate ActiveX and never use it, so I''m hardly an expert

Trying is the first step towards failure.

Share this post


Link to post
Share on other sites
How is your game loop setup? I overcame this problem with some strategically placed "Do Events" in the draw loop which allowed for the socket reading events. Also your not using the horrible Microsoft Winsock Control are you? (just in case you are you should definetely make the switch to the Catalyst Socketwrench here)


[edited by - Brandisco on September 16, 2002 10:18:06 AM]

Share this post


Link to post
Share on other sites
I would suggest using DirectPlay, as it will handle the threading issues for you. It is easy to use and works in VB quite nicely.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!