Tag Info

Hot answers tagged

3

Going 3D when the game is basically a 2D game seems like an overkill. In your place, i'd rather use a 2D engine that handles already tiles and slopes, and just use a few tricks for the parts where a '3D' effect is required. Just a small example, a bridge : So for the player, that would look like : Now you can add some invisible trigger zones that ...


2

Well, I am not sure what language you use for your game so I'll explain it in C++, but you could use something called 'deltatime' Uint32 last = 0; Uint32 delay = 0; void loop() { Uint32 now = SLD_GetTicks(); if(now > last) { delay = now - last; last = now; } moveUp(delay); } void moveUp(Uint32 delay) { ...


2

Your client never moves you. The server moves you. Think about it this way: A client sends a movement request packet to the server to start moving. The server says sure you can start moving, there's nothing in the way. The server begins moving the player in x direction. The same client ask the server to start moving again. The server says, you're ...


1

I suggest moving the target slowly rather than the angle. Try this: Vector2 Target; // Interp is a value between 0 and 1. When 0, the target never moves. // When 1, the target moves instantaneously. Intermediate values cause the target // to move at different rates. void UpdateTarget(float interp) { Target = interp * Mouse.Position + (1 - interp) * ...


1

I think any linear function would be fine for this. You can keep two variables one for your spaceship's current angle spaceshipAngle = Math.PI*k, and one for the current angle that the user inputs with his cursor cursorAngle = Math.PI*p. And what you do is if (Math.Abs(Math.PI*k, Math.PI*p) < Math.PI) { if (Math.PI*k < Math.PI*p) k += ...


1

Let's say I have three circles. (I'm gonna say circles because if I called them balls, that sentence would sound weird.) What this example is doing is looking if two circles are overlapping. If they overlap, it'll calculate the distance between the two circles, and the required distance based on the radiusses (radii? whatever). It then moves the circles ...


1

Any answer that doesn't link to Glenn Fielder's Fix Your Timestep article isn't an answer at all. So first, read that, because it more than addresses your problem. Note that you do not have to implement his ultimate solution in order to have a reasonably well behaved simulation. Yes, you can use a raw delta time, clamped or otherwise, as other answers have ...


1

This is how I do it in iOS games: // get's called approx every 60th of a second but not always - (void)drawViewLoop { timeThisRound = CFAbsoluteTimeGetCurrent(); deltaTimeThisRound = timeThisRound-lastTime; // don't let the delta get too big. Even if the fps slows way down cap delta at 1/20th of a second if (deltaTimeThisRound > 0.05) { ...



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