Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 31 Dec 2011
Offline Last Active Today, 05:54 PM

#5118498 Beginning Game Programming

Posted by shacktar on 20 December 2013 - 11:33 PM

What all tools are needed?is OpenGL+ C++ enough?


I am currently developing a game (and game engine in tandem) in C++. I too like the feeling of having my own code doing a lot of the heavy lifting. I have chosen to do the rendering and physics code myself and to unload the other tasks to libraries. The following is my current setup. Perhaps this can give you a rough idea of what libraries you may need to use as well.




OpenAL (for audio)

   - Ogg/Vorbis (for loading .ogg files)

GLEW (for grabbing OpenGL extensions/version info)

GLFW (window management and user input)

stb_image (image loading)

RapidXML (XML parsing)

#5101053 "built-in loop" question

Posted by shacktar on 13 October 2013 - 10:24 AM

1. What do you call the default process that automatically loops through the code and updates, whenever the program is ran? You know, the one where the computer tries to look for the Main function and run that, over and over again? Does it have an actual name, or is it fine to just call it a "built-in loop"?


There is no "built-in loop". The Main function/method is run precisely once. If you're thinking of the "Main Game Loop", then that has to be inserted by the programmer.


2. Do all programming languages have a main function/method that the computer will look for and try to run? (I'm thinking it's a necessity, but please correct me if wrong)
Answered by Wikipedia.org


No, not all programming languages require a main function/method. Interpreted languages commonly don't require a Main. e.g. JavaScript, Scheme, Lua


3. Do all programming languages (today) cause the computer to loop infinitely through the code by default, unless you control it to do otherwise?


It's the other way around. Main is run exactly once. An infinite loop would have to programmed (or caused by a bug).

#5100710 OpenAL sound wont work!

Posted by shacktar on 11 October 2013 - 10:34 PM

alGenBuffers(1, &buffer);
alGenSources(1, &source);
These calls should occur after alcMakeContextCurrent
ifile.read(reinterpret_cast(&soundFile), sizeof(fileSize));

Here, you're reading sizeof(fileSize) bytes, which is the size of an unsigned int (4 bytes on my computer). You should be passing fileSize directly as the last parameter.


#5098994 Object Collision Problem

Posted by shacktar on 05 October 2013 - 12:38 PM

A potential solution is to "sweep out" a box (or capsule if the ends are rounded to fit the circle) that describes the motion of the circle over the whole timestep and then to do collision detection with the swept out box (or capsule). The picture below shows a swept out box.





#5041080 Undetectable bugs.... yay -_-

Posted by shacktar on 08 March 2013 - 10:46 PM

Your globals point to locations in memory, however those locations I believe pass out of scope at the end of the function.

That part appears to be fine. Background and Image are set with LoadImage which returns a heap-allocated pointer. SDL_FreeSurface is necessary to free the loaded images (used correctly in Cleanup()).


//load the image
if(LoadFiles == false)
  return 1;

Here, you're not actually calling LoadFiles (the brackets are missing). Instead, this code is checking if the function pointer LoadFiles is false i.e. zero, which it isn't of course as it's a valid function. 

#5031839 How to run a Java jar file without a MS DOS batch file

Posted by shacktar on 13 February 2013 - 09:23 AM


One tool I would recommend for this purpose is Launch4j.

@warnexus It looks like you're targeting Windows, but if you target other platforms you could build one executabe wrapper for each platform.
I once had a problem where I created an executable JAR file that worked by double-clicking on my computer but it didn't work on another computer. It could have been an issue involving a JRE difference. The other advantages of using a tool such as Launch4j is that JRE differences are handled automatically (you either bundle your JRE version or you set a min and max version) and you don't have to worry about the user having to set the Java path.

#4901650 Problem/Question regarding FBOs and Render to Texture

Posted by shacktar on 11 January 2012 - 08:55 AM

In your non-working generate function, you don't set the GL_DEPTH_ATTACHMENT for either of the FBOs. Try setting those and see if that works.

Also, this:
glBindFramebuffer(1, m_frontBuffer);

should be this:
glBindFramebuffer(GL_FRAMEBUFFER, m_frontBuffer);

#4898822 C++ 3D physics on ball.

Posted by shacktar on 01 January 2012 - 07:27 PM

Generally, say you have a gravity vector G, representing its change to an object's velocity in one time unit, and an object with velocity V0 at time zero, then in one time unit the velocity will be V1 = V0 + G, in two time units the velocity will be V2 = V0 + 2G, ... thus at time t the velocity will be Vt = V0 + tG.

e.g. Say that a projectile is launched with velocity (1, 2, 3) and gravity pulls along the vector (0, 0, -1) at 1 unit per time step. After one time unit, the projectile's velocity will be (1, 2, 2). After two time units, the projectile's velocity will be (1, 2, 1), etc. The position of the projectile at each time unit would be its position at the last time unit added to its velocity at the last time unit. This is assuming no wind and the like.