C++/C/C++

Advertisement


Question
Im just wondering two things. One can C/C++ be used to create online games where players can talk and chat etc. MY second question is if you know if there are any good free sites to learn C++ or and books. Pease answer I will really apreciate it. Im using bloodshed Dev C++ as compiler. Im trying to make an online game.

Answer
Well, yes C and C++ can be used to create online games - they are used to create all sorts of applications - including operating systems. Hence if they can be used to create a system that runs when a device is booted (probably with a little assembler code here and there) then they certainly can do anything else you can do with a general purpose digital computer!

However that having been said, the next question you should ask yourself is: Is it the best / easiest / most appropriate way to do so?

As C and C++ have no built in support for networking or internet knowledge the answer is quite possibly "no", at least at the server end (assuming you are using a client server model), unless you have special requirements - such as performance. The answer for the client end may be somewhat more complex depending on the type of game - if it is a full immersion 3D shoot them up or the like then you may have to deal with C or C++ - especially if this is supported by any game engine frameworks you might use - just to get the required frame rates.

On the other hand if you are developing a more relaxed type of game - such as a turn based game like a multiplayer card or board game then here again other options may be easier to work with.

I would look at Java for starters as an alternative to C or C++ in this area.

If you do decide to continue down the C/C++ route then I would certainly advise looking at 3rd party libraries to give you a boost such as the ACE library (see http://www.cs.wustl.edu/~schmidt/ACE.html) and the Boost libraries (see http://www.boost.org/) for starters. The ACE library is a free to use cross platform C++ library that has support for the sort of things typically done by most types of network applications. The Boost libraries are a set of libraries in the spirit of the existing standard C++ library that are not (yet) part of the standard. They add a whole range of useful things - some of which you probably will not need yet and other you may find useful.

As to books and tutorials you could start by checking out the reviews and resources (including ones on C/C++, Java, C# and a section on learning a programming language) at the ACCU site (see http://www.accu.org/) and maybe consider joining as members can participate in various mentored developer projects - including one on beginning C++. Another site with a useful set of FAQs and book suggestions is the Comeau site (see http://www.comeaucomputing.com/ and specifically http://www.comeaucomputing.com/techtalk/) - it also has links to other FAQs.

As to online tutorials - I have never used them as I started using C++ over 10 years ago, before I had an internet connection so cannot advise. However notice the comments on the Comeau techtalk FAQ at the end of the first question on books they recommend - the online tutorials they have seen they do not seem to think much of!

Finally, you will find that both games and online applications can be complex beasts. Do not think that just learning a language and some libraries will get you all the answers. You should also spend time developing your analysis and design skills - you will need to analyse your problem and design a solution. Note this can be an iterative on-going process so you do not have to get all the details sorted in one go. I find it useful to get a clear picture of your eventual goal - what the game is to do, how it should function - as soon as possible then start filling the details on how to make it happen. This is like defining where you want to go then sorting out how you are going to get there.

Split the problem into specific iterations of development - for example the first iteration may be the tedious details of naming conventions and source code layout internally and within the file system - the target application for this first iteration to be an up and running project with project directories, version control and initial source files for a placeholder application that may just display a splash screen of some sort and then allow the user to exit - in your case you may need a server and a client application unless of course you are using a peer-to-peer architecture. However all those tedious little details such as icons and application installation (server and client) and the like could be sorted at this point at least to an initial degree. The next iteration could add some other aspect of the game - maybe the client - server protocol or the peer-to-peer protocol: each end just responding with placeholder responses and queries - however at this point you have the client and server (or peers) talking to each other if not much else. Next you could add some actual game playing.

At each iteration you have a definite target goal. You can focus on this sub-goal and leave much of the rest to another iteration (but you have to bear the larger picture in mind at all times to some degree, so as not to loose the plot and go off on wild flights of fancy!). Note that this can be extended such that each iteration is split into sub-iterations - its all about reducing the problem to handlable sized chunks - or maybe that should be mind-able sized chunks as it how much complexity can be handled in one go - more of a mind thing and a hand thing.

As an example I have been investigating developing for the Symbian operating system for smart phones. To learn about this operating system I decided to implement (with a friend) a version of noughts and crosses - the game was chosen as it is easy to understand and implement - and therefore required minimal analysis to determine how it works - we already knew! However we knew nothing about developing in C++ for Symbian platforms so this was the real challenge! The project was split into several iterations as follows:

Iteration 1: Project inception. The deliverable was a Symbian style installations file containing a "stub" executable that could be loaded onto a suitable mobile phone and executed.
The goal was to bootstrap the project and demonstrate the complete build, debug, testing, packaging for deployment and installation sequence. In the process coding conventions were defined, a directory structure for the source code defined and implemented, a Sourceforge project set up and the initial source code and resource files created.

Iteration 2: Design and implement the board and piece display component architecture and implement the basic display component. This iteration involved a lot of time developing a test application for the interfaces and components involved in the target goal.

Iteration 3: Design and implement the nought and crosses game for single handset games.

Iteration 4 and 5: Add in the two handset game functionality using various connection techniques.

The last two are the next to be looked at, when we have time, and are up for review as to their exact goals. Initially it was thought that iteration 4 would be for local connection technologies such as infra red and Bluetooth and iteration 5 for non-local connection technologies such as SMS and GPRS. However this may change as a greater understanding of the problems is acquired.

Hope this gives you some pointers. Good luck with your game.  

C++

All Answers


Answers by Expert:


Ask Experts

Volunteer


Ralph McArdell

Expertise

I am a software developer with more than 15 years C++ experience and over 25 years experience developing a wide variety of applications for Windows NT/2000/XP, UNIX, Linux and other platforms. I can help with basic to advanced C++, C (although I do not write just-C much if at all these days so maybe ask in the C section about purely C matters), software development and many platform specific and system development problems.

Experience

My career started in the mid 1980s working as a batch process operator for the now defunct Inner London Education Authority, working on Prime mini computers. I then moved into the role of Programmer / Analyst, also on the Primes, then into technical support and finally into the micro computing section, using a variety of 16 and 8 bit machines. Following the demise of the ILEA I worked for a small company, now gone, called Hodos. I worked on a part task train simulator using C and the Intel DVI (Digital Video Interactive) - the hardware based predecessor to Indeo. Other projects included a CGI based train simulator (different goals to the first), and various other projects in C and Visual Basic (er, version 1 that is). When Hodos went into receivership I went freelance and finally managed to start working in C++. I initially had contracts working on train simulators (surprise) and multimedia - I worked on many of the Dorling Kindersley CD-ROM titles and wrote the screensaver games for the Wallace and Gromit Cracking Animator CD. My more recent contracts have been more traditionally IT based, working predominately in C++ on MS Windows NT, 2000. XP, Linux and UN*X. These projects have had wide ranging additional skill sets including system analysis and design, databases and SQL in various guises, C#, client server and remoting, cross porting applications between platforms and various client development processes. I have an interest in the development of the C++ core language and libraries and try to keep up with at least some of the papers on the ISO C++ Standard Committee site at http://www.open-std.org/jtc1/sc22/wg21/.

Education/Credentials

©2016 About.com. All rights reserved.