Network Prog. Game over net. Explanation

This is a discussion on Network Prog. Game over net. Explanation within the C Programming forums, part of the General Programming Boards category; Hi! I need few explanation, how does all system work. I am using Dev-C++ 4.9.9.2 IDE. I made a game ...

  1. #1
    Registered User
    Join Date
    Nov 2010
    Posts
    21

    Network Prog. Game over net. Explanation

    Hi!
    I need few explanation, how does all system work.

    I am using Dev-C++ 4.9.9.2 IDE.

    I made a game in C language using Allegro library. When you run a game, you got 2 windows. One window is Command Promt, in which asks for nicknames, and also, when somebody win in game, prints who is winner. The second window is window for playing. There is table with 15x15 boxes. The game is similar to Tic Tac Toe Game, but it is just bigger.

    Game work properly on one computer. I want to make to play via internet.
    My question is: How to do that? What do i need ? Library ?

    Will i need a server, that is somewhere on the internet, and when i start game(client) it automatically connects to the server. When i click on box, program need to get information of the box (number, coordinates, which player clicked) and send it to server before drawing sprite (picture in box which i choose by clicking on it), so the server will then send information back to me, and also other players(clients) so then my client and other clients can draw sprite in box which I select. Can I also attach chat to the same server as I used for game? In my head, the server just need to wait for info and sends it back... Is that wrong ??
    Can i also make chat in already existing cmd window. I think i need to separate i cmd and main window. I tried to put line in code, for input in cmd gets(Text); but then whole program waited for input. Can i make then chat in cmd, and if I win in the game, send that information to the server, and server then sends massage to all '** Player 1 is winner **. '

    Maybe I am totally wrong, so that is why I asked here.
    I need an really good explanation about whole thing and how does it work.

    Also, if you have, post tutorials.

    Thanks.

    (sorry for bad English)

  2. #2
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    First of all Welcome clzola!

    Now my advice is this:

    1) Get rid of Dev. It is utter rubbish and obsolete. Install Code Blocks or Pelles which are free to download.

    2) You probably have to look into some basic socket programming in C. For this purpose I recommend Beej's Guide:
    Beej's Guide to Network Programming
    It's informative, funny and well written.

    3) Start with something basic and move on from there. Don't try to add all the functionality at once. It would be great if you could have diagrams or some sort of specs plan for what you want to implement so you keep yourself organized.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

  3. #3
    Registered User
    Join Date
    Nov 2010
    Posts
    21
    Thanks for greetings and thanks for quick replay and also advices.

    I will try it, and, still waiting for other replays ;D

    Also, i need to have Dev-C++ because of school, so will it work properly if I install Code Blocks

  4. #4
    Registered User
    Join Date
    Nov 2010
    Posts
    21
    Also, do I need a Database (MySQL or MSSQL) ?

  5. #5
    Registered User claudiu's Avatar
    Join Date
    Feb 2010
    Location
    London, United Kingdom
    Posts
    2,094
    Whatever school is recommending you use DevC++ is wasting your time. Dev is buggy, no longer maintained and very much obsolete. Of course something else will work you just need to import the source files.

    No, you don't need a database. This is a game you are developing and nobody is going to wait while playing for you to query the database server. Besides, it's not like you are moving around a ton of data that you can't keep track of.
    1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
    2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
    3. Get rid of conio.h and other antiquated DOS crap headers.
    4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple game over network
    By Tommo in forum Networking/Device Communication
    Replies: 2
    Last Post: 10-12-2007, 04:07 PM
  2. C Programming 2d Array Question
    By jeev2005 in forum C Programming
    Replies: 3
    Last Post: 04-26-2006, 04:18 PM
  3. craps game & dice game..
    By cgurl05 in forum C Programming
    Replies: 3
    Last Post: 03-25-2006, 07:58 PM
  4. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 01:32 PM
  5. Game prog. Tutorials?
    By SyntaxBubble in forum Game Programming
    Replies: 1
    Last Post: 02-18-2002, 03:02 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21