game-loop

Should I always use a Gaming Loop in a Silverlight Game?

最后都变了- 提交于 2019-12-04 22:04:07
问题 I have read about using CompositionTarget.Rendering Timer for the primary gaming loop in silverlight. To be used for hit testing and general game logic as would be done in any language. This said I was wondering is it best to move objects around inside this x pixels at a time (as a game in any other language) or can I utilise silverlight animations better and use such features as easing? The objects I refer to would be in games such as tetris and pong rather than a platform game where the

Some questions regarding game loop, tick and real time programming

混江龙づ霸主 提交于 2019-12-04 14:49:24
First I want to apologize for my approximate English, as I'm French. I'm currently making a real-time game in java, using LWJGL. I have some questions regarding game loops: I'm running the rendering routine in a thread. Is it a good idea? Usually, the rendering routine is fairly slow and should not slow down the world update (tick) routine, which is way more important. So I guess using a thread here seems like a good idea (minus the complications from using a thread). In the world update routine, I'm updating a list of entities with the current time. Each entity can then compute their own

Best way to implement game loop without freezing UI thread

放肆的年华 提交于 2019-12-04 00:38:06
问题 I'm trying to make a simple 2D game in Java. So far I have a JFrame , with a menubar, and a class which extends JPanel and overrides it's paint method. Now, I need to get a game loop going, where I will update the position of images and so on. However, I'm stuck at how best to achieve this. Should I use multi-threading, because surely, if you put an infinite loop on the main thread, the UI (and thus my menu bar) will freeze up? Here's my code so far: import java.awt.Color; import java.awt

Android SurfaceView slows if no touch events occur

情到浓时终转凉″ 提交于 2019-12-03 17:33:26
I am making a game and all is going well except for the game loop. I am using a SurfaceView and drawing 2D Sprites (Bitmaps). Currently the game is a ship moving through an asteroid field. The ship stays in the center of the screen and the phone is tilted in either direction to move the the asteroids (asteroids change location instead of player). New asteroids spawn as old ones fall off the screen creating an infinite asteroid field feeling. Running on my Nexus 5, I noticed that after about 3 seconds, the asteroids moving down the screen became choppy, despite my game loop set to run at 60fps.

Should I always use a Gaming Loop in a Silverlight Game?

老子叫甜甜 提交于 2019-12-03 14:12:22
I have read about using CompositionTarget.Rendering Timer for the primary gaming loop in silverlight. To be used for hit testing and general game logic as would be done in any language. This said I was wondering is it best to move objects around inside this x pixels at a time (as a game in any other language) or can I utilise silverlight animations better and use such features as easing? The objects I refer to would be in games such as tetris and pong rather than a platform game where the user is moving a character around. The other area is sprite animation. For example is a walking animation

Constant game speed independent of variable FPS in OpenGL with GLUT?

孤人 提交于 2019-12-03 08:40:22
问题 I've been reading Koen Witters detailed article about different game loop solutions but I'm having some problems implementing the last one with GLUT, which is the recommended one. After reading a couple of articles, tutorials and code from other people on how to achieve a constant game speed, I think that what I currently have implemented (I'll post the code below) is what Koen Witters called Game Speed dependent on Variable FPS , the second on his article. First, through my searching

Android: Understanding OnDrawFrame, FPS and VSync (OpenGL ES 2.0)

巧了我就是萌 提交于 2019-12-03 06:35:33
For a while now I've experienced an intermittent 'stuttering' of the sprites that are in motion within my Android Game. It's a fiarly simple 2D OpenGL ES 2.0 game. (This is an ongoing problem which I have re-visited many times). In my game loop, I have 2 'timers' - one which will log the number of frames in the previous second, and another which counts the time (in Milliseconds) from the end of the current onDrawFrame iteration to the start of the next. This is what I've found: When not rendering anything, I get 60fps (for the most part), and every time onDrawFrame is called, it reports itself

How to make timer for a game loop?

烈酒焚心 提交于 2019-12-03 05:06:29
I want to time fps count, and set it's limit to 60 and however i've been looking throught some code via google, I completly don't get it. You shouldn't try to limit the fps. The only reason to do so is if you are not using delta time and you expect each frame to be the same length. Even the simplest game cannot guarantee that. You can however take your delta time and slice it into fixed sizes and then hold onto the remainder. Here's some code I wrote recently. It's not thoroughly tested. void GameLoop::Run() { m_Timer.Reset(); while(!m_Finished()) { Time delta = m_Timer.GetDelta(); Time

Lua, game state and game loop

北城以北 提交于 2019-12-03 03:45:30
问题 Call main.lua script at each game loop iteration - is it good or bad design? How does it affect on the performance (relatively)? Maintain game state from a . C++ host-program or b . from Lua scripts or c . from both and synchronise them? (Previous question on the topic: Lua and C++: separation of duties ) (I vote for every answer. The best answer will be accepted.) 回答1: The best thing about lua is that it has a lightweight VM, and after the chunks get precompiled running them in the VM is

Algorithm for Client-Server Games

瘦欲@ 提交于 2019-12-03 01:45:17
问题 For stand alone games, the basic game loop is (source: wikipedia) while( user doesn't exit ) check for user input run AI move enemies resolve collisions draw graphics play sounds end while But what if I develop client-server-like games, like Quake, Ragnarock, Trackmania, etc, What the Loop/Algorithm for client and the server parts of the game? 回答1: It would be something like Client: while( user does not exit ) check for user input send commands to the server receive updates about the game