Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Sep 2012
Offline Last Active Today, 08:46 PM

#5163140 Memory match game - choosing engine

Posted by ByteTroll on 26 June 2014 - 09:01 PM

Personally, I think an "engine" is overkill for this type of game.  At the core, the game is really just a whole bunch of 2D images and audio with some logic behind it.  To me, a better solution would be to code the logic based around a common frontend and then code backends for each platform that you need.  This way, you are only rewriting the code that needs to be changed.


EDIT: However, this would depend on how you want to approach things.  Programs like GameMaker should be able to handle this kind of work with less hassle.

#5161318 Share the most challenging problem you solved recently! What made you fee...

Posted by ByteTroll on 18 June 2014 - 08:22 AM

I just got a nice wrapper for GLSL shader programs working. Now, with just a single line of code, I can create a shader program.


I literally just got done doing this yesterday!

#5151188 Help me with that error please!

Posted by ByteTroll on 03 May 2014 - 07:45 AM

As everyone else has mentioned, you need an entry point.  Otherwise, where does the program start?  Seeing as you declared a message proc, you want:

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR szCmdLine, int iCmdShow ) {

//Do stuff here.

return 0;

You will also need to check the message queue and handle those messages in the main function.

#5137165 Switch or Not?

Posted by ByteTroll on 07 March 2014 - 12:05 PM


As far as C++ is concerned, you have only barely scratched the surface. And if you haven't learned much on classes, then you probably know next to nothing about inheritance and polymorphism.
6 months for "console part", another 6 months for "gui part"... How did you come up with this "study plan" for learning C++? Why the 6-month timeframe?
Now I'll throw some *VERY* basic interview questions. Can you discuss the pros and cons of using smart pointers? Suppose I create a class which has a nonempty destructor - is there a reason for me to write a copy constructor and an assignment operator as well, or are those not necessary? What is an unnamed namespace good for?
But enough of C++. What's the rationale behind studying math and physics AFTER learning to program? Do you already know all there is to know about trigonometry, vectors, and basic kinematics? Do you not know that working on math and physics exercises improves your problem-solving skills, which you'll need VERY MUCH in just about every single project you ever attempt?
Have you coded *BY YOURSELF* any of the games mentioned here and here?

You quoted me on what i've learnt on c++ but yet you ask me questions on what i haven't learnt.
I haven't made any of those "here" and "here" and i've said that before.
The 6 months part is for first learning and when i'm done with that i'll start physics and maths before i do the "here" and "here". How won't i know that physics and maths increases your problem solving skills?



There is not much more that I am thinking that hasn't already been said, so I am going to make this short and simple.  Nathan, in regards to georger.araujo's reply,

you state "You quoted me on what i've learnt on c++ but yet you ask me questions on what i havent' learnt."  Plain and simple -- if you cannot understand any of these basic questions (especially the one about the destructor, which you should be able to guesstimate an answer to), you need to go back and review "basic" concepts again.  I don't mean to discourage you but the cold reality is that this field takes a lot of time and dedication (which you have not/are not putting in) and problem solving skills (which based on your other posts about Google, you show a lack of).

#5123759 Classes and use of 'New'

Posted by ByteTroll on 14 January 2014 - 09:40 PM

Ah ok starting to get it.


Last stupid question I promise smile.png


By just going SomeClass cTest shouldn't the program allready know how much to allocate though? As, it should know the sizeof(SomeClass).


Or does this just simply not happen here?

What you are doing by "SomeClass cTest" is called Instantiatation.  When you instaniate an object, memory will automatically be allocated and deallocated for you (in the case the object being declared in a function)

#5122977 Please check this for me. :)

Posted by ByteTroll on 11 January 2014 - 10:18 PM

C-style functions are stand alone functions, C++-style functons are wrapped up and stored in an object.



//This is C-Style header
void MakeAnimalSound();

//This is C++ style header
class Animal {
        void MakeSound();


//This is a C-style implementation
void MakeAnimalSound() {
    //Do stuff here



//This is a C++ style implementation
void Animal::MakeSound() {
    //Do stuff here

#5122942 Please check this for me. :)

Posted by ByteTroll on 11 January 2014 - 05:29 PM

The goal of functions is to break up larger groups of logic into smaller, self contained groups of logic.  In your case, you are breaking up mathematical operations.  While it is true that this produces more code, it *usually* makes programs easier to maintain.  Since I have seen you post a lot about game engines, I will use an example relating to a game engine.  You don't write a game engine entirely in the entry point -- to do so would be stupid, long, and it I can almost guarantee the code would not be maintainable (or is some cases usable).  On top of that, there are some special use cases were you would need functions.  Take for example a "collision check" function which returns a Boolean value -- "true" if there is collision, "false" if there is no collision.  Because of the functions nature, it could be called 1000+ times per-frame.  If you don't use functions, you would have to type the same code over and over again, versus calling a self contained function that takes two objects and returns a Boolean value.


Addressing the code snippets you have posted and the fact that they do not compile.


First, you mention "C++."  What you are programming in there is the beginner "hybrid mix."  The way you are declaring functions is C-style syntax, but you are including C++ standard headers and using C++ data types (std::string).  While not an issue, it is a pet peeve of mine.  Second, after each function declaration you have "/>."  I am not sure if that is something your phone added, or if you coded that, but "/>" is not valid C or C++ syntax.  Third, C++ is CASE SENSITIVE.  In the parameter list of the functions you declare "B" as uppercase, but when you use it in the method, you use "b."  Finally, while not a problem, it annoys me a little.  The way you handle input is off.  You print out instructions once, and then have the user input three numbers, two of which have no instructions as to what they are.  If I didn't know this was a calculator, I would be staring at the screen, scratching my head.


Happy coding,

~ Byte.


EDIT: One more thing -- "Quit" generally referrers to the program exiting.  "system( "cls" )" clears the screen.

#5112804 Modifying an open source game engine for your needs:Where should I start

Posted by ByteTroll on 28 November 2013 - 11:34 AM

There are a lot of other people here that have, for the most part, summed up what I am thinking.  For this reason, I will not restate their information.  With this being said, I think you need to heed other peoples warnings and take it to heart.  While I don't mean to discourage you, the fact of the matter is this: you need to reevaluate you current goals.  You say that you want to modify a game engine (that you did not code and have no knowledge of), going on to state that you have no knowledge of C++.  Plain and simple -- this is not going to happen.  It takes many man hours and huge teams of people to achieve what you are wanting to achieve.  I have 8+ years coding with C++; before that, I had several years of low-level C coding.  I (as well as most other programmers) work for 10+ hours a day.  At this rate (in a team), it would still take years to achieve what you are wanting to do.  Adding to the point of not knowing C++, you state that it won't take you years to learn C++, only a couple of months.  I don't know a single programmer (including myself) that is still not learning their language a decade after they started.


With that out of the way, I will offer you this advice.  You hint at the fact that you know how to program in another language.  I assume that your goal is to make a game.  My advice to you is move into mobile development.  This will teach you some things that can be applied to other languages, it can be done with a smaller number of man hours, and there is money to be made.  After you spend some time there, then move on to smaller projects.

#5100682 Coud any one explain me the following code "self"

Posted by ByteTroll on 11 October 2013 - 08:27 PM

Can't quite tell; not enough code.  I am going to go out on a limb here and say it is a Singleton pattern implementation -- especially if it returns a manager (pointer) or reference.  Singleton is a pattern that states that there is one instance of an object that is shared by the entire program.  In which case, the manager class contains a static instance to that class, a private constructor, and an overloaded assignment operator.  In this case, you would be fetching the shared instance.

#5098992 Guidance for my son...

Posted by ByteTroll on 05 October 2013 - 12:18 PM

I also started programming at the age of 10.  Firstly, I don't know if it will work for everyone, but I started programming in BASIC on a Commodore 64.  BASIC is an easy language for a young mind to wrap around, but it contains a substantial deal of the thought process needed for other programming languages.  Looking back now, I also owe almost all of my knowledge of writing good code to programming on a Commodore.  A lot of new programmers today don't have the slightest idea what it is like to have to erase comments to write more code... memory limitations at its finest!  I also second the basic application design.  Everyone will recommend different languages to start with, but if you do end up going a route like C or C++ first, I would emphasize programs like a text based RPG, or a calculator.  I would also pick a weekly topic (such as if, else control logic) and have him write a program using only this logic.



My suggestion is to take it easy, a 10 year old is what, 3rd grade? Making games involves math that is more complex that I who am 20 can't do. Plus, being 10 his mind is not developed enough yet, the scope of what could be understood and comprehended is small.
Hell, I only understood the meaning of some events that happened in my life when I was 15-16 let alone if I was 10.

He's actually 12, not 10. And I know a 12 year old who can script or program and catch on about as well as I can, and I'm an adult. So he should be fine. I know it sounds strange, but it is possible. 12 year olds can do more than you think, not everything but they seem to be able to do some things about as well as adults.



I know several young programmers.  I have found that it usually is not the fact that they can not understand the logic; it is the fact that they can not understand the logic in the current context.  You have to find creative ways of expressing the logic in ways that they can understand.  Granted, game programming does require math and in some areas the math is pretty advanced, but last time I checked, you don't need Algebra or Geometry to create a simple text based RPG, learn control logic, or start building good programming habits.

#5083195 My OLD Syntax

Posted by ByteTroll on 05 August 2013 - 05:52 AM

I swear we had a programming style's discussion/argument not less than a month ago.  will it never end?!


Nope, it is a hazard of the profession rolleyes.gif


You're wasting vertical space ... this is much better biggrin.png

if (keyboard_check(vk_left)) {
        x -= 5;              }


There is nothing wrong with wasting space.  As Servant said "Whitespace is free.  Monitors are large."  Everyone knows this is the right way:

        x -= 5;              

#5083189 The Joys Of Nesting

Posted by ByteTroll on 05 August 2013 - 05:06 AM

I have this plugin wired into Eclipse, that adds big red warning flags in the sidebar whenever an individual function exceeds 10 statements in length.


You might want to consider getting it smile.png


I was flipping through and this made my day!

#5082193 pointers

Posted by ByteTroll on 01 August 2013 - 07:04 AM

Si is right. The first two are the same thing. They are a matter of personal programming style. The second one should not compile. Thirdly, these technically are not pointers, they are references. Pointers are declared with the "*" symbol and work a little differently than references.

#5043649 Am I a bad programmer?

Posted by ByteTroll on 16 March 2013 - 04:51 AM

The question shouldn't be "Am I a bad programmer" because it may be that we were  ALL bad programmer when we're just learning.  I know I was.  


But, at the time, I didn't realize I was a bad programmer (this was before the internet).  I would have probably been proud of my work, but that's because I didn't know...what I didn't know (Reminds me of the Oscar Wilde quote, "Youth is wasted on the young.")


Anyway, the question you should be asking is "Am I an experienced enough programmer to provide tutorials?"  Because "bad" and "inexperienced" often could be seen as going hand and hand.


Couldn't have said it better.  Everyone was once a bad programmer.  Even good programmers have room to improve -- you are always learning.  With that being said, BeerNutts is right.  The question is "Am I an experienced enough programmer to provide tutorials."  Even if you can answer that question with a yes, you have to realize that this is the internet, and on the internet, you are going to get critiqued.




Someone could get upset at a hello world app tutorial because an application that only writes out a line of hard coded text is essentially useless, but that is not a reflection on the tutorial's quality.

Very true -- I would just chalk it up to "haters gonna' hate" and move on.


Finally, like a lot of people, I would advise against the "System("pause")" call.  Unless the tutorial is specifically about the Windows, and even then, there are better ways of doing it.

#5032740 C++ game from scratch in 3d with models

Posted by ByteTroll on 15 February 2013 - 12:17 PM

Seeing as everyone above me has already given great answers, I will just reiterate.  You need a solid grasp of your language of choice, the libraries you choose (if you choose any), paradigms, algorithms, etc.


and also atleast give me a source for a begineers to start off

You really need to use Google and do the research for yourself.  Regardless, this should get you started:



This is the complete source code to Id Software's Doom 3 BFG edition. This contains the entire engine and game code, but no assets.  If you are going to take a look at the Doom 3 BFG codebase, you might also find this code review helpful.