Getting Extraterrestres To Work With 2.0 Firmware


deadlychicken22

Man is a reasoning rather than a reasonable animal
Joined
Mar 18, 2004
Messages
1,501
Location
MN, USA
Website
Visit site
I haven't upgraded to firmware 2.0 yet (still on theoddbot's 1.4 w/ the better uboot (can't remember who made it)). However, it has been brought to my attention (by my one and only fan :p ) that my game, Extraterrestres, is no longer playable on firmware 2.0 (I think he/she said it plays too quickly).

I am going on vacation friday and I am looking for the quickest way to simply recompile this or switch a couple lines of code and get it working on firmware 2.0.

I haven't been on here much lately, and my dev environment is using what I'm assuming are outdated files. I'm on the hardware accelerated SDL libs that fixed the sound for firmware 1.4 . . .

So, what do I need to do?

Thanks,
-ben
 
EDIT: unless vsync is a super secret term for my fps controlling timer loop . . .
With VSync you'll wait for the LCD drawing to compleet so your FPS can never get higher then your refresh rate.

If you use a basic loop:

Code:
while(not end)
{
DoGameLogic();
WaitForVSync();
DoDrawScreen();
}
*Pseudolike code

And you're sure the gamelogic and draw functions are always run within 1 frame then the speed should be steady.

Not sure what the refreshrate of the LCD is...
 
Last edited by a moderator:
Well, I don't think I use VSync . . . I control the FPS with a timer (called fps, i believe) and a loop at the end. Basically, it checks the timer to see if it has reached a certain time before it exits the loop and continues onto the next things. It is designed to maintian a fps of (I believe) 60. However, I don't ever check the LCD refresh rates, to my knowledge . . . (I haven't looked at the code for awhile, so I may have missed something when I quickly went over it again)
 
Well, i'm back from vacation . . .

. . . and in those two weeks no one has responded to my problem :(

I sent dzz an e-mail but I think the address I sent it to is one that he rarely checks (the one listed on his website for suggestions . . .)

anyways, please offer any help you can, I'm very busy and need to get some sleep before I can look into this any further.

Thanks,
-ben
 
deadlychicken22 posted on Jul 8 2006 at 02:03 AM said:
Well, i'm back from vacation . . .

. . . and in those two weeks no one has responded to my problem :(

I sent dzz an e-mail but I think the address I sent it to is one that he rarely checks (the one listed on his website for suggestions . . .)

anyways, please offer any help you can, I'm very busy and need to get some sleep before I can look into this any further.

Thanks,
-ben
Somehow I did not receive your email.

Given the nature of the change in the 2.0 firmware, I'd say it almost has to be related to vsync somehow, there's nothing else that would cause this sort of thing. Without seeing your code it's hard to figure out what's wrong with that code.

It should be relatively simple to debug though by playing around with it. I get the impression that you don't have time to debug it. Once you do I bet you'll be able to solve it in a few hours.
 
Last edited by a moderator:
Yes, you're right, Dzz, I don't have much time. I was hoping there was some 5-minute "cure-all" SDL library upgrade that would fix the problems without me having to look into it (looking into things always amounts to about a whole day of work).

EDIT:
Code:
//The timer class

class Timer

{

	private:

	//The clock time when the timer started

	int startTicks;

	

	//The ticks stored when the timer was paused

	int pausedTicks;

	

	//The timer status

	bool paused;

	bool started;

	

	public:

	//Initializes variables

	Timer();

	

	//The various clock actions

	void start();

	void stop();

	void pause();

	void unpause();

	

	//Get the number of ticks since the timer started

	//Or gets the number of ticks when the timer was paused

	int get_ticks();

	

	//Checks the status of the timer

	bool is_started();

	bool is_paused();	

};



Timer::Timer()

{

	//Initialize the variables

	startTicks = 0;

	pausedTicks = 0;

	paused = false;

	started = false;	

}



void Timer::start()

{

	//Start the timer

	started = true;

	

	//Unpause the timer

	paused = false;

	

	//Get the current clock time

	startTicks = SDL_GetTicks();	

}



void Timer::stop()

{

	//Stop the timer

	started = false;

	

	//Unpause the timer

	paused = false;	

}



void Timer::pause()

{

	//If the timer is running and isn't already paused

	if( ( started == true ) && ( paused == false ) )

	{

		//Pause the timer

		paused = true;

	

		//Calculate the paused ticks

		pausedTicks = SDL_GetTicks() - startTicks;

	}

}



void Timer::unpause()

{

	//If the timer is paused

	if( paused == true )

	{

		//Unpause the timer

		paused = false;

	

		//Reset the starting ticks

		startTicks = SDL_GetTicks() - pausedTicks;

		

		//Reset the paused ticks

		pausedTicks = 0;

	}

}



int Timer::get_ticks()

{

	//If the timer is running

	if( started == true )

	{

		//If the timer is paused

		if( paused == true )

		{

			//Return the number of ticks when the the timer was paused

			return pausedTicks;

		}

		else

		{

			//Return the current time minus the start time

			return SDL_GetTicks() - startTicks;

		}	

	}

	

	//If the timer isn't running return 0

	return 0;	

}



bool Timer::is_started()

{

	return started;	

}



bool Timer::is_paused()

{

	return paused;	

}
Code:
	 //start fps timer for fps limiting

	 Timer fps;
Code:
	  //----------FPS LIMITER---------

	  while(fps.get_ticks() < 1000/FRAMES_PER_SECOND)

	   {

		//wait....

	   }

	  

	  }

I may have missed something, I just quickly searched for fps and timer in my code and this is what I found, i'll try to give this a more thorough look tomorrow
 
i will say that given that i program alittle for my laptop, i say that this part :
Code:
 //----------FPS LIMITER---------

	  while(fps.get_ticks() < 1000/FRAMES_PER_SECOND)

	   {

		//wait....

	   }

	  

	  }

" while(fps.get_ticks() < 1000/FRAMES_PER_SECOND) "


1000/Frames per second o_0
that will in my apinion that game tries to play with 1000 frames per second, or as fast as the hardware allow it, or maybe software limitations, remember i am still new to this and only give my opion, not facs as i yet am wery knowlegde less on Gp2x programming.
but i could be wrong, as i dont write programs or games for Gp2x yet! and dont have the device ether yet...
 
Ticks are in milliseconds so the code is correct. 1000/FRAMES_PER_SECOND gives you the number of ticks per frame.


What isn't in the code above. Presumably the timer is reset for each frame.
 
ReSSeR posted on Jul 12 2006 at 02:39 PM said:
ohh i see, why aint it stated in the code? its just a standard then?

can it be stated in secs then?

It could have been stated in the code but comments aren't compulsory although the operation is called get_ticks so there's no reason to expect a tick to be one second. If you look in the get_ticks operation, you'll see it uses SDL_GetTicks which returns milliseconds since SDL was initialised, so it is standard for SDL.

You could convert to seconds by dividing ticks by 1000 but because you are displaying many frames a second, you would need to floating point variables, which are more CPU intensive and so slow the game down.
 
Last edited by a moderator:
Is it at all possible that this is what causing the problems? I don't see how, but I don't know what else could be causing the problem . . . I hope to upgrade to the new firmware this afternoon and then test it out myself (so far I've just been going by what others have told me)

Code:
fps.start();
This is called at the beginning of the game loop, so the fps limiter should be working fine
 
Back
Top