Large image


Category — C++

Network Toolkits.

Like everything else, there are many different types of networking engines/tool kits. All of these have various different advantages and disadvantages. So here I hope to summarise what tool kit is best for different types of developers.

So to kick of we are going to start talking about game developers.

Game Developers:

Half Life 2 - Game Developers Quake II

Well.. for game developers, it is key for the game not to get lagged down by network communications.

The theory behind games is the main loop. This is where everything is executed (graphics, audio, network, etc…). This means that if anything run slowly, the whole game gets held up. This causes lag and generally pisses of the user. So when you think about the network process, assuming your using TCP, this means sending the data and then waiting for the receiver (the player) to tell the sender (the game server), the executing the rest of the data. The problem here lies in the fact that the game has to wait for the reciver to tell the sender that the data got there OK. So this potentially could cause a hold up in the game loop. What would be ideal is that if we didn’t have to wait for the reply.

This is where UDP comes in. Using UDP, programs on networked computers can send short messages sometimes known as datagrams (using Datagram Sockets) to one another. UDP is sometimes called the Universal Data-gram Protocol. UDP doesn’t wait for a confirmation, it just sends it and carries on. This is great as there is a much slimmer chance of it slowing down the game.  So now you understand the theory behind it, lets move on.

The library I recommend is RakNet. Raknet is a cross-platform C++ game networking engine. It is designed to be a high performance, easy to integrate, and complete solution for games and other applications.  It used by major software products like Unity, Sony Online Entertainment ( for more on that see their site: http://www.jenkinssoftware.com/ ).  It is really easy to integrate it well into your software/games. For a first time tutorial visit here: http://www.rakkarsoft.com/raknet/manual/RakNetMajorFeatures.html.

So that’s for the games side, now for software dev…

Software Developers:

For software dev’s, speed isn’t as important as it would be for an on-line games. Reliability and organization are way more important. Especially for file transfer programs and e-mail applications.

For this it would be advisable to use something like Qt. This is a well established toolkit that handles everything. It uses TCP\IP and gets your data there reliably and in-ordered. For more information visit here: http://doc.trolltech.com/4.2/qtnetwork.html

Well, that’s all for now. I hope that has helped with you development. Don’t forget to check out my projects.

Harry.

July 12, 2008   No Comments

Xeon – Game Engine

Yes, you heard me. I am working on my very own game engine, and a set of games to come with it. These will be of the FPS genre.

This will be entirely open source, so you can use the code, do what ever you like to it.It is developed in C++.

The engine will be designed for the First Person Shoot genre games. Like Counter Strike 1.6  and Half Life. It will have multi-player support via Direct-Play (might change to Winsock 2.2 in later version of the engine?), it uses mainly DirectX.

When it is more mature, there will be posts on how to use it. These will include how to set up the engine, how to render a basic scene, etc…

In the meantime, check out Irrlicht for a graphics engine.

Harry.

July 11, 2008   No Comments

Which IDE?

Well, as we all know today, there are hundreds of Integrated Development Environments out there. The most well know ones are Visual Studio (also available in Express Editions), Dev C++ and many more.

Why so many, you may ask? Well products like Visual Studio, they were created as an IDE for Microsoft’s Visual Basic, C# & C++. Dev C++ was created as a free alternative to Visual Studio for C/C++. Many other IDEs are made for this reason but each with their own little spoonful of individuality.

Visual Studio.

Well, in my view, Visual Studio is one of the best IDEs out there. It has everything the software engineer could ever want!

It has all the usual features like a Code Editor, Debugger, Designer, and many other useful features.

The designer is one of the cooler features. It is capable of handling Windows Forms, WPF, Web Designer, Class Designer, Data Designer and Mapping Designer. This is very handy and cuts out a lot of boiler plate code writing.

Also, MS VS debugger is very handy.

This debugger owes much of its feel and functionality to CodeView, a standalone, text-based debugger that shipped with Microsoft Visual C++ version 1.5 and earlier.

More advanced features of the most recent versions of this debugger include:

  • Full symbol and source integration.
  • Attaching and detaching to and from processes.
  • Integrated debugging across programs written in both .NET and native Windows languages (calls from C# to C++, for example).
  • Remote machine debugging.
  • Full support for C++, including templates and the standard library
  • Debugging ASP.NET Web Services.
  • Standard as well as more advanced breakpoint features, including conditional, address, data breakpoints.
  • Many ways of viewing program state and data, including multiple watch windows, threads, call stack, and modules. The way library and user data types are displayed can be configured (e.g., to show contents of a container class, rather than it’s raw structure).
  • Scriptability or the ability to control via a macro or scripting language. Any language which can talk to COM can be used.
  • Edit and continue support, enabling source code change and recompilation without having to restart the program (32 bit applications only).
  • Local and remote debugging of SQL stored procedures on supported versions of Microsoft SQL Server.

The main shortcoming of the Visual Studio Debugger is its inability to trace into kernel-mode code. Kernel-mode debugging of Windows is generally performed by using WinDbg, KD, or SoftICE.

Dev C++.

The best thing about Dev C++ is that it is completely free! It was developed by Colin Laplace.

Its features include

  • Support GCC-based compilers
  • Integrated debugging (using GDB)
  • Support for multiple languages (localization)
  • Class Browser
  • Code Completion
  • Debug variable Browser
  • Project Manager
  • Customizable syntax highlighting editor
  • Quickly create Windows, console, static libraries and DLLs
  • Support of templates for creating your own project types
  • Makefile creation
  • Edit and compile Resource files
  • Tool Manager
  • Print support
  • Find and replace facilities
  • Package manager, for easy installation of add-on libraries
  • CVS Support
  • To-Do List
  • CPU Window

Also, just out of interest its source code is available.

Eclipse.

This is another great completely free IDE. It is mainly know for it’s Java IDE, but since then many more languages have been added to Eclipse such as C++, PHP and COBOL.

It has a very wide user base and is active in development, unlike Dev C++.

Eclipse varies from the other IDEs in that language support is added via the use of plug ins, so it is very easy to add support for a new language.

Conclusion…

Overall, for C++, C# and Basic I would use Visual Studio, but for Java programming it would be advisable to use Eclipse or Netbeans.

Harry.

July 8, 2008   No Comments

WinAPI, Is it worth it?

WinAPI

Hey all,

With all the new and upcoming GUI tool kits, most of them cross platform, is it worth learning the native WinAPI? Well, yes and no. It all depends on what you want to use it for.

The WinAPI is clunky and horrible to use. For example, any of you windows programmers who have working with the API will know that it requires around ~70 lines of code just to run a blank window. Why bother when the same can be done with a few clicks using windows forms, or ~10 lines of code using Qt?

Game Developers.

Game developers do not have much to do with GUI design and implementation, but when they do, they use the Windows API. This is because it that only need to use it for a little bit of the project their working on (DirectX/OpenGL does the rest), it also doesn’t come with the overhead of MFC.

For this sort of purpose, the WinAPI is fine. You only need to use a little bit of it and, it doesn’t come with any overhead (such as MFC). What happens when you want to do serious GUI development in major project. A lot of your time will be spent programming boilerplate GUI code instead of making your product functional. Want a solution? Read on…

Software Developers.

Now, for software developers, there are a wide range of options for implementing a GUI.

The first option is using the Windows API. Using the native API for the complete GUI would be cumbersome. Look at Notepad++. A lot of the code is for the GUI that is implemented in pure WinAPI.

Another option is the most commonly used one. This is using a GUI tool kit. There are some many out that there isn’t enough room here to list them all. The main players are Microsoft Foundation Classes (MFC), Qt, GTK but there are many more. For a complete list visit here.

These tool kits and library’s can save a trem

endous amount of time when developing a GUI. With these you can concentrate on the functionality of your product, not the boilerplate code that used to be needed.

Sally - A C++ IDE

There are also many GUI designers out there. Qt comes with one as does Visual Studio. Also Sally – A Simple C++ IDE which uses the SmartWin library. Visual C# and Visual Basic all come with an integrated GUI designer which uses Windows Forms and WPF.

Conclusion

So, it really boils down to what your needs are. If you are on a deadline then use something like Qt. If you are in it for the learning experience like me then it’s best to go with the Windows API to learn the mechanics of Windows.

Hope this helps!

Harry.

July 8, 2008   No Comments