During the university, our college opened a course called C language, at that time the computer environment of the WINDOWXP, outside the net, can only on campus network, hard disk three stateless, no movies, no music, no games----except mine clearance. Is the so-called real potential hero, then the C language class to create a large number of minesweeper, APM (operation per minute, hit the war3 know) amazing. Cattle more people, nature to compete for a race, so the mine is also sporadic PK, but the PK rules are the cattle turn sweep, to see who used less time. At that time was pondering for that batch of cattle to create a network version of mine clearance, a competition, hey College students just like to think, do not want to do! Now step by step refactoring a network version of the socket based on sockets to miss the good friends of the university, and let the network programming confused novice or contact few friends to get started.
Because the focus is socket, in order to extract the core, so that the code more intuitive, so landing does not do, the game hall does not do (the garden has been done), the game table does not do, the integration system does not do, so the database is not used, the most original software------performance + logic May later have the time I will slowly join the landing, the hall or the integral system.
All technical points are listed below:
"1" mine clearance algorithm;
"2" server to build;
"3" multithreaded programming, involving the problem of accessing the UI across threads, multithreading debugging problem, thread synchronization problem;
"4" programme to generate landmines;
"5" to mine the client through the server communication;
Communication between the "6" server and the player watching the game.
The following is divided into more than one article, step-by-step completion.
"A" allows the click of the mine to run
"B" to build the world's most humble server
"C" lets the server and the client respond to each other
"D" allows the server to support millions of players
The generation scheme of "E" Thunder
"F" minesweeper online PK, done
"H" side of the game chat
"G" allows other players to watch the mine PK
"H" to join the login function
"I" Add the integration function
"J" Join the Game Hall
Interested in network programming friends can pay attention to my series, we can also be the network version of mine clearance to Gobang, chess, repeatedly see, poker and other online version!