Jump to content

  • Log In with Google      Sign In   
  • Create Account

Spirrwell

Member Since 11 Nov 2011
Offline Last Active May 21 2016 08:51 PM

Posts I've Made

In Topic: SDL and Frame Timing

21 May 2016 - 07:00 AM

Well there's a reason I made my avatar here of Homer Simpson. D'oh.

 

Regardless, I was coming at this wrong. All I should be affecting is the actual rendering, because that's what matters, not how much my game updates, though a fixed update function makes sense.

 

For anybody interested in yet another one of these threads, here ya go, here's the code that made this work:

 

Loop:

while (!m_bQuit)
	{
		while (SDL_PollEvent(&event))
		{
			if ((event.type == SDL_KEYDOWN && event.key.keysym.sym == SDLK_ESCAPE) || event.type == SDL_QUIT)
				Terminate();
		}
		AMBehavior::MasterUpdate();

		if (Time->ShouldRender())
			Renderer->Draw();
    }

Time Code ( No Traveling Allowed (That's a joke) ):

bool TimeMgr::ShouldRender()
{
	if (ticks >= 1.0f / AMEngine->GetMaxFPS())
	{
		ticks -= 1.0f / AMEngine->GetMaxFPS();
		return true;
	}

	return false;
}

void TimeMgr::Update()
{
	elapsedTime = (float)SDL_GetTicks();
	ticks += deltaTime = (elapsedTime - prevElapsedTime) / 1000.0f;

	prevElapsedTime = elapsedTime;
}

Then finally, where I calculate the FPS, in my renderer!:

void RenderingEngine::Update()
{
	frameTicks += Time->deltaTime;
}

void RenderingEngine::Draw()
{
	FPS++;

	if (frameTicks >= 1.0f)
	{
		frameTicks = 0.0f;
		std::cout << "FPS: " << FPS - 1 << std::endl;
		FPS = 0;
	}

...

In Topic: Texture Coordinate Mapping (OBJ)

30 November 2015 - 12:06 PM

Do you have backface culling turned on?  Try it if not.

I do actually.

 

Sanity check, when you load it in your program do you have 24 vertices and 24 texture coordinates?

 

I'm guessing you have less vertices than texture coordinates, in which case you need to weld your vertices. Basically, for each unique vertex + texcoord combination, you need to create a unique vertex (because obj files have separate indices per component, but OpenGL only supports a single array of indices).

 

See I was wondering about that, that seemed weird. So welding vertices huh? I'll have to research that. Thank you so much! That makes perfect sense!


In Topic: Using Physics to Generate Sound

17 October 2015 - 03:40 PM

Oh thank you. But honestly, Googling didn't give much help to me because I didn't know what term would be used to describe it. But physical sound synthesis huh? Thanks for all of the information! I'll go through it now!


In Topic: Is working in terminal/console really a waste of time?

01 June 2014 - 06:03 AM

I started writing programs in the console in C++ as well. Do I feel like it was a waste of time? Not exactly. I think starting with console programs helped me to grasp the fundamentals of programming, but I do wish I had worked with something more graphical.

 

The console helped me learn the basics like if, else, classes, and such. But it took me a LONG time. I couldn't grasp the concept well because there wasn't much there for me to work with. Without my good friend YouTube, I don't think I would have learned. I wish it was explained to me how other stuff works, like in order to start making basic games you should look into OpenGL\DirectX and libraries associated with it.

 

I didn't really begin to grasp everything until I switched to C# for a while messing around with the XNA Game Studio. It was TREMENDOUSLY helpful. Because everything was right there and I could finally see how things worked. Do I think learning how to program in the console is a complete waste of time? Not at all. But if you're looking to go into game programming, it may be more beneficial to start with something else.

 

You have no idea how excited I was when I re-made Pong in C# with XNA. It was an amazing feeling, like something was actually coming together. It was the simplest of games and it was a wonderful start. Then I moved back to C++ with the SDL library and I felt even better. I wish I had started with making a simple Pong clone in the first place.

 

I see a LOT more use for the console now that I've actually learned quite a bit. But starting out with it, I thought the console wasn't all that helpful. I think what actually made me like it was making a simple text adventure game. That was the kind of idea I needed to like the console. Because up until then I couldn't think of much use for it. All I could think was what in the world was it good for? Although now I think the console is pretty amazing. This is my long answer, I wish the poll had a third option.

 

Also, I think it may be important to mention, that I didn't have a teacher, and that may skew my view a bit. YouTube was my teacher. I was learning on my own.


In Topic: Power Up Table Tennis Contest

15 September 2013 - 02:34 AM

One question, when you say the game must be 2D, does this mean that simply the game has to be 2D, or is it mandatory that every aspect of it is 2D like a logo or something?


PARTNERS