🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

In Need of Opinions

Started by
3 comments, last by Miraj 24 years, 3 months ago
Hi crew, I wasn''t sure where to put this as it is sort of related to both Winsock and OpenGL so I thought it would be safe to put it in the lounge. Okay, this is the story: I decided to test out my networking skills this week after I spent most of the last month studing up on TCP/IP and UDP. The first thing I did was create two Win32 Console applications, a client, and the server. I have them communicating nicely. All the server does is listen for the data and once it arrives I have it ''printf'' the string that the client sent as well as the number of bytes and bunch of other (pretty much) useless info. So since I got that working, I decided it would be cool to add some networking capability to a small game I had previously made a while back in OpenGL. So I left the server as it was (with the exception of a few minor changes) and added the client code to the game. I was pretty happy with the result, until I realize one potential little problem... The game uses a bitmap for its fonts. So here is the breakdown: When I type stuff in the console (chat box, buffer, command line, whatever) and hit enter it shoots it off to the server. The server then reports the correct bytes of the string BUT instead of outputing the string that was just sent to it, it outputs a string (with the right bytes) but with messed up characters. So is the problem that the server can''t interpret what it recieved because the fonts on the client side were drawn with opengl using a bitmap? If so, how would you all suggest I deal with it? This is the only thing I can think of as it always reports back the correct amount of bytes. However, I don''t really want to go to the trouble to create some huge scheme so they can translate and comminicate with each other if this is not likely to be the problem, so thats why I''d like to have some opinions on this first. Especially since this is my first time with networking and I could very well be missing something. -Miraj
-Miraj
Advertisement
Hi,

I know nothing of OpenGL or Networking, but it doesn''t sound as if this is your problem.

Sounds from your description like a problem with your font engine to me. Perhaps you need a translation table (or some code) to convert the string as transmitted over the network into the same text in a format recognised by the font engine.

Or did I just misunderstand?

George.

"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"

George. F"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"
Hi Geo,

Thanks for the response.

Ok this is a little confusing and I know my explanations could be better so just bear with me

My server is a Win32 Console App, while the game itself (client) is a normal Win32 app. Before I brought the client code over to the game it was originally a Win32 Console app like the server. I don''t want to clog the board with code but the basic idea was like this:

Client:
-------
printf ("Enter a string: ");
gets(string);
sendto(sock, string, strlen(string), 0, etc...);

Server:
-------
recvfrom(sock, string, PACKET, 0, etc...);
printf(string);

Then I took the client code and tucked into the working of the games console. I don''t think you misunderstood, but I think what your suggesting is that I do what I originally asked if I should do, which was create some sort of translator so the server could interpret the text/string coming from the client, since it does use its own font engine. Also, the console has its own method of retrieving data from the buffer, and doesn''t use gets();, so to me it seems like the server is actually getting the data except it isn''t outputing the correct ascii characters because it has no way of knowing that when the user types "Hi", that the H, and the I come from a bitmap that is being loaded and displayed with OGL, so instead it outputs nonesense.

The server like I said is just an old and very basic win32 console application using straight C for Input/Output.

So i think what your saying is that the problem isn''t with the server, but instead the changes need to be done on the game client with the font engine?

It may be me that explained it wrong or maybe I''m misunderstanding what you meant. Its too late here to begin with. Heh. I should just leave well enough alone and get some sleep but nope, if I do that I''ll just end up coding in my sleep, coming up with wicked implementations and then wake up and realize it was all a dream and those implementations are far from great much less make any sense in reality

Which brings me to a potential new topic, that happen to any of you out there? Heheh.


-Miraj
-Miraj
It sounds to me like you didn''t write the font engine yourself? Maybe you just copied somebody else''s code?

Well, at any rate... My guess would be this. Your console reads in a string from the keyboard. Next it passes the string to your font engine. The font engine translates the keystrokes into a series of indecies into an array of pixelmaps representing the various characters. You''re probably sendning those indecies to your erver, not the original string.

From the information given, that would be my best guess...
If a man is talking in the forest, and there is no woman there to hear him, is he still wrong?
Uh-huh,

If your font engine can''t cope with strings in ASCII, then your going to have to convert the ASCII string into whatever it is your font engine wants.

Have fun,

George.

"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"

George. F"Who says computer games affect kids, imagine if PacMan affected us as kids, we'd all sit around in a darkened room munching pills and listening to repetitive music....uh oh!"

This topic is closed to new replies.

Advertisement