Reputation
6,058
Top tag
Next privilege 10,000 Rep.
Access moderator tools
Badges
1 15 32
Newest
 Yearling
Impact
~142k people reached

Aug
9
comment How can I implement gravity?
@Fabio: Oh, I see. Any way you implement impulses, you'll want the total velocity change (in the absence of other forces) to equal the impulse. Using my pseudocode above, one way to achieve that is to add J/dt to both force() calls. Another way is to handle impulses separately from continuous forces, e.g. by adding an extra line like velocity += impulse; (and optionally position += (time - inpulseTime) * impulse; where impulseTime is the exact time at which the impulse occurred) to my pseudocode. (Before the second call to force() is probably best, though I haven't tested this.)
Aug
9
comment How can I implement gravity?
@Fabio: Honestly, I'm not entirely sure what you're asking. In my pseudocode, the first parameter to force() isn't the timestep, but the current time (and you're free to leave it out of your own code, if your forces are not (directly) time-dependent).
Jul
26
revised How do I implement a retro-style password-based “savegame” system?
this question is not specific to any particular language
Jun
23
reviewed Approve Creating a separate renderer for entities in a 2D game
May
24
comment How to render infinite universe?
Do you plan on having some kind of a maximum view distance, or do you have some way of merging distant points so that you don't have to render them individually, or are the "points" opaque and arranged so that most of them will be hidden from any given viewpoint? Because if none of the above hold, I don't see any way to prevent the user from finding camera angles from which most of the points (or at least a significant fraction of them) will be visible at the same time.
May
19
comment Trying to implement gun cooldowns in C#
@Zee: If the longer cooldown is meant to simulate reloading a clip, then you might not want to auto-reload until the gun is empty, or unless the player explicitly does an early reload.
May
19
comment Trying to implement gun cooldowns in C#
Why have the if (bulletCounter == 3) check outside the keypress handling code? The only way bulletCounter can become 3 is by getting incremented when a shot is fired, so it IMO makes more sense to check for it right there. (For example if (bulletCounter == 3) { gunCooldown = Time.time + 0.80f; bulletCounter = 0; } else { gunCooldown = Time.time + 0.12f; } or even just gunCooldown = Time.time + (bulletCounter % 3 == 0 ? 0.80f : 0.12f );)
Apr
23
comment Pausing the game inside the game loop
@user3730788: A branch that executes once per game loop (i.e. less than 100 times per second) will have no discernible performance impact, not even if it's mispredicted every time.
Apr
12
answered Strategy game tile and unit storage
Apr
7
comment Framerate is affecting speed of object
@MooingDuck: Well spotted. I've fixed it now, I think. Thanks!
Apr
7
revised Framerate is affecting speed of object
fix lastTime tracking per comments
Apr
7
awarded  Nice Answer
Apr
7
comment Framerate is affecting speed of object
@MooingDuck: That's a very good point. I've edited my own answer to reflect it. (Usually, you shouldn't be dividing anything by the timestep in a typical game state update, so a zero timestep ought to be safe, but allowing it does add an extra source of potential errors for little or no gain, and thus should be avoided.)
Apr
7
revised Framerate is affecting speed of object
better variable name
Apr
7
comment Framerate is affecting speed of object
@Carpetfizz: updateInterval is just the number of milliseconds you want between game state updates. For, say, 10 updates per second, you'd set updateInterval = (1000 / 10) = 100.
Apr
7
revised Framerate is affecting speed of object
better variable name
Apr
6
answered Framerate is affecting speed of object
Mar
29
awarded  Revival
Mar
18
awarded  Good Answer
Mar
14
comment How to render a pseudo-3D view like in the game Biosys (1999)?
Well, I was going to answer this, but it looks like the question got closed. Anyway, it looks like they've pre-rendered the scenes and baked them into cube maps, allowing you to look around but not move your viewpoint. They also sort of fake movement by zooming in on the exit when you move between scenes. Incidentally, Google Street View basically uses the same trick (and even has the same zoom transition effect), except that, of course, they use real 360 degree panoramic photos.