Jump to content

  • Log In with Google      Sign In   
  • Create Account


chondee

Member Since 13 Jan 2012
Offline Last Active Jul 04 2013 08:14 PM
-----

#4930891 Component based >? Inheritance based design

Posted by chondee on 13 April 2012 - 02:14 AM

Thanks for your reply.
I found a pretty nice ppt from GDC showing how the development team transitioned from Inheritance based design (that they used for Hulk: Ultimate Destruction) to component based design (that they used for Prototype), and showing how component based design seems superior.

http://www.gdcvault.com/play/1911/Theory-and-Practice-of-the

It doesn't really go into specifics however.
Does anyone know of a good tutorial or project with some sample code that is built on composition?


#4903921 SDL->SFML conversion; very strange performance issues

Posted by chondee on 18 January 2012 - 03:12 AM

So, I have built the SFML 2.0 libraries, and converted my code for SFML 2.0.
There was quite a huge performance gain, everything looked fine, so I started writing the keyboard input functions.

I am polling for events in the main loop, every frame like this:
  while (App.PollEvent (Event))
  {
   //myWorld.myPlayer.handle_input();
   //if (Event.Type == sf::Event::Closed)
   //{
   // App.Close();
   //}
  }
Even if the loop is empty, like above, the performance drops significantly, the frame rate fluctuates between 20-60.
Am I doing the polling wrong?

EDIT:
SOLVED
I got the answer on SFML forums

Can you try to comment line 121 of src/SFML/Window/WindowImpl.cpp (ProcessJoystickEvents();) and recompile SFML?




#4902770 Implementing "Rewind Time", like in the Prince of Persia - Sands of t...

Posted by chondee on 14 January 2012 - 03:32 PM

Hi,

I am not sure if you guys are familiar with the PoP Sands of time series, I was trying to look for a video on youtube demonstrating this feature, surprisingly I haven't found one, I'll try to describe it however. In these games, you have the ability, to hold down a button, and rewind the last 5-10 seconds of time that has just passed, affecting you, the objects and enemies, and all this is going smoothly in real time. It would be similar as if you are watching a video, then you rewind 5 seconds of it, then go again. Only in the game if you made a mistake, fell off a platform now you have the chance to get another shot at it.

I found this feature improving the game experience a lot, such that after any small mistake you don't die, face a loading screen, have the whole thing interrupted, then start from a checkpoint, but at the same time the usage of this ability was limited, so it didn't make the game too easy either.


I am now thinking of implementing this in my 2d scrolling space shooter engine, but it makes me wonder how am I supposed to do this..
The only way I can imagine it, is that the past 5 seconds from current time, so the past 300frames at 60FPS is "recorded", such that for the player and every object, at every iteration of the game loop "saves" all their important variables, for example x,y position, velocity, current action etc into a corresponding past_x[300], past_y[300], past_velocity[300] etc.. array, and when rewind is flagged, at each game loop iteration, the current x,y, velocity, etc is updated from the past_x, past_y etc.

Now, considering enemies, bullets, particles, that is a lot of information to store, and would take up quite some memory.


Do you guys think this is the way I should try to implement this as I described above, or there is some better/more efficient way that I am overlooking?


PARTNERS