C++ is Good for Fast Coding

Warning! Some information on this page is older than 3 years now. I keep it for reference, but it probably doesn't reflect my current knowledge and beliefs.

18:16
Sun
25
Nov 2012

C++ is Good for Fast Coding

Many people believe that C and C++ are languages suitable only for coding some special kinds of applications - low level or high performance. I think it's not 100% true. Here is a story: 2011-11-11 we had a game development competition organized in this topic on forum.warsztat.gd, called "Explosive Hamster Exhibition Compo". The name comes from crazy game titles that can be generated by Video Game Name Generator, which was used in this compo to generate a topic, unique for each participant. We had to develop a game in 3 hours. From 3 topics generated for me I chose "Micro Sewer Plus" and made a game about closing sewers. (Download: Reg - MicroSewerPlus.7z - binary + source code, 479 KB.)

I managed to write this simple yet playable game in 3 hours and took 2nd place out of 10, despite my game was written in C++, while many others used the "easier" or "quicker" technologies like Java, JavaScript, XNA o Game Maker. What I want to show here is that C++ is not necessarily a language in which coding is hard and slow. It's all about having a good framework - a library with a set of functions and classes that handles all low-level stuff and allows you to implement the game itself quickly, easily and directly as you think about it. You don't have to manually free all allocated memory if you have smart pointers. You don't have to write shaders and setup Direct3D render states if you have Canvas class with methods like DrawSprite(x, y, color).

You can prepare a good library by yourself or download one of many freely available on the Internet and use just like in any other programming language. What you get in return when deciding to use C++ is great flexibility in defining how the interface of your library looks like. Thanks to templates, operator overloading and all that stuff you can create your own domain-specific language inside C++ (like the << operator is used to write to stream objects). At the same time, due to compiling to native code, creating objects on the stack and other language features you don't have to sacrifice performance. You don't have to use separate variables float x, y, z or dynamically allocate new Vector(x, y, z). You can define a vector structure with overloaded operators, use it conveniently and compiler will optimize the code so you can do thousands or millions of vector computations per second.

Comments (0) | Tags: c++ warsztat compo productions | Author: Adam Sawicki | Share

Comments

(No comments)

Post comment

Nick *
Your name or nickname
E-mail
Your contact information (optional, will not be shown)
Text *
Content of your comment
Calculate *
(* - required field)
STAT NO AD [Stat] [Admin] [STAT NO AD] [pub] [Mirror] Copyright © 2004-2017 Adam Sawicki
Copyright © 2004-2017 Adam Sawicki