Tag Info

Hot answers tagged

3

You shouldn't use equal intervals for game loop. Instead of this use time_delta (current_time - last_update_time). Send time_delta to game object's update method and update position and other parameters depending on time_delta. For example, simple object moving with const velocity will be: function update(time_delta) { position = position + velocity * ...


2

You've inadvertently come across a form of broad-phase collision culling. Specifically, sort and sweep! Why not go all the way and use a QuadTree instead? Quadtrees recursively subdivide the space into quadrants, and only check collisions between entities which occupy the same quadrant. You can speed up your collision detections exponentially this way, with ...


1

To know if its worth it profile the collision loop and see if its faster after your changes. For sorting, a bubble or insertion sort will be faster than a quick sort if you reuse the same mostly-sorted array every frames. Quick sort is only faster if the list is completely random, for mostly-sorted lists you're better off with an improved bubble ...


1

Thanks for the help. I solved my own problem. it seems that a simpler way to put it would have to place the game on another html page and then embed it with an iFrame tag! like <iframe src="game.html" height="550" width="800">game not available</iframe> And the text "game not available" is a displayed text when the iFrame fails no embed the ...


1

It sounds like you are looking at an unusual problem for games: given a bunch of rectangles with connecting edges, lay them out so that no rectangles or edges (I'm guessing) overlap. Usually the layout happens during map generation, which means it's trivial. The general problem, of laying out a planar graph with a set of goals (minimise overlaps, edge ...



Only top voted, non community-wiki answers of a minimum length are eligible