Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Sep 2012
Online Last Active Today, 05:07 PM

#5193659 Need a short name to replace a really really long function's name

Posted by ByteTroll on 19 November 2014 - 01:51 PM

Honestly, I am with viper.  Way back in the day, I use to try and shorten C routine names, but over the years, I have found that long function names are not bad.  I have found that when you try and shorten names you end up cutting corners.  For me at least, well named functions (no matter how long) make old code a lot clearer to read and easier to debug.

#5190027 Game Development with Delphi: "Yes or No?"

Posted by ByteTroll on 29 October 2014 - 03:34 PM

I think the key think mentioned by the OP is "you are greatly skilled in Delphi."


If you are familiar with Delphi and it is your cup of tea, I see no reason why it isn't okay to write games in it.  I wouldn't do it, but it follows the same principal as "should I write games in Objective-C?"  I wouldn't do it, nor would I recommend it, but it is possible and people do it.


Go with what you are familiar and comfortable with.

#5185607 I do not understand the code (Hashtable)

Posted by ByteTroll on 07 October 2014 - 01:57 PM

In a hashtable, a "bucket" is just a fancy name for an index of the array.  They are also commonly known as "slots."  Other than that "AuthenticOwl" nicely sums up how a hashtable works.


EDIT: And as "AuthenticOwl" mentioned, summing the ASCII values of a string is usually not an ideal approach to hashing as there is a high risk of collision.  Also, if you want to understand how the code works, take it line by line.

#5180086 Which basics do you need to know

Posted by ByteTroll on 13 September 2014 - 10:34 AM

As "Eck" said, this is a very vague question.  The vague answer is that you need all of them (hence why they are the basics).  Not only do you need know them, you also need to be comfortable using them.


With this being said, game programming in C++ involves heavy use of classes, functions, control statements, data types, and especially pointers.


EDIT: You "can" get by using certain methods, such as only using "if" and "else," and not using templates, however anything classified as a "basic" is generally used extensively.

#5178420 GOTO, why are you adverse to using it

Posted by ByteTroll on 05 September 2014 - 06:02 PM

Personally, I don't mind the use of "goto" when it fits.  There are very few cases where I can justify using it, but I do use it once in a blue moon.

#5176627 Welcome your new Visual Arts forum moderator

Posted by ByteTroll on 28 August 2014 - 04:31 AM

Congrats brother!

#5170948 Isn't "delete" so pesky to type? Wish there was a better way?

Posted by ByteTroll on 01 August 2014 - 01:54 PM

#define delete d rolleyes.gif

#5168764 What now?

Posted by ByteTroll on 23 July 2014 - 06:27 PM


'Engines' are siren songs to new programmers lured by the idea, but they just lead to you crashing on rocks.


This should be a tee shirt.



I'd buy it.

#5168679 What now?

Posted by ByteTroll on 23 July 2014 - 10:18 AM



You never want to start off writing a "game engine."  A "game engine" is just a bunch of reusable and time-tested code.  Write a game.  When it comes time for a second game, recycle some of the code and improve upon in.  Repeat that cycle.  I have found that if you plan on building a "game engine" from the beginning, you end up wasting more time implementing features just for the sake of features.


OpenGL and DirectX are graphics API's.  They are the bridge between low-level rendering operations/talking to the hardware and you.



To answer one of the questions in your first post: learning to create games in Java is really no different from creating games in other languages.  As someone else noted, languages do different things.  Regardless, there are common "core" principals that drive games.  For example, all games (no matter what language) run in a loop.  This loop usually handles user input, updating, and rendering.  When a game starts up, some initial data is usually loaded to get ready for the game to run.  When a game shuts down, systems are usually released.  Regardless of the language, a loop is a loop.  Loading data is loading data.  Releasing data is releasing data.  How these things are done may change, however, the principals are the same for all languages.

#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