Hi Guys,
This is the second net 'chat' application I have written, this time it uses OpenGL and the Raknet library. It's still pretty simple, but I hope to build on it to allow internet play in future fames. It works well with using the 'local loop' to connect to my PC, but I suspect connecting via the Net will be more problematic. Can anyone out there help me test it?
Download:
http://www.reflectedgames.com/Chat_Test.zip
My IP is:
81.104.225.193
Press 'n' and enter when asked for server y/n?
Enter your username
Enter the IP..
Thanks!
Rich
It's working for me for the local part. As I am at work I can not test the internet part.
The main problem for me is that you send a message even when it is an empty one, and that à,ë,ï,é,è... are not supported.
EDIT: Even ê,ô,û,â and others are not.
Hmm ha, and the just the server is consumming 27% of my Athlon64 X2 .
For the internet thing, I can say that you will not have any other problem than a bigger latency. As a chat is not necessary a time critical app, you do not need to worry.
]]>Hi Gull,
Sorry, I'm only really checking for english language specific keys at the moment.
I'm also doing sleep(1) every frame, so I'm surprised it is using 27%..
For the internet thing, I can say that you will not have any other problem than a bigger latency. As a chat is not necessary a time critical app, you do not need to worry.
I only intend to use it for turn-based games, so I'm hoping I won't have too many problems. But I'd imagine there are some issues I'm not aware of yet with doing this kind of thing.
]]>You know my results.
I would type 'typing' and this would show up 'typiping'. Where'd that extra p come from?
Mine is a 600MHz PCIII.
What network lib are you using?
What does your input look like?
I have no idea! It doesn't do this for me or for a few other people who have tested.
There shouldn't be a difference between the text you enter at the bottom and your text that appears on the screen as it is printed 'locally'..
]]>Here is what I used for my networked connect four game (attached)
I'm using gamecom for the net lib.
1 | if ( keypressed() ) |
2 | { |
3 | // if mouse lies inside chat box |
4 | if ( mouse_x >= 128 && mouse_x <= SCREEN_W - 129 && |
5 | mouse_y >= SCREEN_H - 108 && mouse_y <= SCREEN_H - 92 ) |
6 | { |
7 | ch = readkey() & 0xff; |
8 | |
9 | // if backspace is pressed and length is > 0 |
10 | if ( ch == 8 && strlen( chat_string ) > 0 ) |
11 | { |
12 | strcpy( buf,"" ); |
13 | strncat( buf, chat_string, strlen( chat_string ) - 1 ); |
14 | strcpy( chat_string, buf ); |
15 | } |
16 | |
17 | // if can add another character to string |
18 | if ( strlen( chat_string ) < 39 ) |
19 | { |
20 | if ( ch >= ' ' && ch <= '~' ) |
21 | { |
22 | sprintf( chat_string, "%s%c", chat_string, ch ); |
23 | } |
24 | } |
25 | |
26 | // if enter is pressed |
27 | if ( ch == 13 ) |
28 | { |
29 | chat_list[ p_local ].addMessage( chat_string ); |
30 | |
31 | if ( type == TYPE_PEER ) |
32 | { |
33 | // add message to message queue |
34 | gc->QueueMessage(peer,GCOM_SEND_CHAT,chat_string); |
35 | } |
36 | strcpy( chat_string, "" ); |
37 | } |
38 | } |
39 | else |
40 | { |
41 | clear_keybuf(); |
42 | } |
43 | } |
]]>
@Phipps: It is using 27% because I run both client & server from same host ! Yeah, I made a mistake on my first post: Just the server and one client are consumming 27% of my unit.
]]>I would type 'typing' and this would show up 'typiping'. Where'd that extra p come from?
I guess, key repeating is starting too early (and it repeats each key you are pressing, not just the last one).
I'm firewalled here in uni, I'll see if I have time to test it when I get home
]]>