Some questions about Visual Basic?

C038daac744802d37cce97fb614fb739
0
elemein 101 Mar 06, 2011 at 16:27

Hi, I’m kind of new to this whole game-developing thing, but I’ve made a number of single-player games in visual basic. The thing is, I’ve never made online games, and thats wht i want to do. So if you could answer some of my questions, that’d be appreciated.

  1. How do i make friction? I am trying to make a naval warfare MMO, but I am going to need to make it so that when a ship moves, and the movement key is released, it doesnt just stop, it slows down until it stops. Is this possible in Visual Basic? if so, is it possible to change the rate at which it slows?

  2. How do i make scrollbars work? (now I know this is insanely noobie, but I’ve never needed to know how to make one, so I dont know how \^\^’) Such as for chat rooms and shop interfaces?

  3. How do I make sounds play? (Again, I never needed to know how, so i dont know how) For BGM? SFX? Etc.

  4. I have a concept of how I will do my networking, though I dont know where the bugs are, I KNOW there are bugs in there, so here it is.

For when YOU spawn and when YOU move UP by pressing W.

Client Side:
1. You spawn on the map at the spawn point, you send informaiton to the server saying that you have spawned (in this format for example: Ingame;Room2;Player3;Spawn)
2.You press the W key
3.The client takes the information that you pressed the W key, and packages it with appropiate tags (Ingame;Room2;Player3;W)
4. The package is sent to the server
5. Your ship moves up 1 unit on the map (and your ship’s animation changes, the bow of your ship now points north)
6. You release the W key

Server Side:
1. Information is recieved that you have spawned (Ingame;Room2;Player3;Spawn) and it sends this information to all the other players in “Ingame;Room2”
2. —Client Side—
3. —Client Side-
4. Information that Player 3 has moved up, and the information is taken, and sent to all other players in the room (Ingame;Room3;Player3;W)
5. Client Side
6. Client Side

Now what about recieving ifnormation of another ship moving?

Client Side:
1. Server Side
2. Information that another ship has moved is recieved (Ingame;Room3;Player1;W)
3. The client takes that ship and moves it up 1 unit, and it changes the animation of the ship, with its’ bow pointing north now

Server Side:
1. Information that another ship has moved is recieved (Ingame;Room3;Player1;W)
2. The information is sent to all other players in Ingame;Room3
3. Client Side

Now Im using Winsock control 6.0 in Visual Basic 6 Enterprise Edition. I KNOW there are bugs in this, I just dont know where. So can someone make a new concept for me or modify this concept to make it more efficient/faster/less buggy?

  1. How do I tell Winsock to tag and interpret these tags? as I said before, all information sent to and fro the server is tagged (such as Ingame;Room1;Player2;W) but how do I tell Winsock to take YOUR information, tag it, and send it off with all its tags intact? And how do I tell Winsock to interpret the tags recieved? How will it know what “Ingame;Room1;Player2;W” means?

  2. How much different is the VB6 langage from VB.NET language?

Thanks all! I know I’m new to this, but all help is appreciated!

Thanks!

9 Replies

Please log in or register to post a reply.

820ce9018b365a6aeba6e23847f17eda
0
geon 101 Mar 06, 2011 at 17:20
  1. physics simulation.
  2. no idea
  3. you need direct x or an external library for that. I used fmod once.
  4. ?
  5. you could change your logic to make the server keep track of the state, and only transmit the keypresses. Makes more sense to me.
  6. quite different, I’ve heard. Why don’t you compare them yourself?
A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Mar 06, 2011 at 18:08
  1. Assuming you are doing your own motion, you need to get both the key up and the key down from input. On key down, you do what you are normally doing. On key up, you gradually slow the ship down with an algorithm like

speed = 100;
inc = 5;
done = false;

while(!done){
speed -= inc;
if (speed < 5){ done = true; speed = 100}
}

I don’t know visual basic, but that’s the idea. If you can’t use a key up, you just check if key down was true previously and then turned false.

  1. If you are using visual basic, you should be able to find scroll bars. Otherwise, whatever you are using will probably provide a GUI with scroll bars. It’s really unnecessary to write your own GUI these days.

  2. Sounds are done with a sound library and that depends on the language you are using.

  3. It’s a bit different, but you should definitely move on. It might be best to learn c# rather than vb.net being it’s quite a bit different anyway. C# is more commonly used in games.

C038daac744802d37cce97fb614fb739
0
elemein 101 Mar 06, 2011 at 18:23

@fireside

  1. Assuming you are doing your own motion, you need to get both the key up and the key down from input. On key down, you do what you are normally doing. On key up, you gradually slow the ship down with an algorithm like

speed = 100;
inc = 5;
done = false;

while(!done){
speed -= inc;
if (speed < 5){ done = true; speed = 100}
}

I don’t know visual basic, but that’s the idea. If you can’t use a key up, you just check if key down was true previously and then turned false.

  1. If you are using visual basic, you should be able to find scroll bars. Otherwise, whatever you are using will probably provide a GUI with scroll bars. It’s really unnecessary to write your own GUI these days.

  2. Sounds are done with a sound library and that depends on the language you are using.

  3. It’s a bit different, but you should definitely move on. It might be best to learn c# rather than vb.net being it’s quite a bit different anyway. C# is more commonly used in games.

1.Erm. That wont work in VB :S The syntax is that of another language or something @_@

  1. Yes, there are scrollbars. But they do not come already coded, so it doesnt know WHAT it’s scrolling, how much it scrolls, etc.

  2. Mmk.

  3. I’d LOVE to learn C# except there are two things stopping me: I cant imagine working with some GUI infront of me, and also, I have no one ot teach me :[

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Mar 06, 2011 at 18:59

@elemein

1.Erm. That wont work in VB :S The syntax is that of another language or something @_@

Well, yes. As fireside said, “I don’t know visual basic, but that’s the idea.” You should be able to take the idea and write it in the language you know.
@elemein

  1. Yes, there are scrollbars. But they do not come already coded, so it doesnt know WHAT it’s scrolling, how much it scrolls, etc.

http://lmgtfy.com/?q=scroll+bars+in+visual+basic
@elemein

  1. I’d LOVE to learn C# except there are two things stopping me: I cant imagine working with some GUI infront of me, and also, I have no one ot teach me :[

There are plenty of tutorials and manuals on C# on the web. You can also get a book from the library about it. And there is a form designer in Visual Studio that you can use for C#, more or less similar to the VB one (although it won’t be quite as dumbed-down). Was that what you meant by a GUI? If you just meant an IDE that will give you syntax highlighting and so forth for the code, Visual Studio of course does that for C# as well.

C038daac744802d37cce97fb614fb739
0
elemein 101 Mar 06, 2011 at 19:34

@Reedbeta

Well, yes. As fireside said, “I don’t know visual basic, but that’s the idea.” You should be able to take the idea and write it in the language you know.

http://lmgtfy.com/?q=scroll+bars+in+visual+basic

There are plenty of tutorials and manuals on C# on the web. You can also get a book from the library about it. And there is a form designer in Visual Studio that you can use for C#, more or less similar to the VB one (although it won’t be quite as dumbed-down). Was that what you meant by a GUI? If you just meant an IDE that will give you syntax highlighting and so forth for the code, Visual Studio of course does that for C# as well.

  1. I dont get tht idea because I dont know that language -.-
  2. Ill take a look at that link
  3. Yeah, but I dont really learn well from just tutorials, I guess Ill take a look at my library. Thanks

Edit: Now that I take a look at that link, I forgot that I dont have a masters degree in googling :[

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Mar 06, 2011 at 20:00

OK in pseudocode:

shipSpeed = 500
decrement = 5

if the forward key is up, or false, and shipSpeed > 0 do this:

subtract decrement(5) from shipSpeed
apply the shipSpeed to the ship for one loop or a short time
if shipSpeed is less than 5, make shipSpeed = to 0

if the key is down or true do this:

if shipSpeed < 500 make shipSpeed = to 500
apply shipSpeed to ship

C038daac744802d37cce97fb614fb739
0
elemein 101 Mar 06, 2011 at 20:02

@fireside

OK in pseudocode:

shipSpeed = 500
decrement = 5

if the forward key is up, or false, and shipSpeed > 5 do this

subtract decrement(5) from the ship speed
apply the shipSpeed to the ship for one loop or a short time
when this is no longer true, return shipSpeed to 500 and wait for key down to apply it again to the ship

Hrmmm, Okay okay.I think… maybe I could do it with a timer where the ship speed is 240, and after KeyAscii = VBw = false, then the ship continues, but over time decreses…. Hrm…

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Mar 06, 2011 at 20:12

I revised the pseudo code a little with key up and key down to hopefully make it more understandable, but you should get the idea from the previous.

C038daac744802d37cce97fb614fb739
0
elemein 101 Mar 06, 2011 at 20:37

K thanks.

Anyone have any fixes for the Winsock controls?