Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 26 Mar 2002
Offline Last Active Aug 11 2016 12:03 PM

#5091544 Why are static variables bad?

Posted by on 04 September 2013 - 07:32 AM

As a concrete example of why they are bad:


I am using Cocos2dX for a project. And we had to send network call. Great, cocosx provides a client HTTP built on top of Curl.

It's a singleton class (Which means a global var basically) with most of its variable static or globally declared in the CPP. It didn't cause problem at first. Everything is queued when I make multiple call. Ok, perfect.


But then, we started to want to send some calls simultaneously. LIke uploading a file in the background, but continuing navigating in the app.


But we can't, because there is only 1 instance of the HTTP client! And we can't instantiate another one, because everything is static in it. And they even had global vars in the CPP!! A design that sounded good at first ended up a nightmare. I was able to remove the static vars and globals. I can now create multiple instance of the class.


It's a good example I believe. Also if your game end up supporting multiplayer or split-screen. If all you have are static, you will be in hell. (Been there also)

#5089185 Managers, which pattern should I use

Posted by on 26 August 2013 - 09:05 AM

Singleton pattern is the most commonly used for managers.

Just careful to not put managers as singleton that don't need to be.


One day you will want to add multiplayer, or split screen, to your game. And all those singleton will haunt you.

Some things, like Texture manager, should definitely be in a singleton. It's sharing textures across all part of the engine.


But input manager, maybe not. If you add a second controller for player 2, you might want him to handle his own input separately, and you will want a second instance of input manager.


What I do in my games generally, is create a global singleton, where I put all those managers in.




Not the best practice, but accessing things easily from everywhere is nice too. Also I cant keep all my other managers singleton-free.

#4816142 What is Microsofts problem?

Posted by on 26 May 2011 - 01:21 PM

Having developed on every platforms and most of the consoles/devices out there. I find Visual Studio the best IDE that exists. It has its problems, but its still the best in my opinion.
Only bad thing about it personally is the intellisens. And if your employer is too cheap to buy you a licence of VisualAssist (My case) then it's a bit troublesome. But I never had problems with libraries dependencies and I've used them a lot. Not sure what you are talking about?

XCode was a nightmare to work with in my case. I guess it's a matter of taste/experience with one more than the other. Very bad post tho. I believe Microsoft cares more about its developers than its concurrents. Giving Android as an example is a very bad example. Just try to code a C++ app on android. That was a hell of a nightmare with not even a STL implementation. Same things goes as Xbox dev vs PS3 dev, etc. Microsoft always win as developer support and softwares.

#4812628 Thoughts on multiplayer only indie game?

Posted by on 18 May 2011 - 11:47 AM

We did pretty well with BaboViolent2. It is multiplayer only, we don't even support bots. And we still have a pretty big player base at the moment, 4 years later.
I think if you do it right, and have a place where the community can grow (Forums, etc) and a good way of listing / joining games. You will get your player base pretty quickly.

Now the problem is, to keep it!

players you have will quickly abandon ship

This was exactly what happened with our "Madballs in... Babo: Invasion" game. The player base was high for some weekends after a sale, but then went go down and then people will say: Game is good, but the multiplayer is empty! Luckily we added a single player campaign to it.

I think you just need to make a game that feels right and people don't get bored too fast. And mostly: Competitive. That is the key, otherwise player base will disappear quickly.

#4804506 Is an MS in Mathematics enough to break into graphics?

Posted by on 29 April 2011 - 11:51 AM

Is an MS in Mathematics enough to break into graphics? Yes
Do you need a MS to break into graphics? No

I have only a college degree in game programming, and I am Lead Graphics Programmer today. Only what I needed was linear maths, and LOT of experience in Rendering. I did some integrals and such in college, but doesn't remember much about it. I find myself limited sometimes in the understanding of certain papers. So it would surely help to have a MS. Depending what branch of graphics you are going: Medical, research, gaming. For gaming you just need the basics, clear understanding of matrices and shaders. Because the most complex things you might have to achieve are SSAO and deferred rendering. The other complex rendering techniques are mostly for research and show off demo. Not for actual games. Unless you are aiming the top (EPIC Games, Crytek...)

#4804487 C++ Classes Question

Posted by on 29 April 2011 - 11:09 AM

I tend to agree with @nfries88. When a project gets very big, compile time becomes a big issue. By using pointers, you can use forward declaration. We should do that as much as possible, unless you do not have other choices to not use pointers.

#4803747 C++ Classes Question

Posted by on 27 April 2011 - 04:37 PM

class B
    B() : instance(... parameters...)

    A instance;

And you can add more initialization separated with commas:
class B
    B() : instance(... parameters...), anotherMember(15.0f)

    A instance;
    float anotherMember;

And of course, it can be done in the CPP as you would normally do.
header file:
class B

    A instance;
    float anotherMember;
cpp file:
B::B() : 

#4798127 tower defences hybrid

Posted by on 13 April 2011 - 02:40 PM

There is a new one on steam:Anomaly: Warzone Earth

Anomaly: Warzone Earth is an extraordianry mixture of action and strategy in a reversed tower defence formula.

#4792694 64 bit variable in C++

Posted by on 31 March 2011 - 12:25 PM

You compared C# with C++.

Two different languages. How is that test even accurate?

#4792689 64 bit variable in C++

Posted by on 31 March 2011 - 12:16 PM

VC# is not VC++...
C# (C sharp) runs on a virtual machine (.NET) and is a different language.