Jump handling and gravity I'm new to game development and am looking for some help on improving my jump handling for a simple side scrolling game I've made. I would like to make the jump last longer if the key is held down for the full length of the jump, otherwise if the key is tapped, make the jump not as long. Currently, how I'm handling the jumping is the following Player.prototype.jump function () Player pressed jump key if (this.isJumping true) Set sprite to jump state this.settings.slice 250 if (this.isFalling true) Player let go of jump key, increase rate of fall this.settings.y this.velocity this.velocity this.settings.gravity 2 else Player is holding down jump key this.settings.y this.velocity this.velocity this.settings.gravity if (this.settings.y gt 240) Player is on the ground this.isJumping false this.isFalling false this.velocity this.settings.maxVelocity this.settings.y 240 I'm setting isJumping on keydown and isFalling on keyup. While it works okay for simple use, I'm looking for a better way handle jumping and gravity. It's a bit buggy if the gravity is increased (which is why I had to put the last y setting in the last if condition in there) on keyup, so I'd like to know a better way to do it. Where are some resources I could look at that would help me better understand how to handle jumping and gravity? What's a better approach to handling this? Like I said, I'm new to game development so I could be doing it completely wrong. Any help would be appreciated.


How do I make sure everyone sees the same distance across different resolutions? Hello game dev community. I have recently got into making games in a browser window, and me and a friend ran into a common problem. Let's say I have a game like diep.io, where users can control their tank and move across a large grid. Each player can only see a certain distance, even if they moved the window to a larger monitor, like from 1080p to a 4K monitor. I've created a game in HTML5 canvas, but the problem is that it depends on the browser's window.innerWidth and innerHeight properties. I can tell that this is an issue, because if I drew a grid, one player on a 1080p monitor could only see x distance but a player on a 4K monitor with a larger width and height could see x 2 distance (or how much larger it actually is), meaning that the player on a 4K monitor has an advantage, by seeing players in a larger distance. How exactly could I tackle this problem? My friend has the same issue, and I hope this answers it.


The rule to scale pixel art non multiple of integer ratios I have pixel art, I want to draw. When player jumping I want to animate the art to squash stretch to have a feeling. But when I scale the art it get's distorted, as demonstrated in the image. In one video I heard a rule to always scale to multiples of 100 ratio. So 150 is not allowed otherwise pixels collapse into each other. I haven't experienced that in this image but is it ok to scale arbitrarily in pixel art? I see they scale the sprite arbitrarily in Celeste Game Player source. But It feels wrong to me.


How to create a random array of Transforms and Instantiate the random item? I'm trying to make a rock that after you break it, it will spawn a random item from the minerals array. How can I pick a random item from the minerals array and then instantiate it? var rockHealth int 50 var rock GameObject var speed int 8 var rb Rigidbody var copper Transform var gold Transform var minerals Transform minerals.push(copper) minerals.push(gold) function DeductPoints(hitpoints int) rockHealth hitpoints function Update() if(rockHealth lt 0) DestroyRock() function DestroyRock() Destroy(rock) var position Vector3 Vector3(Random.Range( 1.0, 1.0), 0, Random.Range( 1.0,1.0)) Instantiate("random mineral would go here", rock.transform.position Vector3(0,0,0) position, Quaternion.identity)


js canvas tiled map for loop, while, or matrix I am making a top down view tiled map in canvas, where player is always in the middle of the screen, and map scrolls depending on where you go, like in moba games. I also want it to loop infinitely in every direction. That means that when I cross the top border of the map I should end up at the bottom of the map, when I cross the left side of the map I should end up on the right side, etc. At the same time I only want the part visible on screen to be rendered. Normaly I would just use for loop, but in cases when I am at the border, or corner of a map, and I need to display the same map, but the other end of it, it gets complicated with lots of nested loops. I could make the map as math.matrix, and do multiple operations to fragment it and arrange so that it represents only the part visible on screen, like so So when I am at one of bottom tiles for example and I am at the center of the screen, I will need to fill the bottom with top tiles, and since the map is bigger than what is displayed on screen I would need to also extract only part of it to render. But that would require a few math functions each draw, and I wonder if it is ok to do it. It is hard to explain, especially in a language that is not my native, but I hope that someone will help me. What is the right way to do it?


Uncaught TypeError Cannot read property 'Mesh' of undefined I would like to use dragonBones with pixi.js. I got a problem. When the following line executes in dragonBones, I am getting an error slot.init(slotData, displays, new PIXI.Sprite(), new PIXI.mesh.Mesh(null, null, null, null, PIXI.mesh.Mesh.DRAW MODES.TRIANGLES)) The error says Uncaught TypeError Cannot read property 'Mesh' of undefined.. And yeah, while debugging, I noticed that PIXI.mesh is really undefined. What can I undertake against the error? I am using this file for a dragonbones. May it be that the problem is in the fact that I am using pixi.js v4.5.6?


How can I increase framerate, when drawing tiles to a HTML canvas? I am using the HTML 5 canvas to make a simple platformer game. I am currently drawing the tiles using a for loop that runs through a list of tiles and checks if they will be drawn to the screen. for (var i 0 i lt tiles.length i ) if (tiles i .x scale gt pos.x (canvas.width 2) amp amp tiles i .x lt (pos.x scale) (canvas.width)) canvas.drawImage(tiles i .x pos.x, tiles i .y pos.y, scale, scale, "img Tiles " tiles i .Tile ".png") I am also using this custom library to draw the image to the screen this.drawImage function(x, y, width, height, src, alpha) if (alpha) ctx.globalAlpha alpha if (document.getElementById(src) undefined) document.head.innerHTML ' lt img width "16px" height "16px" src ' src ' id ' src ' gt lt img gt ' var img document.getElementById(src) ctx.drawImage(img, x, y, width, height) ctx.globalAlpha 1.0 document.getElementById(src).outerHTML "" When I run the for loop, the frame rate of the game seems to drop. Is there an alternate option to going through every element of the array that I'm not aware of?


How do I make my character jump on a platform? This is the code I've written so far Html lt div id "stage" gt lt div id "splash" class "screen" gt lt h2 gt Land lt h2 gt lt button id "howtobutton" gt Instructions lt button gt lt button id "hsbutton" gt High Score lt button gt lt button id "optionsbutton" gt Options lt button gt lt button id "playbutton" gt Play Game lt button gt lt div gt lt div id "instructions" class "screen" gt lt h2 gt How to Play lt h2 gt lt button class "backtomenu" gt Back to Menu lt button gt lt div gt lt div id "highscores" class "screen" gt lt h2 gt High Scores lt h2 gt (Username), your high score is lt button class "backtomenu" gt Back to Menu lt button gt lt div gt lt div id "options" class "screen" gt lt h2 gt Options lt h2 gt lt button class "backtomenu" gt Back to Menu lt button gt lt div gt lt div id "game" class "screen" gt lt div id "ground" class "platform" gt lt div gt lt div id "score" gt Score lt div gt lt div id "player" gt lt div gt lt button id "btn quit" class "backtomenu" gt Back lt button gt lt div gt CSS div border 1px solid black h2 text align center button display block width 100px margin 10px auto stage width 400px height 400px overflow hidden position relative background image url(http www.hlgjyl888.com data wallpapers 151 WDF 1917288.gif) background size cover splash display block .screen position relative display none width 100 height 100 color white player width 30px height 30px border radius 50 position absolute background color blue bottom 50px top 269px left 100px score position relative top 0px right 5px width 100px btn quit position absolute margin 0 bottom 0px left 0px .platform position absolute background color white .onPlatform background color blue ground top 300px width 400px height 3px JavaScript var gravity 1 var maxheight var timer var jump 32 var velocity 0 var jumppressed false var username prompt("What is your name?") (document).ready(function() (' howtobutton').click(function() showScreen(' instructions') ) (' hsbutton').click(function() showScreen(' highscores') ) (' playbutton').click(function() showScreen(' game') ) (' optionsbutton').click(function() showScreen(' options') ) ('.backtomenu').click(function() showScreen(' splash') ) maxheight Math.round( (" stage").height() (" player").height()) timer setInterval(update, 1000 60) (document).keypress(function(e) console.log(e.which) if (e.which 32) console.log("it works") jump() ) ) function showScreen(screen) ('.screen').hide() (screen).show() function jump() if ( (" player").position().top gt maxheight) console.log("Jump is working") velocity 15 function update() if (velocity 0 amp amp (" player").position().top maxheight) else if (velocity gt 0 amp amp (" player").position().top gt maxheight) console.log(maxheight " through ground" (" player").position().top) (" player").css("top", maxheight "px") velocity 0 else velocity gravity var newPos (" player").position().top velocity "px" (" player").css("top", newPos) However I'm very new to game development, I've been stumped for a while now, I can't figure out a way to control my character movement. Can anyone tell me what's wrong with my code? My character should be jumping on the platform whenever the space key is pressed (that's it).


Easy way to do gravity in a simple game? I'm looking for an easy, beginner friendly way to do gravity in a platformer. I've looked into Box2D tutorials, but they all seem very complicated. All I want is a class that takes into account if my player is grounded, or airborn, and a nice little curve as he jumps. I know this shouldn't be more than a few lines of code, and learning a library seems excessive. Anyone mind helping me out?


Buffer System For Items I am going to reference this image of what I want to accomplish in JavaScript. This is the Diablo buffer system. This question may be a bit advanced (or possibly not even allowed). But I was wondering how you might go about implementing this type of system in a JavaScript game. Currently to implement such a system in JavaScript escapes me, and I am turning to SO to get some suggestions, ideas, and hopefully some insight in how I could accomplish this without being to costly on the CPU. Some thoughts of mine for implementing such a system would be to Create DIVS within a DIV that hold each position of the inventory Go through each item you own in a container and see which DIV it belongs to Make said item images the DIVs image This type of system might possibly work if ALL items were 1x1, but for this example its not going to work out. I am at a complete lost of ideas how to even accomplish this. Although, maybe rendering directly to the canvas and checking mouse cords could work, there would more than likely be A HUGE annoyance when checking if other items are overlapping each other (meaning you cant place the item down, and possibly switching item with the cursor item ). That said, what am I left with? Do I need to makeshift my own hack system with messy code, or is there some source out there (that I don't know about) that has replicated this type of system in their own game. I would be very grateful to get some replies on how you might go about doing this, and will accept answers that can logically explain how you might implement such a system (code is not required). P.S. Id like to use pure JavaScript, and nothing else (even though it might be "reinventing the wheel", I also like to learn).


How to change the start position of my 2D game I am trying to create a game where you have to move a ball on a platform. At the start of the game, the ball is dropped on the platform and then you can move it around. This is al working, no problems here. To keep the overview, the ball is centered in the middle of a div. When you move the ball you actually move the platform (giving the illusion the ball moves). This function should stay as it is. The platform is build in javascript as follows var levels 1,1,1,1,1 , 1,1,1,1,1 , 1,2,1,1,1 Where 1 green tile, 0 no tile and 2 is a yellow tile. When loading the level it will generate the first tile (in this case the first 1) in the center of the div, then the next one and the next, etc. Al good so far, but if I change the first 1 tile to a 0 tile ( no tile), it will generate the platform, but since the platform is created in the middle of the div and since 0 is no tile, no tile will be generated and the ball will fall endlessly. This is no good, I want to have different platforms and not always start with a 1 tile at this position. So I figured to make a "start tile". This is the yellow 2 tile. The idea is that this tile is the tile that always should be shown in the middle of the div at the start of a game, so that the ball always drops on the yellow tile. Therefore the whole platform should be moved at game start load in order to center the yellow tile. And this is my problem. How to do this? I hope my problem is clear. I've also made a fiddle (click the 1 to start the game), so you can try things out Many thanks ps so in short Ball always drops in middle (must stay this way) Yellow "start tile" should be moved centered in the div, so the ball drops on it at game start pps The yellow tile can have a different position, it depends on the platform design


How do I implement side scrolling in a javascript platformer? I'm building a side scrolling platformer with Javascript and the canvas element for a school project. I have the character all sorted out. He runs left and right, and has a different sprite set for standing still. The game has gravity, and I can jump. Now what I can't get my head around is how to implement side scrolling. The game world will be tile based. Each tile will be 20x20 pixels. When the character gets to the edge of the screen, it should scroll with the character to explore the level further. Can anyone point me in the right direction to a resource that explains how to programmatically do this? Language specific to Javascript would be good, but anything would be a help.


How to handle shoot instructions, in a multiplayer TD I'm currently working on a Multiplayer Tower Defense game, using ImpactJS amp Node. I seek some clarification about how to handle projectiles from towers, let me explain. So the server is running the master game, and the clients just follow the instruction from the server. Lets say there is about 20 towers on the stage, all needs instructions for which creeps to shoot at. Now lets say each towers fires twice in a second, that's 40 shots each second, (worst case scenario) which is 40 request per second to each client, would't this casue alot of stress to the server, saying that we have 50 games running the same time. So what i am really asking, is this method inefficient, and is there a smarter way to handle all these instructions. Thank you.


How to get the center of a rotated rectangle regardless of point of rotation I need help working out the centre coordinate of a rotated rectangle regardless of the point of rotation (i.e. the rectangle doesn't rotate around its center). I do not know the coordinates of the corners, so it's not a simple case of dividing those. It's easier to show than tell, so here's example 1 http gametest.mobi rotate index.php?f point1.js amp d tests Click to start stop the rotation. In this example I've got my sprite with the rotation point set to the bottom right corner of it. If you click you'll see it rotate around that. I need to find a way to work out the coordinates of the center of the rectangle (represented by the middle red cross hairs.) Here is another example, this one is set to rotate at 0.3 x 0.8 into the rectangle http gametest.mobi rotate index.php?f point3.js amp d tests You can see I added the circle into each demo, this is positioned on the sprites x y coordinate and the radius was calculated from the distance of the center of the rectangle to the rotation origin. I can visually see the correlation between the point of rotation and the circle, and I can see it tracks the centre of the rectangle beautifully on the circles perimeter! But I'm falling at the last hurdle in trying to calculate the actual value, so desperately need a fresh set of eyes on it please.


Multilayer game HTML5 canvas I've have a problem with HTML5 canvas and using multiple layers. I'm using 3 layers. The first layer is where the player and the collision base objects are. And the second and the third layer have the rest of that objects, and that are suppose to cover the character if is behind them. But I have this problem The tile in the upper layer than the character cover him, even if he is in front of that object. And I have other problem When is a the back of the element, there's a part of the character that appears in the middle of the poster. How can I resolve this? I don't know how exactly do this, and I think that use layers is not very convenient. Here's how I render the map function drawMap () for (var rowCtr 0 rowCtr lt map.tileMap 0 .length rowCtr ) for (var colCtr 0 colCtr lt map.tileMap 0 0 .length colCtr ) var tileId map.tileMap 0 rowCtr colCtr 1 var sourceX Math.floor(tileId 8) 32 var sourceY Math.floor(tileId 8) 32 ctx.drawImage(map.sprite.img, sourceX, sourceY, 32, 32, colCtr 32, rowCtr 32, 32, 32) finn.movement(this.ctx, this.world) if (map.tileMap.length gt 1) for (var capa 1 capa lt map.tileMap.length capa ) for (var rowCtr 0 rowCtr lt map.tileMap 0 .length rowCtr ) for (var colCtr 0 colCtr lt map.tileMap 0 0 .length colCtr ) var tileId map.tileMap capa rowCtr colCtr 1 var sourceX Math.floor(tileId 8) 32 var sourceY Math.floor(tileId 8) 32 ctx.drawImage(map.sprite.img, sourceX, sourceY, 32, 32, colCtr 32, rowCtr 32, 32, 32) And here's an example of the map 0, 0, 0, 0 , 0, 0, 0, 0 , 0, 0, 0, 0 , 0, 1, 1, 0 , 0, 0, 0, 0 , 0, 1, 1, 0 , 0, 1, 1, 0 , 0, 0, 0, 0 That's the array of the layers. The first is the first layer, where the character moves, and the second element is the layer where the part of the objects which cover are drew. Is there any solution for this without using any external Engine, only using canvas and javascript? Thanks advance!


Optimizing isometric drawing function I need help optimizing my Draw() function to draw only what is visible in the viewport. Currently I'm drawing the whole Map array in a diamond shape. How can I make my function store only what is visible? Here is an image explaining it better Black tiles are X axis, White tiles Y axis. Green tiles are what I would like the function to store, and the Orange rectangle is the viewport. I'll include the relevant part of my code aswell for(i 0 i lt Map.length i ) for (j 0 j lt Map i .length j ) tileX (i j) (tile.width 2) tileX (canvas.width 2 ) (tile.width 2) tileY (i j) (tile.height 2) tileY (canvas.height 2 ) c.drawImage(tile, tileX, tileY) I've been trying to figure out how to solve this, but since I'm no genius I can't. Help appreciated.


How to use setInterval and clearInterval I have a game that I am making and cannot seem to get the setInterval and clearInterval methods to work. When I debug it in the browser console it shows that the method is still being called over and over again. I am wondering how can I get it to actually stop and then restart afterwards without going faster than it was before (which often happens with setInterval and clearInterval). Notice that when it goes back to the menu, and you click Start again that the timer is running multiple times on the money. Any help is much appreciated, please take a look at this fiddle demo http jsfiddle.net Xn4qT


Glenn Fiedler's fixed timestep with fake threads I've implemented Glenn Fiedler's Fix Your Timestep! quite a few times in single threaded games. Now I'm facing a different situation I'm trying to do this in JavaScript. I know JS is single threaded, but I plan on using requestAnimationFrame for the rendering part. This leaves me with two independent fake threads simulation and rendering. Timing in these threads is independent too dt for simulation and render is not the same. If I'm not mistaken, simulation should be up to Fiedler's while loop end. After the while loop, accumulator lt dt so I'm left with some unspent time (accumulator) in the simulation thread. The problem comes in the draw interpolation phase const double alpha accumulator dt State state currentState alpha previousState ( 1.0 alpha ) render( state ) In my render callback, I have the current timestamp to which I can subtract the last simulated in physics timestamp to have a dt for the current frame. Should I just forget about this dt and draw using the physics thread's accumulator? It seems weird, since, well, I want to interpolate for the unspent time between simulation and render too, right? Of course, I want simulation and rendering to be completely independent, but I can't get around the fact that in Glenn's implementation the renderer produces time and the simulation consumes it in discrete dt sized chunks. A similar question was asked in Semi Fixed timestep ported to javascript but the question doesn't really get to the point, and answers there point to removing physics from the render thread (which is what I'm trying to do) or just keeping physics in the render callback too (which is what I'm trying to avoid.)


How to use arrow keys to navigate between cells in a crossword puzzle I am making a crossword puzzle, using a canvas. How do you get the keyboard arrows to interact with the screen so that when the user presses any of the arrow keys, the cursor will advance to the next available input block. This is how I drew the blocks on the canvas, with css styles added, button 1 and button 2 The "names001" stands for each box in the puzzle, then each box is assigned a letter value var r event.keyCode if (r 13 amp amp m003 "c") w003 1 document.getElementById("names003").value "c" then a variable checks to see if each word is right and places a checkmark beside clue var check001 w010 w011 w012 w013 w014 if (check001 5) clue001.innerHTML " " Now, I want to know when the puzzle is drawn to the canvas, how do you get the keyboard arrows to interact with the canvas when the user presses one of the arrows(up, down, left, right and also the backspace to clear entry when guess is wrong I want to move the cursor to advance to the next block.


Colouring greyscale images sprites for HTML canvas What is the best method to colour in sprites at runtime using the canvas element and javascript? I know there are various blending modes using globalCompositeOperation, but I don't know how best to utilise this. I'll break my question down into the following Is there an optimum way to export greyscale images so they can be easily re coloured later? (At the moment, the images are created with colour in Photoshop or a similar package and then turned into a greyscale and exported from there before I even touch them) With these greyscale images in place, what method makes colouring them with any colour possible? (They must retain the shading etc) I've tagged this with HTML5 and Javascript, but any advise from other platforms would be helpful. Edit Here's an example greyscale output of the image on the left. I want to be able to restore it to the same colour, but also be able to blend it with other colours for different shades of skin.


Phaser HTML5 Trying to add five instances to a group and display on the screen! just started using Phaser today after seeing Thomas Palef's lessmilk series. I completed PhotonStorm's "Make your first Phaser game" tutorial, and grabbed the skeleton, some CSS, and started to throw together a game. It's pretty barebones right now, but this is what I have. The issue is that the game doesn't display the additional "orc" units I've requested. I used a for loop to throw five orcs around the map within the specified borders (32 pixels from the outside boundary. I even wrote a check for the x and y of each in the Update() function, but they don't appear at all. I don't know how to move on from where I am, and I'm not sure that any of what I've written has been written the right way, you know what I'm saying? Thanks. http pastebin.com if2VTq7j


Javascript game to Phonegap for android game? me and a friend of mine are in the process of building a javascrip HTML5 game and I'm running into a few questions about the process of using converting it to an android game. I plan on using Phone gap as it appears to be fairly simple and does what I'm looking for it to do. I've done a little research, but there is still a few questions I have about the whole process. Can I run the app offline? I want to be able to post the app to app store and allow people to download and play offline. Given the fact there will be no server requests can I make the game function offline? As I make the game for the computer I'm relying on the keyboard as input to move around. Obviously, once I port it to mobile this won't be practical. What is the easiest way to go about doing this? I'm considering simply changing the game to have a click on screen which moves the character to that location or even a simple movement pad in the corner of the screen. Would these on screen clicks change correctly over to mobile. Lastly, what is the easiest way to handle save data. On the computer side I plan to use HTML5 local storage to store game data. Does this convert to mobile or is there a better way? I appreciate any help in this matter.


Object have the same "speed" all time JavaScript I try to create a 2D game with a big map and multiple objects. The player is always in the middle of the screen and all the other objects is moving around so it feels like a big map. I want the player to always move after the mouse location. I have modified the mouse location to (0,0) by this var mouseX 0 var mouseY 0 if (e.pageX lt window.innerWidth 2) mouseX (window.innerWidth 2 e.pageX) else mouseX e.pageX window.innerWidth 2 if (e.pageY lt window.innerHeight 2) mouseY (window.innerHeight 2 e.pageY) else mouseY e.pageY window.innerHeight 2 That is working just fine. When it comes to the moving part i can't relly get it to move with the same "speed". I have made some animations to explain how it is now and how i want it to be. How it is now DC is the speed that my player would go and as you can see it is moving the most when its closest to x 0 and y 0, i have done it like this so far var all mouseX mouseY clientsID key 'x' mouseX all speed clientsID key 'y' mouseY all speed But as i know it is not working well. Here is a animation to show how i want it to be DA would be the speed and it's always 1 because it's radius of the circle. But as i don't know how far the mouse is from the center (mouse is E on the last animation) i have to scale it down somehow. Does anyone know how to get how much i have to add x and y so the speed always will be the same? Thank you EDIT See the solution under here


Fixed Time Step Flutter I've seen a lot of questions about this problem, but really no solution. Hopefully I can explain the issue well enough that I can get some sort of closure on this problem. I'm using a Fixed Time Step based on the code found here GAFFER ON GAMES Fix Your Timestep! , and with that method I'm using an accumulator value to compensate for any slowdowns or speedups in the frame rate. Typically the time between frames is between 15.5 and 17.5 ms (with the fixed rate aiming for 1000 60 fps). What ends up happening is this That green chart is showing the accumulator. Which freaks out once the accumulator gets beyond 1000 60 fps. At this point you can see that because of the variance between refresh rates (15.5 17.5) sometimes the accumulator is above or below the threshold of 16.66666666... until it eventually gets to a point that the accumulator is too big to be negated by the next frame variance. If I simply ignore the refresh rate and assume a constant 60fps the flutter never occurs, so its shouldn't be a vsync issue (right?), it's not the GC kicking in. It's an issue with this part of the code accumulator frameTime while ( accumulator gt dt ) update logic() accumulator dt I realize the issue is when the accumulator hits 0 it actually starts doing double updates and skipping updates for a while causing the flutter stutter look. It's very possible that I'm just not understanding how the accumulator is suppose to work, or perhaps the variance in screen refreshing is too much for this to work well. Thanks in advance! Update Here is a screen cap of an output log showing how the variance in frameTime is causing the update call to double up and skip. The items in red are when the accumulator never gets to 16.66666666... For the time being I'm 'fixing' the issue by never letting the accumulator to get below the frameTime variance, but this doesn't feel like a real answer, just a patch. if(accumulator lt 1) accumulator 1.5 Perhaps this bit will help explain. If you start the accumulator at 0 and the first frame takes 15.89999ms, we don't update anything, and then if the next frame is 17.55555ms we now have ( 33.44ms) so it updates twice. The more the variance in the frameTime the worse the problem. I've noticed plenty of people with this issue, and typically the conversation ends with no posted solution, it either "goes away" or the thread dies.


Why does my value increase a ton when the tab switches from inactive to active? I basically have a lerp function similar to this one Client interpolation for 100 serverside game when a new server update is received, the update frequency is added to a variable (msAhead) and the delta is subtracted from it every client frame. But when I do it the variable msAhead increases a lot when the tab is switches from inactive to active. Here is my code msAhead updateFrequency when new update is received. (function loop(now) var now Date.now() delta now Time Time now msAhead delta console.log(msAhead) requestAnimationFrame(loop) )(0) How can I fix my issue?


Realtime Multiplayer How to handle user updates coming in different times I have a game loop that sends new positions of every player to other players. But there is no guarantee that the users will send the server their new positions at the same time. Actually if their connection is slow or some errors happen inbetween, then the data of the clients will flow to the server in a very varying way for every other user. My question is, how should I handle so varying data on the server, and decide who should win in a fast paced multiplayer game. Is the key, timestamp of the requests (seems like it is widely open to cheating), or just the clients sending me directions where they go, and their actions like pressing a button etc? I've read lots of articles on the web, but none of them seems to completely cover the subject. PS I just want to decide on the server side, what should be the next 'frame' in the game by applying the game scenario to the user inputs.


Completely Pixelated Font in JavaScript Canvas? I'm making a game with a canvas scaled up such that each pixel is pretty big. I want to display some pixelated text without anti aliasing but I have idea how I would accomplish this. Is there I way can do such a thing?


timezone independant Date.now() for node.js game I have a game I'm working on using node.js and socket.io. The issue I'm having, is I'm trying to have it so that players execute whatever actions they inputed about 50ms in the future, giving everyone a chance to stay relatively in sync. I've got frame independant code running, which works well until a client has a different time than the server. to predict when the client should act out movement code from the server, I use Date.now() gt command.timeStamp The issue I'm having is that the client isn't in the same timezone as the server, for instance someone I'm testing with is just one minute above below my server time, resulting in commands being 900 milliseconds in the past or future, which is non ideal. Is there some way I can use a common timestamp across clients and server?


How to zoom in and out the full tilemap from center in phaser? I am developing a game where I need to zoom in entire map also I can be able zoom out. I have created a tilemap using tiled software and rendered it using phaser.js. How can I add this function to my game?


Peer to Peer world download I am creating a multiplayer JavaScript game with a PHP central server. Each user will be able to move around in a 3D world, with other users and NPCs. It came to my attention that SQL is not going to handle all the requests being made in a reasonable time. So I cut down on SQL requests being made as often, using RAM when I can, but each user that logs into my world, or switches worlds requires a lot of data to be filtered from the server (So the client does not get any information it should not have, and so I don't have to distribute the entire world for every logon) and then uploaded to the client. So I had an idea What if I can get the World data from the users near to the player(In the 3D world), like a BitTorrent? How to resolve syncing issues? What are my options to prevent Hacking? My ideas were check with more than one user, get a hash from a server(will probably have syncing problems), have bots who request worlds from clients then checks with server to see if they are being honest, how ever they all seem to have their problems, and am not sure which one(s) I should incorporate, or if there is a better way I could get correct world data from peers, with minimal server interaction. Note Peer to Peer is only used to get the world, block world updates are still handled between the server and each client


Is this a reasonable method of detecting JS memory hacks? I'm working on a single player browser based RPG in my free time. I do allow for saving the user's game on the server, but the game is largely going to run locally and I therefore acknowledge that it is impossible to outright prevent a user from cheating in a myriad of ways. I'm just looking at the idea of a "dookie" achievement for editing the game data, and was wondering if this solution is in any way viable? if (Reflect.set.toString() ! 'function set() native code ') throw new TypeError('Missing native Reflect.set') if (Error.constructor.toString() ! 'function Function() native code ') throw new TypeError('Missing native Error constructor') if (Proxy.constructor.toString() ! 'function Function() native code ') throw new TypeError('Missing native Proxy constructor') function setTrap(target, 1, 2, receiver) const res Reflect.set(...arguments) const stack new Error().stack.split(' n') if (stack.length gt 2 amp amp stack 1 .indexOf(' lt anonymous gt ') gt 0) Reflect.set(target, 'cheated', true, receiver) return res const myData new Proxy( data1 valueA, data2 valueB, data3 valueC, ... , set setTrap ) If the user edits myData in the browser console, their changes will remain, but myData will also get cheated true after whatever change they make. Assuming setTrap is defined in a local scope, circumventing this would require editing the actual code loaded by the browser rather than simply editing a value in the console, and minified amp packed JS would make that a more frustrating task than most would bother with, I think. This would let someone who derives enjoyment from cheating do so without additional difficulties on their part, while letting me offer them a mild rebuke with a dookie achievement for cheating. Of course, a determined cheater could prevent the game from sending the cheating marker to the server when saving the game. Even trying to alert the server from within the setTrap function could be easily defeated by simply cutting off the web connection while cheating, but this idea is more of a wagging finger than an attempt at preventing any cheating from occurring. But my question is this have I missed anything obvious with this idea? Is there a better way to write my conditional (I admit, I came up with it after just a few minutes messing around in Chrome, so it may not work the same in Firefox or something)?


2D moving objects in angle Im making simple 2D space shooter with use of html5 and JavaScript. The idea is simple, shoot down as many aliens as you can. I made it to the point where I have player which can move and rotate, but I want the player to move in the angle, like 80s Asteroids (you set angle then press forward key and ship goes forward in that angle) my movement now is simple up y speed delta time down y speed delta time left x speed delta time right x speed delta time my rotation is made like this ctx.save() ctx.translate(this.x this.w 2, this.y this.h 2) ctx.rotate(this.angle) Draw.Rect(ctx,this.w 2 ( 1),this.h 2 ( 1),this.w,this.h, quot red quot ,1) context,x,y,w,h,color,opacity ctx.restore() angle if(keys.e)this.angle 0.1 if(keys.q)this.angle 0.1


HTML5 clicking objects in canvas I have a function in my JS that gets the user's mouse click on the canvas. Now lets say I have a random shape on my canvas (really its a PNG image which is rectangular) but i don't want to include any alpha space. My issue lies with lets say i click some where and it involves a pixel of one of the images. The first issue is how do you work out the pixel location is an object on the map (and not the grass tiles behind). Secondly if i clicked said image, if each image contains its own unique information how do you process the click to load the correct data. Note I don't use libraries I personally prefer the raw method. Relying on libraries doesn't teach me much I find.


Tile Map Coordinates I am have now this code http jsfiddle.net DK67k 2 In here is 2D tile map and when you click on tile you get coordinates on alert. But for get precises coordinate you need click on top left tile(tiles is 16x16) and if I click on bottom right tile I am get second tile coordinates. Maybe anyone have idea how to fix this?


Variable number of GUI Buttons I have a generic HTML5 Canvas GUI Button class and a Scene class. The Scene class has a method called createButton(), which will create a new Button with onclick parameter and store it in a list of buttons. I call createButton() for all UI buttons when initializing the Scene. Because buttons can appear and disappear very often during rendering, Scene would first deactivate all buttons (temporarily remove their onclick, onmouseover etc property) before each render frame. During rendering, the renderer would then activate the required buttons for that frame. The problem is that part of the UI requires a variable number of buttons, and their onclick, onmouseover etc properties change frequently. An example is a buffs system. The UI will list all buffs as square sprites for the current unit selected, and mousing over each square will bring up a tooltip with some information on the buff. But the number of buffs is variable thus I won't know how many buttons to create at the start. What's the best way to solve this problem? P.S. My game is in Javascript, and I know I can use HTML buttons, but would like to make my game purely Canvas based. Create buttons on the fly during rendering. Thus I will only have buttons when I require them. After the render frame these buttons would be useless and removed. Create a fixed set of buttons that I'm going to assume the number of buffs per unit won't exceed. During each render frame activate the buttons accordingly and set their onmouseover property. Assign a button to each Buff instance. This sounds wrong as the buff button is a part of the GUI which can only have one unit selected. Assigning a button to every single Buff in the game seems to be overkill. Also, I would need to change the button's position every render frame since its order in the unit's list of buffs matter. Any other solutions? I'm actually quite for idea (1) but am worried about the memory time issues of creating a new Button() object every render frame. But this is in Javascript where object creation is oh so common ( mainly) due to automatic garbage collection. What is your take on this? Thanks!


Will setInterval give me Delay? I am setting up a JavaScript Server for my Game. Am I understanding this correctly If I use setInterval to call a function every second, and takes 2 seconds to process. Then I am going to "stack up" requests indefinetly the Client will become more and more out of sync? If I use setTimeout, and specify 1 second. Then the function will run (again, lets say 2 seconds) and then start the timeout. And not stack up requests. Edit I am doing Pathfinding and sending it to the Client. Thank you for all the help people. I think using the Callback is the best option for this.


Limiting Framerate and Input So I have been learning HTML5 canvas recently and ran into a bit of a snag. I created a proof of concept that builds a block based 2d map that you can move a character inside of using arrow keys. This works well because everything is free moving (character moves 1 pixel per frame, so the movement is fluid and looks good). I am trying to fork off of this code to create another concept that forces grid based movement (like in a typical roguelike). I have updated my movement code to move in chunks equal to tile size.. but the issue is that the refresh rate is so fast that it just seems like the character is moving at super speed. Here is a snippet of my code that handles animations function gameLoop() ctx.clearRect(player.x,player.y,PLAYER SIZE,PLAYER SIZE) getInput() ctx.fillStyle ' 000000' player.draw(ctx) window.requestAnimationFrame(gameLoop) Is using requestAnimationFrame() for this sort of movement not a good idea? Is it better to just setInterval() for this sort of thing? I found a article via Google that talks about using variables for time, delta, fps, etc to limit the framerate... but Im not sure I understand how to do that in conjunction with requestAnimationFrame(). Should I somehow hold my gameLoop() from hitting requestAnimationFrame() until some time interval is hit? That seems like it would just be a waste because I would need to force a loop of some kind... doesnt seem too elegant


Randomised Path from A to B for cursor movement simulation I'm trying to simulate the movement of the mousecursor, by creating a path from point A to B that has random variation. The algorithm I'm using at the moment is very basic, and is limited in that it's only really good for creating a path where X and Y distance from the start are the same, forming a square The code looks something like this function calcualtePath(from, to) var pathNodes while (from.x ! to.x from.y ! to.y) var newTransition x from.x, y from.y if (Rand(1, 3) ! 1 amp amp newTransition.x gt to.x) newTransition.x else if (Rand(1, 3) ! 1 amp amp newTransition.x lt to.x) newTransition.x if (Rand(1, 3) ! 1 amp amp newTransition.y gt to.y) newTransition.y else if (Rand(1, 3) ! 1 amp amp newTransition.y lt to.y) newTransition.y pathNodes.push(newTransition) from newTransition return pathNodes I'd like some assistance in creating is a relatively fast algorithm that creates a randomised path between point A and B, that has a more curve like path and isn't limited like the one above. Ideally something a bit like this, with a pronounced curve


How do I implement side scrolling in a javascript platformer? I'm building a side scrolling platformer with Javascript and the canvas element for a school project. I have the character all sorted out. He runs left and right, and has a different sprite set for standing still. The game has gravity, and I can jump. Now what I can't get my head around is how to implement side scrolling. The game world will be tile based. Each tile will be 20x20 pixels. When the character gets to the edge of the screen, it should scroll with the character to explore the level further. Can anyone point me in the right direction to a resource that explains how to programmatically do this? Language specific to Javascript would be good, but anything would be a help.


How is JS source protected in Chrome games? I was playing a space arcade shooter https moonbreakers.com and tried to see some of the JS and shader code. However, I was unable to find anything but some server communication code. Game code is thus probably run on servers, but the shaders should at least be local, right? And I have understood that even if the server runs the true game state, clients commonly do some physics interpolation etc by themselves. My only guess is that the game gets the code with jQuery and it doesn't show in the page source. Can that code be looked at via a debugger?


I can't clear the paint image in my Canvas I'm trying to make the Mario move, but somehow it leaves traces behind, can anybody help??? var canvas document.getElementById("screen") var ctx canvas.getContext("2d") var mario var marioSprite var tiles var speedX 1 marioSprite Specification mario target picture specification X amp Y, Width amp Height px 276, py 44, pwidth 16, pheight 16, drawing on Canvas specification X amp Y, Width amp Height cx 16, cy 116, cwidth 16, cheight 16, draw Mario in Canvas function drawMarioSprite() marioSprite new Image() marioSprite.src 'file C Users MASTONO ALI Desktop img characters.gif' marioSprite.addEventListener('load', e gt ctx.drawImage(marioSprite, mario.px, mario.py, mario.pwidth, mario.pheight, mario.cx, mario.cy, mario.cwidth, mario.cheight) ) this.position function() this.mario.cx speedX position() drawMarioSprite() end drawTiles and tilesLoop function drawTiles() tiles new Image() tiles.src 'file C Users MASTONO ALI Desktop img tiles.png' tiles.addEventListener('load', e gt tilesLoop() ) function tilesLoop() for (let x 0 x lt 25 x ) for (let y 11 y lt 13 y ) ctx.drawImage(tiles, 0, 0, 26, 26, x 12, y 12, 20, 20) drawTiles() end function draw() drawMarioSprite() drawTiles() window.requestAnimationFrame(draw) window.requestAnimationFrame(draw) thank you


How to make a snake game where each snake tile follows it's connected tile I want to make a basic snake game. It has a head and a series of tails that occupy a tile in a grid. The first tail in the series is adjacent to the head. and each tail that comes after is adjacent to the previous tail. Head can move in four directions and the first tail moves to head's previous position, and each other tail moves to the previous position of the previous tail, as they follow each other. How can I model this as data, and update it for movement. I've tried this but that's a little doesn't work. p x 0, y 0, tails function init tail(dx,dy) return x 0, y 0, dx dx, dy dy end Initialization add(p.tails, init tail(0,1)) add(p.tails, init tail(0,1)) add(p.tails, init tail(0,1)) local last p for tail in all(p.tails) do local tx last.x tail.dx local ty last.y tail.dy tail.x tx tail.y ty last tail end Movement local last p for tail in all(p.tails) do tail.dx last.dx tail.dy last.dy local tx last.x last.dx tail.dx local ty last.y last.dy tail.dy tail.x tx tail.y ty last tail end This is what I have so far


what function creates rotation effect in three.js? which part of the code is responsible for the rotation in this example? Is it the camera or the scene itself? http threejs.org examples canvas camera orthographic


Making my character jump How do I fix my code? At the moment my character goes up for as long as you hold the up key. I want a more jump like effect where the character will drop back down when it reaches a certain height. I want the character to only be able to jump again once it's fallen back down. Below is my code so far. var canvas document.getElementById("mainCanvas") var context canvas.getContext("2d") var keys var width 500, height 400, speed 4 var score 0 var player x 40, y 350, width 20, height 20, gravity 20, weight 1 window.addEventListener("keydown", function(e) keys e.keyCode true , false) window.addEventListener("keyup", function(e) delete keys e.keyCode , false) function game() update() render() function update() if(keys 38 ) player.y speed if(speed lt player.gravity) player.y player.weight if(player.x lt 0) player.x 0 if(player.y lt 0) player.y 0 if(player.x gt width player.width) player.x width player.width if(player.y gt height player.height) player.y height player.height function render() context.clearRect(0,0,width,height) context.fillStyle "blue" context.fillRect(player.x, player.y, player.width, player.height) setInterval(function() game() , 1000 60)


How to use Cocos2dJS to connect to a Socket.IO server? How can I connect to a nodejs socket.io server from a cocos2djs game? I've google all the way to no avail. I tried this but it does not work socket io.connect('http 192.168.254.102 7714') if ( socket undefined ) cc.log("Could not connect to socket.io") else socket.on('connect', function() socket.emit('join', username 'Android Application' ) ) I read in the docs that there's a module called SocketIO for doing that, but there's not enough info on how to use it. Thanks in advance.


How should I efficiently clear and redraw my canvas with lots of animated sprites? My current solution is to clear the entire canvas and redraw all sprites on every requestFrame(). This works but feels inefficient I only need to clear the part of the canvas made invalid by animations. I only need to redraw objects that intersect the invalid part of the canvas. I can track invalidated sections, and during requestFrame() I can find out which objects intersect an invalid section and redraw only them, but I'm not sure if that's an improvement or a step back. If I have 100 sprites and 10 of them are moving, that means I need to do 10 searches through all 100 sprites. Tall order for every request frame. I can also put every sprite on its own canvas and remove sprite interaction from the equation, but I haven't been able to find insight into how many canvases is too many. This seems like a problem that's been solved already, but I haven't found any resources on the topic.


creating a simulation game, what type of knowledge is needed? I am a beginner in game development. As a part of learning and fun, want to create a game in java script and html5. I am planning a game that we were used to play in childhood, that is "new business" a monopoly game, in that we used to buy ,rent,sell places and bank we get some money to play and etc. are features. Its just simple ludo like game. So can anyone suggest me from where to start? what will be the designing? Is it possible to create it only in a html5 and java script.


Updating bots AI behavior after a fixed elapsed timestamp in game loop? I am developing a HTML5 game in javascript. Now I have created a few bots and they should be able to change their orientation after a few seconds a fixed timestamp in the game loop. Suppose my game loop is like this function loop() bots.updateOrientation() bots.render() player.update() player.render() requestAnimationFrame(loop) How can I make that happen in my game loop?


In regards to real time turn based games, where should the turn handler be? I'm currently developing a pool like browser game. I'm stuck on where should I handle the turn changing, timer, etc. Currently, turn timer (i.e. 15 seconds left to do action, then turn will change) is handled by the server. But the changing of turns itself is handled by the client (the browser itself). Now in my current setup, whenever a player leaves window focus, the game gets out of sync. Should I migrate the turn change handling to the server instead?


Control sprite animation speed using Create JS How can I control the animation speed of a sprite using create JS? When you press right and left, the sprite will run through the frames... I'd like to leave the fps at 60, but alter how fast the frames are looped through without altering the main game FPS rate. See a demo here. Press right and left arrow to see. I thought changing the bmp animation frequency property would do the trick... bmpAnimation.frequency 2 But it did not work... Or should I be using the jQuery animation? Also, I noticed that each time I hit a random key, the animation plays 1 frame then goes back to first frame. Why is that? Thanks!


OOP implementation of BUFFS and Stats. Suggestion I am developing an MMORPG server using NodeJS. I am not sure how to implement Buffs, i mean, equipped objects or used skills have effects on the Player() which has many Stats(), some of them have a max cap... Effects can change the Stat value, increasing or decreasing it by a value, a percentage or completly rewrite the value of the stat. After a while I have decided to create a base class for buffs, which can be hidden (if they are casted from an equipped object) or shown if they came from an ability (Spell). Anyway I need suggestion how to implement it, use an array for all active buffs for a stat and have a function calculate the value of the stat affected by buffs each time I need the value of the stat or...? Other more OOP's ways to do it? I have read this What 39 s a way to implement a flexible buff debuff system? but this implements only a percentage system, which buffs can only say " 10 , 20 , etc...", but I would love to have an hybrid system, which can have percentage values or static values (like WoW does), and using modifiers it's hard to implement, because modifiers refers to the current value of stat Thanks for suggestions )


How do I combine two HTML levels? If I have two levels that I have made separate in HTML5 how may I combine them so one comes after another?.


DOM for GUI display animated objects I'm creating an HTML5 game using Canvas, but want to use DOM for the GUI for the reasons mentioned in there articles http blog.sklambert.com html5 game tutorial game ui canvas vs dom http www.html5gamedevs.com topic 29569 how do you guys build your ui http www.html5gamedevs.com topic 802 gui methodologies That being said, we have a component on the GUI that needs to be animated which will be through a sprite. Is it possible to render sprite animations through a DOM element?


Javascript 2D game tile textures I am using a texture atlas for my tiles. Of course I need to get the sub images to draw them on the canvas as separate tiles. Right now I can think of two ways to implement this. Divide the texture atlas into separate Image instances. Then draw them onto the canvas accordingly. Use a single image, and just draw part of it by adding extra parameters to CanvasRenderingContext2D's method drawImage. I'm not sure which is better. My thoughts were that the first option would be more manageable and flexible, since each tile is separated. What would be better? What are the ups and downs of each?


How do I debug within an animation loop? I'm trying to see some values within an animation loop, and am naively just console.log'ing when I need to, however, this usually results in the browser crashing from all the logs. I'm working in JavaScript, but I don't think this issue is specific to JavaScript. How do people usually debug within an animation loop to see what values are?


Basic Use of ApplyImpulse I am trying to apply a force to a bunch of b2 dynamicBodys, but it seems to only work for a random number of items and then stops with an error. create some items to move bodyDef.type b2Body.b2 dynamicBody for(var i 0 i lt 5 i) fixDef.shape new b2PolygonShape fixDef.shape.SetAsBox(1,1) fixDef.friction 1 fixDef.restitution .1 bodyDef.position.x Math.random() 10 bodyDef.position.y Math.random() 10 bodyDef.linearDamping 1 bodyDef.angularDamping .8 itemsArray.push(world.CreateBody(bodyDef).CreateFixture(fixDef)) store for later then i try to apply a force later with angle 20 for (var xIdx 0 xIdx lt itemArray.length xIdx ) itemsArray xIdx .GetBody().ApplyImpulse(new b2Vec2(50 Math.cos(angle Math.PI 180),50 Math.sin(angle Math.PI 180)) ) the error I receive is TypeError 'undefined' is not an object (evaluating 'c.x') Is there something wrong with saving the items for later use when I am creating them? Does anyone know what is causing this.


Best way to store NPCs, Monsters, Shops, etc for JavaScript game? OK, let's say I have a JavaScript game (preferably on jQuery framework) and its using HTML5 Canvas. What would be your way of storing data to map out shops, monsters, and NPCs? I was thinking maybe JSON txt files on the website? Or maybe simple text files and simple delimiters? I am not sure. How would you store that kind of data?


I keep coming across an error "Cannot read property 'innerHTML' of undefined" I'm new to game designing and have to create a game for my project but I keep coming across an error to do with index.html 93 Uncaught TypeError Cannot read property 'innerHTML' of undefined at drawMissiles (index.html 93) at gameLoop (index.html 140) Any idea how to fix this problem? drawMissiles() function drawMissiles() document.getElementsByTagName('missile') 0 .innerHTML lt (index.html 93) for(var i 0 i lt missiles.length i ) document.getElementById('missile').innerHTML lt div class 'missile1' style 'left missiles i .left px top missiles i .top px' gt lt div gt


UE4 BlendSpace is not working as intended I am trying to set up a rifle aiming blendspace in UE4. I downloaded animations from Mixamo, added root bone and retargeted them to UE4. Then I set up the BS, but the legs of the character are behaving weirdly, they are twitching, going through each other. The animations work fine on their own, but behave that way in the BS, especially in the transition areas. Here is the video Video Here is my BS Here is how I am setting Speed and Direction variables used in the BS Can someone please help me with this? I am new to UE4. How do I fix this and get a smooth Animation Blend Space?


Where can I find free motion capture footage? Are there any repositories of free motion capture footage? Or maybe just libraries of animations.


Baking Key Frame Animation in Blender I have a rigged model using an armiture in blender, I was wonder how you could bake the animation as kayframed data so that I could remove the armiture and the model still walks without being rigged.


ASSIMP transformation hierarchy and animations I don't fully understand the transformation hierarchy used by ASSIMP. According to the docs (http assimp.sourceforge.net lib html structai node.html) an aiNode's transformation is relative to its parent. Does this mean I need to concatenate its parents (and their parents) matrices with the nodes matrix to get the LOCAL matrix for the model? Or is the nodes transform already per multiplied with all the parents, meaning transforming the nodes vertices by the nodes transform directly puts the vertices in the models LOCAL space (and not just the 'NODE' space)? Kinda same as 1) but does transforming the vertices with the aiNodes transform put it in the "bind pose"? What is the point of even having a transform per aiNode? Why not just pretransform all the vertices? From what I understand the counter argument has something to do with animations... but each animation step already has its own position scale rotation! Any help is much appreciated, I don't fully grasp the transform hierarchy which makes it hard to formulate good questions.


Pre calculating skeletal animation data I'm working on skeletal animation and so far I've got the skeleton drawn with interpolated animation working (just on the cpu still). I was thinking about changing my file format for my skeleton and animations to have fully calculated matrices stored. Right now I calculate my matrices recursively by multiplying the parent's world matrix(absolute matrix) by the childs joint matrix, same thing with each frame of animation. I think it would be a good idea to just export all of this pre calculated to my model format so I could just send these matrices to the shader for skinning. Is there any reason I should not do this? Edit Calculating the matrices is negligible by itself on a rather small skeleton anyway but is there any reason I should calculate them at run time or just pre calculate in my file format? I think this sums up my question better.


How do I support animation with frames of different sizes? I'm trying to create a simple top view 2D rpg, in the style of Zelda and Secret of Mana, using PyGame. I've managed to make the beginnings of a game, with an animated character walking around. However, when I start animating attacks, I'm running into problems because the sprite with the sword slash is bigger than the walking sprite. This makes the character appear to be jumping around when attacking. I managed to handle the problem by defining a center of gravity, so to speak, for each image, and apply a suitable offset at each frame in the animation to make the center of the character stay at the same place throughout the animation. I defined a dictionary of lists of images (instances of pygame.Surface), where I pick out the correct list by the state of the character, so for example there is one list for walking left, and then I loop over the list to get the animation. To handle the offset, I similarly created a dictionary of lists of offsets, looping over those in the same way. However, I'm not entirely pleased with this implementation, so I'm looking for a more elegant solution. I tried to add an attribute called offset to each instance of the pygame.Surface class, to hold the offset for each image, but the Surface class doesn't allow new attributes to be set. I then thought about subclassing pygame.Surface, which would allow me to set any attribute I wanted, but then I couldn't load my images with pygame.image.load without a lot of extra code. I imagine everyone who makes a game with animations where the size of the sprite changes between frames would have to deal with this problem, so if anyone could suggest an elegant implementation, that would be great. If example code with PyGame is available, that would be even greater.


Rigging Skinning of human skeleton skin mesh scanned by MRI I have successfully developed a system in Qt C for human musculoskeletal mocap simulations. I can run asf, amc, bvh motion capture files and can visualize the joint transformations. I even simulated the static rigid bones of MRI scanned meshes. 31 mesh bones were extracted from MRI data and each bone is assigned to .asf skeleton bone id name and parent and child relationship is created. I have absolute and relative transformations of each bone and the bone mesh vertices positions are also known. Now there is a skin mesh over the skeleton bones. I want to do rigging skinning of that skin mesh with the bone transformation. If a bone transforms, its skin mesh should be transforming too. Literature study tells us that, assign each vertex of its bone and assign some weight to each vertex, sum up all and multiple with the bone's transformation matrix, etc. etc. and find the new position of a vertex. I have pretty much experience to play with meshes and transformations, I can do that. But here I do not get the concept, first of all, how can we assign vertex to its specific bone? because human skin is a continues with Only One Shell, do we assign by computing the offset minimum distance from bone to skin? Second question is how do we compute weight for each vertex? Because this mesh is not exported from MAYA or some 3D softwares, where each vertex is assigned with a weight value, but this is a static rigid mesh with no precomputed information. Third question comes to mind that how can we know that this specific vertex should be transforming with the transformation of Foot for example? How do we know that this vertex is a Foot vertex? I want to have some concepts about the methodology, please guide me. Thanks.


Slot machine game Phaser 3 I need an advice on creating a slot machine phaser game. So it looks like this I need to plan an approach to do the animation of the reels of the slot machine. I have idea of using tileSprite, are there any other ideas of implementing this game?


Converting designs from photoshop flash after effects into code I work as part of a two person team, I am the developer and my partner is the designer. We are currently having great difficulty working out the best way to convert his work into the actual app. We prototype all our animation in either Flash or After Effects and then I implement it into the actual application. The implementation is not a problem, but converting the information is what we are struggling to do efficiently. We have tried making large story boards that show the change in position scale rotation and the time for each of these tweens but they are time consuming to make. Currently I am running an After Effects trial and just dissecting the info straight from his design but my trial will run out soon. Just wondering if anyone can shed some light on how they do it or what is the standard practice in the industry? Thanks


Playing an animation in Godot I have been working on making a platformer in Godot but can't seem to get a walk cycle to play when I press left or right. extends KinematicBody2D export (int) var run speed 300 export (int) var jump speed 400 export (int) var gravity 1000 var velocity Vector2() var jumping false func get input() velocity.x 0 var right Input.is action pressed('ui right') var left Input.is action pressed('ui left') var jump Input.is action just pressed('ui select') if jump and is on floor() jumping true velocity.y jump speed if right velocity.x run speed if left velocity.x run speed if left or right and jumping ! false get node("AnimationPlayer").play('walkcyc') if left or right and jumping ! true AnimatedSprite.animation 'run' AnimatedSprite.flip h velocity.x lt 0 if is on floor() and velocity.x 0 or velocity.y 0 AnimatedSprite.animation 'stand' AnimatedSprite.flip v false AnimatedSprite.flip h velocity.x lt 0 if jumping ! false AnimatedSprite.animation 'jump' AnimatedSprite.flip v false AnimatedSprite.flip h velocity.x lt 0 func physics process(delta) get input() velocity.y gravity delta if jumping and is on floor() jumping false velocity move and slide(velocity, Vector2(0, 1))


Running one action on multiple sprites simultaneously I have created a spiraling animation for a football. I want to be able to run it on 2 sprites simultaneously. This is what I have done CCAnimation footballAnim CCAnimation animationWithFrame "Football" frameCount 60 delay 0.005f spiral CCAnimate actionWithAnimation footballAnim CCRepeatForever repeat CCRepeatForever actionWithAction spiral Sprite1 runAction repeat Sprite2 runAction repeat However, the action is only run on the first sprite. What am I doing wrong?


Is it possible to export a simulation (animation) from Blender to Unity? I created an explosion animation within Blender, something as shown in this video. To achieve this I used a particle system, together with the "Explode" modifier. This kind of animation (simulation) doesn't get exported to other file formats though and I'd like to export the animation as FBX, so that I can use it in Unity. So I basically need some way to "bake" the animation to keyframes. I wonder if there's a way to achieve this? After some testing I found out, that the only way the simulation gets exported is by writing a sequence of obj files. So an answer on how to integrate animate such a sequence of obj files in Unity would also be welcome. Side note I also tried to get an answer to this over at the blender community.


How to code a simple torch light? How would you code a simple "8 bit fire torch" (just one, nothing else to worry about on screen), without using any sprites? For instance, how would you "animate" a torch that looks like this one


Following a path in a smooth fashion I am currently making a 2d tower defense game with a static, predetermined lane that the enemies follow (i.e. towers cannot block the path and path finding is not the problem I am trying to solve). I am trying to figure how exactly to make units follow this lane in a smooth way. I have two rough ideas about how to do this, but I would love some input on which is likely to be easier to implement the more standard technique. Or of course if I there is some totally different way that I haven't considered I would love to learn about that as well. Waypoints My first idea was to define the path as a series of hard coded waypoints. Units would then use a basic "seek" steering algorithm (such as this one) to move to each waypoint along the path in succession. However, I have wondered if it might be hard to keep the units from deviating to much from the lane I want them to follow. I wonder if inability to turn sharply enough might cause them to sort of "glide" out off of the desired lane. I suppose I might be able to prevent that though by allowing for a relatively strong steering force to be applied? Bezier Curves The second solution I have considered is to define the path with a bezier curve and at each time step calculate the point along the curve with is (dt speed) away from the unit's current location. I suspect that this technique would make it much easier to precisely define the path that units will follow, but I don't know know how exactly to go about implementing this. Any suggestions? Also, I don't this will change anyone's answers, but units also must be able to travel at a constant speed along the path. Additionally, I am programming this game in python using the pyglet framework. If anything about the question is unclear please let me know. Edit Also for whatever its worth, I'm sort of trying to replicate the movement behavior of enemies in the Kingdom Rush.


Running two simultaneous animations on a model? I am just looking for a broad answer to this question. I am more curious about the general information rather than the specific. Also, I tried to search for this, but I think it's hard to word it so you get the right question. Anyway One common thing I see in a lot of games is multiple animations on the same model. i.e. A character runs, but also raises his arms an shoots. A character has a walking animation, but can also be carrying resources as he walks. I am curious if the first model has a "run" animation and a "run while shooting" animation. Or if they have a "run" animation and a "shoot" animation and run them at the same time. Obviously the first is possible, but I am wondering how the second one is done. Do they use two models for upper and lower body or is there a way to ignore certain parts of a model when animating? I know this depends a lot on the model, the programmer, language and the way the animation is done. But broadly, if you were making a model with the intent of it doing multiple animations at once, what would be the best way to go about it? Again, not after detailed specifics, just an overview ) Thanks!


Playing basic imported animations in UDK I'm trying to wrap my head around basic animations in UDK. I've created a simple turret like structure in Maya, rigged, skinned, and animated. It has 4 bones. I have done all the steps necessary for exporting and importing as an FBX (baked animations, etc.) I've imported it into UDK, and can view both the AnimSet and SkeletalMesh in the Content Browser. The AnimSet Editor previews the animation perfectly. This is a looping animation. I can load the SkeletalMesh into my scene, but I can't figure out how to trigger the animation. What is the simplest way to trigger this animation at run time? I could have it start when the scene loads and loop indefinitely, or I could have it triggered by pressing a switch or using a trigger volume. I just can't figure out how to make that happen. Also, any resources on diving deeper into this subject would be greatly appreciated as well. Thanks!


Number of iterations to real time I have an animation of traffic. I have 20 cars in road network, each car have a starting node and end node. Each car know how much distance does it need to travel in order to reach the end node. I move cars each 20 ms for 10 px. To move all cars from their start node to end node I need 60 iterations. That is 60 20ms 1200ms. Now I want to convert this time, or use data that I have, to a real time where car move 50km h. How can I do that? Any idea?


Is there an easier way to get sprites from a spritesheet One issue I have when working with API's such as Monogame and SFML unlike with Game Engines like Unity and Unreal is trying to extract sprites from a spritesheet. I know the method of doing it but it becomes really annoying when you use spritesheets for example that have lots of different sized sprites that are scattered all around the spritesheet. Everything seems to need to be perfectly sized and aligned to be able to extract the sprites correctly, unless you're using a game engine like Unity where you can do something like draw boxes around the sprites you want, no matter the size or position, or have this done for you. What workflow can I use to quickly select the portions of the image corresponding to each sprite and use those extracted sprites right away in code instead of splitting the sprites into seperate .png's and using them?


Animation timeline organization for Unity 5 I create stuff for AssetStore and use 3ds max and Unity 5. Can someone tell me how I need to work with timeline? When I create animation for several objects, I need to animate them one by one? (Example from Frame 0 to Frame 60 object 01 rotates 360 degrees, then from Frame 60 to Frame 120 object 02 rotates 360 degrees) OR I need to animate every one object in same time. (Every one rotates from Frame 0 to Frame 60). I know that I need to assign animation controllers in Unity, and if I create all animations in same time, I need only one controller for many objects. If there, any benefits to animate objects one by one and have multiple controllers later in game development?


How do I use the morpher modifier in 3dsmax to morph into several targets simultaneously? I have a 3D Face from Facegen here including all necessary phenomes' positions. But these targets are separated into upper, lower teeth, sock and eyes. How do I combine them for the face to morph into each facial position at once?


What are the pros and cons of these voxel data file formats? .VXL .VOX .KVX .KV6 .V3A .V3B I am trying to decide whether it's worth going with any of the above, or some other, or if I should roll my own. The deciding factors in order of importance are Animation support (I am aware this is a difficult aspect when it comes to voxels), using voxel deltas or numerical transform descriptions. Simplicity (or at least a concise format) Compression From what I can tell, the Tiberian Sun VXL format is the only one which is designed for animation, but Ken Silverman of Voxelstein3D fame claimed that VXL does not support animation (in a single file, were his words). So I wonder if maybe there are not two different .VXL formats, since it seems an obvious choice of file extension for voxel data... could be from a medical imaging context. I do need someone with solid experience of voxel formats to come and comment on the practical pros and cons, in their experience. Consider this question in the same way you might compare JPG to PNG to GIF.


What is the standard way to synchronize sound effects with sprite animations? Let's take a situation where you have an RPG with spells and each spell animations have a different number of frames and they have very different requirements for sound effects. Let's assume that each spell has only 1 continuous animation associated with it (as opposed to multiple modular pieces that are used to form a full animation) ala the old 16 Bit Final Fantasy games. The only way I can think of in order to make sure that the sounds and animations sync up is to Get the number of frames of an animation. Get the time between each frame of the animation. (if it's 30 fps then it's 1 30th of a second per frame.) Then create a sound file that is exactly the same length as the animation. So this means that if an animation is 5 seconds long, running at 30 fps, with a total of 150 frames, the sound file will also be 5 seconds long. If the animation should have an "impact" sound on the 30th frame, that means the sound file will include the sound of impact at the 1.0 second mark. At the end, we start the animation and the sound effect at exactly the same time and hope that the frames and the sound sync up. This sounds like it could pose problems when frames are skipped or something happens during the animation and the sound gets played slightly too soon or too late, and will cause the sound and the animation to go out of synch. Is this the best approach or are there usually a better way that I'm just not seeing? The answer doesn't necessarily need to be for Cocos2D specifically if it's conceptual, but if there's a specific solution for cocos2d, I'd love to hear it. EDIT I just also realize that with this method, if we happen to go in and adjust the number of frames or timing of the animation later, we MUST also go back and change the sound file. This sounds like a terrible cause for human error (forgetting to update sound files after animation change.) I hope there are better methods out there.


Exporting Blender bones I wrote an exporter for blender models that works great for meshes. I'm attempting to extend that to bones defined in blender. However I haven't found good information for exporting bone data. How can I access bone data? I'd like access all the vertices that the bone affects, the weight of each vertex and the matrix. Do I need to export anything else for skeletal animation and dynamic dismemberment?


Level Design V.S. Modeler From what I understand being a level designer and a character environment object etc Modeler are two different jobs, yet sometimes it feels like a Modeler can also do the job of the level designer. I know this also depends on the scale of the game. For small games maybe they are one and the same, but for bigger games they become two different jobs. I understand a background in some modeling could not hurt when it comes to level design, but the question I have is Do jobs prefer people who can model for level designing? This way they can kill two birds with one stone and have someone to create the assets and design the level. What is your opinion of the training? Does level design contain skill sets that make them completely different from what a modeler can do, or is this an easy transition for a modeler to become a level designer? Can you be a bad level designer but a good modeler and vice versa?


How do I export Physique animations without breaking them? I've been trying to export a simple footstep animation that I made in 3ds Max, but it either fails to export or is broken (imports into unity missing a few frames, or appears to have imported but won't play) every single time. I've tried .fbx and .3ds, but neither works. I'd rather not use the Skin modifier, because it would require starting from scratch and learning a new system. Any ideas?


How do you deal with transitions in animating walking? I'm pretty new to this whole animating models thing. Just learning the ropes. I got a nice walking animation going, which I can loop while a character is walking, but what about when they stop walking? I mean, they could be at any point in the animation at the time the player stops walking. How do I get them to smoothly return to a standing still position without having them snap into that position? The same goes for starting walking from a standing still position. Do you need a separate animation? How is this dealt with?


How to handle animations for a turn based deterministic game? I have a turn based combat system where all monsters act one turn, then all players, etc. The combat mechanics are completely deterministic I can pre calculate the outcome of a turn. I'm interested if I should do all calculations ahead of time (monster A will be at X, monster B will be at Y), and then just play a bunch of animations based on these calculations (Calculate for A) (Calculate for B) (Animate A move to X) (Animate B move to Y) OR do one animation per calculation? (Calculate for A) (Animate A move to X) (Calculate for B) (Animate B move to Y)


How to deal with animated doors in isometric tiles I've got a tricky issue I'm not sure how to tackle best I have an animated tile of a door. When it's closed it should be sorted one way, but when it's openend it will need to be sorted a different way, as it belonging to a different(neighbouring tile). Here's the door closed and the door opened I imagine it would be possible to override the sorting system for such tiles and adjust the sorting based on the frame, but it feels a bit hacky. Has anyone encountered a similar scenario ? Any elegant solutions ?


How do I scale a motion capture animation? I used motion capture in my room using the Kinect. As I don't have much space I make compressed running moves, i.e. I put my legs up and down while not moving far forward. How can I stretch the animation, so me walking 1 meters amounts to the skeleton walking 3 meters or similar while not exaggerating movements to the left right?


What software can I use to animate my character in Unity3D? I am new in game development and I want to know what software can help me to create good animations for my 3rd person character.


Animations in FBX exported from Maya are anchored in the wrong place We are trying to export a model and animation from Maya into Unity3d. In Maya, the model is anchored (pivot point) at the feet (and the body moves up and down). However after we have performed the FBX export, and imported the file into Unity the model is now appears to be anchored by the waist head and the feet move. These example videos probably help explain the problem more clearly Example video Maya Correct Example video Unity Wrong We have also noticed that if we take the FBX file and import it back into Maya we have exactly the same problem. It seems to be that the constraints no longer work after the FBX is reimported back to Maya, which just kills the connection between the joints and the control objects. When we exported the FBX we have tried checking the 'bake animations' check box. The fact that the same problem exist when importing the FBX back into both Maya and Unity suggests that the source of the problem is most likely with the Maya FBX export. Has anyone encountered this problem before and have any ideas how to fix it?


Objective c Cocos2d moving a sprite I hope someone knows how to do the following with cocos2d I want a sprite to move but not in a single line by using cocosGuy runAction CCMoveTo actionWithDuration 1 position location What I want is the sprite to do some kind of movements that I preestablish. For example in some point i want the sprirte to move for instance up and then down but in a curve. Do I have to do this with flash like this documents says? http www.cocos2d iphone.org wiki doku.php prog guide animation Does animation in this page means moving sprites or what? thanks


How can I integrate IK into a hierarchical editing environment? I have a situation where I'm trying to push the output of an IK solver back into a user editable joint hierarchy (which stores components as it's primary source), and I'm not sure how to go about it. My IK solver returns three world space transforms representing the position and orientation of a chain of joints (0,1,2). A I need to turn this into a hierarchy so that transform 2 is local to transform 1, and transform 1 is local to transform 0. Now I have local transforms for each joint. B Further I need to decompose each joint's new local matrix into source Translation, Rotation and Scale. Can anyone give me some tips for each step? I have some ideas, but I'm worried that to do B I need to particularly careful with A. Edit For example if I get my world matrices like this M4 world mats 3 IK solve( ikparams ) And then convert them to local like this M4 local mats 3 GenerateLocalChain( world mats ) And then extract components Scale s Rotation r Translate t foreach ( matrix in local mats ) Decompose( matrix, s, r, t ) How can I implement the Decompose() function to match matrices created inGenerateLocalChain()?


How do I render an animation where some frames appear twice? I am animating a sprite. The sprite has 7 different frames, but the animation is 10 frames long. This is because 3 of the original frames appear twice in the animation 3 gt 4 gt 5 gt 6 gt 4 gt 3 gt 2 gt 1 gt 0 gt 2 Frames 2, 3 and 4 appear twice. This avoids having to store duplicate frames in the spritesheet. How can I render the animation in this sequence with repeated frames?


How to port animation from one skeleton to another? While I need to do this in a Blender3D modeler script, the math should be similar for other modelers or realtime engines. Blender3D specific terminology Armature skeleton EditBone rest pose bone (stores the rest pose matrix) PoseBone can store a different pose (animation matrix) for each frame of your animation I need to share animations (Blender Actions) between Armatures which have EditBones with same names and which have the same positions, but can have different (rest pose) angles and scales. Plus the Armatures might have different bone hierarchy (bone parenting no bone parenting). Why I need this I've made an importer exporter for a 3d format for a game. The format doesn't store enough info to connect parent the bones, which makes posing animating character models in a 3d modeller nearly impossible (original model files for the 3d modeler don't exist, this is for modding). As there are only 2 character skeleton types in the game, I decided to optionally allow to generate the bone from a hardcoded data in the model importer and undo that in the exporter. This allows to easily pose the model for checking weights, easily create weights, makes it easier for Blender to generate automatic weights and of course makes animating possible. This worked perfectly the importer optionally generated the Armature itself and the exporter removed those changes, so the exported model works with existing animations in the game. But now I'm writing an importer and exporter for the game's animation format and here come the problems of Trying to make original animations work in Blender with my "custom" (modified) Armature Trying to make animations created by using the "custom" (modified) Armature work with the original models in the game (and Blender). Constraints or bone snapping inside Blender won't work as they don't care that the bones have different angles in the rest pose, they will still face the same direction. It seems I just need to get the "difference" between the EditBone matrices of all EditBones for the two Armatures somehow and apply that difference to PoseBone matrices of all PoseBones, for all frames of my animation. I need to know how to get that difference and how to apply it. BTW, PoseBone matrices are relative to rest pose, they are by default 1.000000, 0.000000, 0.000000, 0.000000 (matrix row 0 ) 0.000000, 1.000000, 0.000000, 0.000000 (matrix row 1 ) 0.000000, 0.000000, 1.000000, 0.000000 (matrix row 2 ) 0.000000, 0.000000, 0.000000, 1.000000 (matrix row 3 ) So the question is How to get the difference between two bone (EditBone) matrices to apply that difference to the animation matrices (PoseBone matrices)? Please be easy on the matrix math.


Transition between two Views i want to animation the transition between game screens , in my game loop i have a function called getCurrentScreen() which returns a Screen object this Screen Class has a function called present() this function draw on the framebuffer , when i want to change to another screen i call setCurrentScreen(Screen) , so it will draw the screen i set , What i want is to animation the transition between these screens any suggestion , is the a book or an article that discusses this


Suitable interpolation for animating explosions Is there a standard interpolation function for animating explosions? Like there is with smoothstep or smootherstep for walking animations or cars going from point A to B. I'm assuming the explosion needs to grow very fast at the beginning and then slow down how much in relation to the default linear interpolation, I don't know. I've tried inverse smoothstep and inverse squared from this article Interpolation Tricks, but none quite cuts it, maybe I'm applying them wrong.


Unable to enable IK on someone else's rig I'm using someone else's character rig for reference but I'm not sure how I can enable IK solvers for the arms. The hand controller has a NURBS control with an ikBlend attribute, but when I try to use the "Enable IK Solvers" tool, I get an error saying the attribute is locked or connected. Clicking "Unlock Selected" on the attribute doesn't fix it. Breaking the connections also breaks the ability for it to drive the enabled disabled state of the IK handle. The rigged character can be downloaded here if anyone wants to try to help me out http www.antcgi.com 2014 06 03 free model 15 kila lods rig dynamics


Using fully cropped sprites with TexturePacker and Cocos2d When using texturepacker, you can set your trim mode to crop. This is nice, because when a sprite loads in cocos2d your bounding box will only be the visible area of your sprite which is useful for things like collision detection etc. However, if you have a complex animation say a warrior with a sword, there is a good chance that the visible rect of your sprite is changing with each frame. For example, when the sword swings backwards or forwards your sprite width would adjust. Cocos2d seems to handle this in a less then ideal way when the dimensions change the sprite seems to dance around, rather then anchoring to centered point. In an engine I wrote, I handled this by using a set anchor point and direction for an animation. So if an animation got wider you could make sure it extended in a given direction (for example, a punch would extend in one direction, rather then appear to push the sprite backward from the fist) Does cocos2d have any mechanism for handling this? I looked at anchorpoint, but it doesn't seem to handle this scenario.


Running two simultaneous animations on a model? I am just looking for a broad answer to this question. I am more curious about the general information rather than the specific. Also, I tried to search for this, but I think it's hard to word it so you get the right question. Anyway One common thing I see in a lot of games is multiple animations on the same model. i.e. A character runs, but also raises his arms an shoots. A character has a walking animation, but can also be carrying resources as he walks. I am curious if the first model has a "run" animation and a "run while shooting" animation. Or if they have a "run" animation and a "shoot" animation and run them at the same time. Obviously the first is possible, but I am wondering how the second one is done. Do they use two models for upper and lower body or is there a way to ignore certain parts of a model when animating? I know this depends a lot on the model, the programmer, language and the way the animation is done. But broadly, if you were making a model with the intent of it doing multiple animations at once, what would be the best way to go about it? Again, not after detailed specifics, just an overview ) Thanks!


Game thread, render thread, animation inverse kinematics, and synchronization In a multithreaded setup with a game logic thread and a render thread, with some kind of skin mesh animation with inverse kinematics plus etc how does animation work? Does the game logic thread just update a number saying time T in the animation and then the render thread infers Who owns the skin mesh animation, the game logic thread or the render thread? How is it stored in the scene graph if it is stored there at all? When the game logic updates does it do the computation of the skin mesh animation and the computation of the inverse kinematics and then store the result directly in the scene graph or is it stored indirectly and the render thread does the computation?


How do I animate a tilemap in Flixel? I am trying to animate a tilemap using Flixel 2.55. I found this code that apparently enables the use of sprites as tiles. To my understanding, this loops over the tilemap's graphic and replaces the tile's pixels with the sprite's pixels each time they change. I have implemented the class and it's working, but not completely the tiles get replaced, but do not animate unless the camera moves. Here's is the relevant part from LevelLoader.as, which only instantiates the AnimatedTilemaps (piece of code from forum) and pushes sprites into an array AnimatedTile is just an extended FlxSprite private var waterTop1 AnimatedTile Create ground tilemap groundTilemap new AnimatedTilemap() groundTilemap.loadMap( rawXML.Ground, Assets.OverworldGround, 8, 8) FlxG.state.add( groundTilemap) waterTop1 new AnimatedTile(8, 8, Assets.WaterTop, 100) .Animate only adds and plays an animation, with a startAtFrame param. waterTop1.Animate('run', 0...47 , 10, true, 0) It seems as though the sprites are updating. I tried tracing the update()s, and they are running for both the sprites and the tilemap. The sprites are even changing frames. Using only AnimatedTiles and hard placing them (giving a x and y) works and animates. What troubles me is that they only update when the camera moves. I've been stuck on this for a week now. I am also open to other solutions for animating tilemap tiles.


What is next to interpolate camera position with smooth speed changes? I am working on a path camera to be used in demo playback. (3d game) The spline math used is catmull rom. I am on my second attempt to get constant position speed ( (someone else is doing rotation). The path cam keyframes are position time. I have a step now when the path is recalculated, it also generates the arc distance time lookup table which I have normalized. I have the duration of each segment(k through k 1)as well as each segments linear velocity calculated from that data. I am not very good at reading anything except basic equations. I could use an explanation or psuedo code of what is needed next in order to get the camera to smoothly accelerate or decelerate depending on the velocity of the next segment. Right now it's instant changes and no good. I tried googling for hours and was going in circles.


Should Animations in Turn Based Games Happen Before or After State Transitions? I'm planning a roguelike game and I'm unsure how to design for animations. Since a roguelike is turn based, the game model is discrete and would have no intermediate states during an animation(?). I've come up with two possible approaches Perform state transitions immediately upon input and compute the animations that occurred. In the case of a moving character, draw the animation as a member of the destination tile (instead of the static sprite) and coming from the origin tile. Compute animations before transitioning and transition the state asynchronously after the animation completes. Draw moving objects as members of their origin tile so that they arrive immediately before the state transition. Do developers of this type of game tend to prefer approach 1 or 2 (or some third option) and why?


How do I convert a Source engine NPC model to a player model? The Source engine's NPC and player models differ An NPC model applied to the player has no animations. It cannot walk and holds its arms out to the side by about a foot. The weapon is held in the right hand and you can see the player switch weapons, but the weapons also have no animation. How do I convert between these model types?


Blender books for advanced character animation and modeling? I've been messing with Blender on and off for over a year, and am now ready to put a lot of sweat into making a great model for an iPhone app I'm working on. I want to learn tips and tricks on how to make great looking models and how to animate them as well. I know how to do key frame animation, I just want to learn how to do it well. For instance, I have made a model that walks, but I want to improve it. I want to learn how make its movements realistic. Does anyone have any resources that could help me with this?


Animating from json file in pygame? I have got a json file and I am trying to load the single sprites from that file but I gives this error after a few loops and also the animation is not smooth(gets stuck) error Traceback (most recent call last) File quot test.py quot , line 18, in lt module gt screen.blit(image, (0, 50)) TypeError argument 1 must be pygame.Surface, not None This is the json file I am using quot textureAtlas quot quot texture quot quot Run (32x32).png quot , quot regionWidth quot 32, quot regionHeight quot 32 , quot cycles quot quot animation0 quot quot frames quot 0,1,2,3,4,5,6,7,8,9,10,11 The script for the animation import json pygame.init() clock pygame.time.Clock() c 0 def lcAnim(sfile) global c with open(sfile) as f data json.load(f) img pygame.image.load(data 'textureAtlas' 'texture' ) while c lt len(data 'cycles' 'animation0' 'frames' ) img.set clip(pygame.Rect(data 'cycles' 'animation0' 'frames' c 1 32,0,32,32)) Locate the sprite you want draw me img.subsurface(img.get clip()) Extract the sprite you want c c 1 print(c) return draw me c 0 and the main script import pygame import lcanim name of the animation script (width,height) (300,200) clock pygame.time.Clock() screen pygame.display.set mode((width,height)) pygame.display.flip() running True while running image lcanim.lcAnim('run.sf') name of json file for event in pygame.event.get() if event.type pygame.QUIT running False screen.blit(image, (0, 50)) screen.blit(alimg,( 10,10)) pygame.display.update() screen.fill((255,255,255)) clock.tick(10) pygame.quit() Here's a video showing the problem https youtu.be 8IeaqVCxvms (sorry other video sharing services were not working)