TMP Square Characters when adding Chinese I'm trying to implement Chinese language in my app. But I'm seeing nothing but squares. I've tried to create from file and hex. They can't be added. For example, there are 3000 letters but only 17 are included.


Simulate parallel dimensions subspaces in Unity without colliding coordinate systems I've built an online game with Unity with a very large open world. The server (which can be a local player, or run as a standalone application without a local player) simulates everything around players so for example if there is an object or NPC at coordinates (100,34,20) but there aren't any players nearby then the object is not simulated. Objects are streamed dynamically from a database or generated procedurally depending on the object. Problem I want to enable players to go to other worlds. Of course it is impractical if not impossible to have global coordinates shared across all of these different worlds due to floating point limitations. I'll have to share the limited coordinate system for each simulated world. The issue is the server would still need to render and handle physics of multiple worlds but could now potentially have conflicts with objects and or people on one world appearing in other worlds. Essentially I need a way to divide up these "worlds" into parallel dimensions that are executed simultaneously on the same server (in one Unity scene). Parallel Dimensions A partial solution would be to have some sort of indicator, such as an integer (I'll call it "worldIndex") on each object to indicate which "world" that object exists in. This would work for clients since the server would be able to tell the clients only about objects that are on their world. There would still be a problem on the server itself. Every world needs to be simulated in the same coordinate space. For a local player I could use the "worldIndex" to hide objects that aren't in the local player's current "world". But I still need to simulate physics for every world. Unity's Layers could be used to mask physics interactions between objects. However I would then need to have at least one layer per world and I already use multiple layers for various different interactions. My thoughts are I would need something like a layer I could specify on each GameObject or some way to group a bunch of GameObjects together and instruct the physics system to only allow interactions within the group. But as far as I know no such mechanism exists within Unity. Subspace Pockets Another thought I've had is rather than using the Unity coordinate space directly, I could slice it up into "subspaces" or pockets. Each player would be in their own subspace, unless a player physically enters the same space that is already being simulated by another player, in which case that player would join the same subspace. But then I would have shift around the coordinate systems and it would increase complexity of merging players into and out of these subspaces. I would also have to generate subspaces dynamically as players enter new areas that are not currently being simulated. Even if each world is extremely large, it is not necessary to use the entire Unity coordinate system around each player a few thousand kilometers is more than enough. Overall I think something along these lines is probably the best solution. Multiple Servers I could run one server per "world" and have a hand off process to make it transparent to players. But then I'd have to run multiple server instances and players would not be able to host their own server at least not without a lot of additional overhead. Question So my question is what is the best method for essentially running multiple, parallel simulations within a single Unity scene?


Gamemaker vs Unity2d Speed of Development I know coding, so programming is not a problem Money is not a problem at all, I can get both GameMaker Master Collection and Unity Pro I want to make a 2d game. So which one is better for speed of development? On which one would I be able to finish my project earlier?


Make a light only affect one object I'm wondering if it's possible to make a light source only affect one object? I know that it's possible to use layers and culling mask, but then I would need one layer for every single object which is not possible. Is there a way for example that I could make only children or siblings be affected by a light source? Or other solution? Have a nice day! Update 1


How to clamp the rotation between two values in unity 3d How can i clamp the rotation of cube between two values and then rotate between them gradually Details Of what i Want When I press A or D keys cube should Rotate On Y Axis from 0 to 13 deg gradually and when key is released cube back to straight position


Object goes straight through game object without colliding The "shot" is supposed to collide with the left bumper and then be destroyed, but the shot goes right through it. Both objects have a box collider. The following is the code I am using pragma strict var speed int 2 var collided with GameObject function Update () transform.Translate(Vector3( 1 speed Time.deltaTime, 0, 0)) function OnCollisionEnter (col Collision) if (collided with.tag "Left") Destroy(gameObject) I have made sure that all the tags are assigned correctly and that there are no spelling errors. The variable collided with is also assigned to the left bumper. What am I doing wrong?


Unity Smooth player input direction when changing camera Preface I'm very new to Unity. I'm working on an exercise using fixed cameras like how they work in the PSX final fantasy games. I have the camera scripts working fine but it's an aspect of the character control that I'm struggling with. My character moves relative to the cameras facing position, but when the camera suddenly changes to another angle, my running direction instantly and abruptly changes too. In the final fantasy games it sort of keeps going roughly in the same direction you were briefly. input new Vector2(Input.GetAxis( quot Horizontal quot ), Input.GetAxis( quot Vertical quot )) input Vector2.ClampMagnitude(input, 1) get camera direction need to add something here for in between camera switches! camF Camera.main.transform.forward camR Camera.main.transform.right camF.y 0 camR.y 0 camF camF.normalized camR camR.normalized transform.position (camF input.y camR input.x) Time.deltaTime 8 I saw someone with a similar game comment on an article with his solution, but I don't quite know how to put it into code. The quote quot Player just gets a rotation based on where the camera is looking and multiplies the character s motor force by that .forward and .right. I only update that rotation after a big delta in input so you can smoothly move between shots. quot This is his small (online) game which he's talking about, I'm trying to mimic the movement basically https ocias.com games foggy shore Can anyone give me some pointers? Updated It doesn't quite play how it does in the demo game, but it's getting there. input new Vector2(Input.GetAxis( quot Horizontal quot ), Input.GetAxis( quot Vertical quot )) input Vector2.ClampMagnitude(input, 1) if (!cameraChanged) lastCameraInput input camF Camera.main.transform.forward camR Camera.main.transform.right camF.y 0 camR.y 0 camF camF.normalized camR camR.normalized else if (Vector3.Dot(input, lastCameraInput) lt 0f) cameraChanged false transform.position (camF input.y camR input.x) Time.deltaTime 8


Add parabola curve to straight MoveTowards() movement I have some units shooting arrows, right now they move in a straight line to the target. I want them to move like a real arrow, i.e using a parabola curve. However I don't want to use physics. The math I need to do seems to be beyond me, I've tried to convert 2d solution I found online and other semi similar solution with no luck. My current straight movement private void Update() var nextPos Vector3.MoveTowards(transform.position, target, speed Time.deltaTime) transform.LookAt(nextPos, transform.forward) transform.position nextPos if (Vector3.Distance(nextPos, target) lt .1f) Arrived() An example of a 2d version I tried to replicate Here.


Why does this raycast code give me a NullReferenceException? The Error in the code is NullReferenceException Object reference not set to an instance of an object for if (hitxx.collider.tag "soldier") Please help! Thanks in advance void Update () Physics.Raycast (eyeenemy.transform.position, (eyeenemyfront.transform.position eyeenemy.transform.position) 20,out hitxx) Debug.DrawRay (eyeenemy.transform.position, (eyeenemyfront.transform.position eyeenemy.transform.position) 20,Color.green) if (hitxx.collider.tag "soldier") gameObject.transform.LookAt (soldier.transform.position) Debug.Log ("chuchu")


Why is my mouse disappearing at runtime? I'm using Unity 5.3.5f1 and every time I play my game in the editor, my mouse disappears. I really need to test some of my parameters in the inspector but I can't because the mouse is gone. How can I fix this, and if possible, make it permanent?


How to correctly implement 'layered lighting' with Box2D Lights How does one only allow Box2D Lights to affect one and only one OrthographicCamera. After researching, I found the following answer. This answer goes into detail about how to prevent one camera from being lit by the RayHandler by blending layers of the FBO object. I'm unsure if this answer will produce the results I require. If it indeed does create the results I require, how can I do so more simply elegantly. For example 1) In this image you can see ambient light is set to this.rayHandler.setAmbientLight(new Color(0.1f, 0.1f, 0.1f, 0.25f)) 2) There is a point light on the far right with purple colour. 4) There is a star background on a different OrthographicCamera to the other objects. When looking at this image, you notice that the stars are brighter near the planet due to the point light casting light on the background. However, I require the inverse. The stars should be brighter when light is not drowning them out. Knowing that the star background is on a different OrthographicCamera how can I allow the texture to be completely unaffected by light so the ambient light of the RayHandler does not dim them further away from the planet. The texture used for the stars contains transparency. The black is created using Gdx.gl.glClearColor(0f, 0f, 0f, 1) Preferably, I would like to be able to simply place cameras into two lists, affected by light and not affected by light. How does I produce the results I require? I can manage to get the lighting to ignore the star background by rendering it after the RayHandler has been updated and rendered, however this obviously causes the star background to be drawn over the top of everything like so After achieving this, I was reminded of the OpenGL depth buffer. I enabled it using Gdx.gl.glEnable(GL20.GL DEPTH TEST), I then attempted to change the z coordinate of the spritebatch used in the camera for the star background by using SpriteBatch.getTransformMatrix().idt().translate(0f, 0f, 1f) however after playing with the values of the other sprite batches I can still not get the effect I require. It is possible that the above method did indeed work, although I am aware that using the depth buffer incorrectly can cause issues with alpha blending? Making it seem like my problem was not fixed because the planet became translucent.


clamp a 2D coordinate to fit within an ellipse I need to clamp a 2D coordinate to fit within an ellipse. Call of Duty Modern Warfare 2 does something similar where capture points are translated from a 3D vector in the world to a 2D screen coordinate and then the 2D coordinates are clamped within an ellipse. When the capture points are in view they're within the bounds of the ellipse. When they're behind you they are clamped to be within the bounds of the ellipse. Given a 2D coordinate that could be off screen, etc, what is the math behind clamping it within an ellipse?


Cant import Sun openGL I've been working with JOGL and I've ran into a problem. The problem is when I try to import import com.sun.opengl. on Eclipse, Eclipse doesn't recognize it. Does anyone know where this library is? Did I miss a step during installation? I'm working with the latest build. Here are the included libraries gluegen rt natives windows i586.jar JOGL lib gluegen rt JOGL lib gluegen.jar JOGL lib jogl all natives windows i586.jar JOGL lib jogl all.jar JOGL lib This is within my JOGL project folder gluegen rt.dll


Optimal number of work groups for compute shaders In OpenGL, is there a way to dynamically determine the preferred workgroup size of the underlying hardware? Or at least, to approximate it using some queried metrics? In OpenCL, you can do this using some implementation defined constants, but so far I wasn't able to find something similar for OpenGL.


How do I build Assimp with MinGW? How can I build Assimp with cMake and MinGW? I tried, but I don't get a functioning library... Details of my attempt I am trying to build the Open Asset Import Library (Assimp) but I have been running into problems. The assimp documentation is really poor and expects you to know exactly what you are doing. The developers haven't been particularly helpful either. I hope someone here has successfully built assimp and can let me know where I am going wrong. I suspect that I have several problems that are contributing to my failure. I am using 64 bit Windows 8.1 pro and using MinGW version 4.8.1. The first thing I tried was downloading assimp 3.1.1 and boost 1.57. I extracted both folders and tried to use cMake to generate the makefile for MinGW. I haven't used cMake before and the assimp instructions are use cMake as you normally would, so I have no idea if I configured it right. I pointed BOOST ROOT to the boost folder I extracted from the download, set it to build static libraries and generated the makefile. I then tried running the makefile and got a number of errors. The first was IFCReaderGen.cpp.obj too many sections and was too big. After some googling, I found a workaround was to set CMAKE BUILD TYPE to release. That seemed to work and it finished the build but I only got the files assimp32.dll and libassimp.dll.a, which I thought was odd because I was expecting lib relese libassimp.a to be generated as per the details on the assimp website. Though the website might also be wrong or out of date. I linked with lassimp.dll and that allowed me to build my program. However it crashed upon start up the error that appeared immediately at start up was Program has stopped working (There was no additional info.) I guessed that this was a dll problem which was odd because I had (tried) to build the static libraries through cMake. I copied assimp32.dll into my executable folder. This time, the program wouldn't crash but the screen would be blank. I'm guessing that there was something wrong with the library I build that was causing it to link incorrectly. At this point, I deleted everything to try a fresh start. I tried to follow this article I downloaded assimp 3.1.1 and boost 1.57 and extracted them. I opened cmd, changed to the boost root directory and ran bootstrap.bat mingw I then ran b2 build dir "C Libraries boost " variant release link static address model 32 toolset gcc The result of this was 598 targets updates, 3 targets skipped, 2 targets failed. I now have a folder C Libraries boost boost bin.v2 with two folders libs and standalone, but I'm not certain what my BOOST ROOT directory is anymore. I opened cMake, selected the assimp folder I had extracted, and configured the following BOOST ROOT "C Libraries boost boost " ASSIMP BUILD STATIC LIB TRUE ASSIMP BUILD TESTS FALSE ASSIMP ENABLE BOOST WORKAROUND FALSE BUILD SHARED LIBS FALSE I then pressed configure and got the error that the boost libraries were not found. I'm only guessing what these cMake settings do, as I can't find any documentation for assimp. I'd like to build some version of assimp that I can then link to and use in a simple test program. At some point I will go back and build the shared libraries, but first I just want to get something working and understand how to do it again. Can someone see what has gone wrong?


OpenGL GL LINE STRIP produces arcs with visible line edges Another member mentioned an issue while drawing arcs with GL LINE STRIP. He has GL LINE SMOOTH enabled. The question is, how could he avoid the tiny gaps between vertices without increasing their number? Edit The original discussion was on SO. Click here for more info.


How to create OpenGL models like the ones created by blender's wireframe modifier? How could I create programatically wireframe models like this out of a triangular mesh? What'd be the algorithm behind? (Source) Creating an additional mesh using lines instead triangles or just using a single mesh with the typical geometry shader using barycentric coordinates are the most straightforward approaches. But they're far away from being as cool as the results shown in the above link. So I was wondering how difficult would be creating a new mesh like the shown in the above link, would it be possible to achieve by just having a simple triangle soup?


Creating a frustum for culling in world space glm matrices I need to do frustum culling where the bounding boxes are in world space to determine which entities get to be updated drawn. I was trying to use the classic projection view matrix plane extraction method but it doesn't seem to work with perspective matrices created by GLM. Is this method appropriate for world space culling? It seems like it would be (takes the eye position into account and the projection matrix shapes the frustum). I've only looked at the near far planes extract so far and they're wrong for a frustum sitting at the origin (Both have a c component that's negative which means near and far are facing the same direction). Also, since the d components can't match the near far clipping values with this method is it wrong for world space culling?


3D Camera manager tool is there any? Are there some libraries or example codes, of a camera manager a tool, that would move camera using some smooth lines (bsplines or similar)? So basically I request an animation to move to a new eye center possition, and the tool takes care of the rest?


Different shader programs but same buffer drawing I've setup 3 different instances of the same shader code (e.g. I've compiled the code into 3 separate programs) For each program, I've gone through the whole route of something like this Setup gl.useProgram(program) const buffer gl.createBuffer() const location gl.getAttribLocation(program, aName) Upload (each uses the buffer location it created in Setup gl.useProgram(program) gl.bindBuffer(gl.ARRAY BUFFER, buffer) gl.bufferData(gl.ARRAY BUFFER, data, usagePattern) gl.vertexAttribPointer(location, nComponents, dataType, false, 0, 0) gl.enableVertexAttribArray(location) Draw gl.useProgram(program) gl.vertexAttribPointer(location, 2, gl.FLOAT, false, 0, 0) gl.drawArrays(gl.TRIANGLE STRIP, 0, 4) However, no matter what I pass into data e.g. different sized quads, all three are the same size. Notably, changes to other uniforms attributes like matrices and color do change per object How do I change this so that the changes to data per instance will be drawn properly? (I realize if they actually use the same shader I should maybe keep a reference to one program and use some sort of buffer pool but I'm not there yet, just getting started with WebGL)


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?


UV Texture coordinates out of 0,1 (WebGL) I'm creating a 3D game with WebGL and i'm using Wavefront Objects as a base model format. I recently found some models, their texture coordinates of which are out of the typical 0,1 range and i really don't know how to handle them (in code). I know of course this is a known issue, texture coordinates can be outside of 0,1 and the solution is to use GL REPEAT wrap mode. But this is no solution to me since i have a lot of non powered by 2 textures and i need to use CLAMP TO EDGE wrap mode (the solution to non pow 2 textures). I tried to bypass this issue by coding, so to convert 0 ,1 ranges into 0,1 but with not much of success (although somewhat). Here's what i did I looped "vt" entries (from my parser) and the cases i'm checking are these (pseudo) U,V texture coordinates as they come from file if (U lt 0) U U Math.abs( Math.floor(U) ) if (U gt 1) U U Math.floor(U) if (V gt 0) V Math.ceil(V) V if (V lt 0) V Math.abs( Math.floor(V) V ) The above fragment will take a U,V of unknown range and will convert it into 0,1 , taking also care the WebGL texture coordination system (0,0 buttom left for WebGL but 0,1 for Wavefront, the 3rd case above) The numbers are calculated correctly but the result is not the expected and i'm afraid there is a misunderstanding by my side on how the GL REPEAT mode works. So my question(s) Can this be solved by code, so i can use CLAMP TO EDGE? In case there's no way, is there any program than can take a model of REPEAT ed coordinates and produce one in 0,1 range? I'm already using Blender but could not find a setting for this in exporter.


How can I draw lines and curves on a canvas that's not rendered? I need to draw lines and curves on a canvas that is not rendered on the screen but just updates the array of pixels that would otherwise be rendered. I need this to separate my game engine from my renderer. This has proven rather difficult for my case because I don't use sprites that are loaded, but I draw lines and curves on a canvas. I have used the p5.js library to accomplish my game, but p5 doesn't let you work without a "setup()" and "draw()" function. I don't want any draw loop or something because that beats the purpose of separating my game engine from my rendering. I want to use p5 to render after I have all my game logic separate and I can just call nextFrame() or something from my game logic inside draw() in a constant 60 fps. In p5 it is possible to createGraphics() which works outside of the canvas and doesn't have to render but again, p5 needs a draw() loop to work. Does anyone know how I can accomplish this?


Separating .js elements .js element communication So I have 2 questions regarding the code below function goldClick(number) gold gold number document.getElementById("gold").innerHTML gold function buyMiner() var minerCostG Math.floor(100 Math.pow(2.1,miner)) var minerCostW Math.floor(10 Math.pow(3.1,miner)) if(gold gt minerCostG) if(wood gt minerCostW) miner miner 1 gold gold minerCostG wood wood minerCostW document.getElementById('miner').innerHTML miner document.getElementById('gold').innerHTML gold document.getElementById('wood').innerHTML wood var nextCostMG Math.floor(100 Math.pow(2.1,miner)) document.getElementById('minerCostG').innerHTML nextCostMG var nextCostMW Math.floor(10 Math.pow(3.1,miner)) document.getElementById('minerCostW').innerHTML nextCostMW window.setInterval(function() goldClick(miner) , 1000) Question 1 Is it possible to separate these functions (goldclick, buyminer, window interval,) into their own documents so that if I have say, 50 different XXXXclick functions, and 50 buyXXXX functions and 50 interval functions, I have just 3 .js documents instead of 50. Question 2 If it is possible to separate them, how would I ensure that they are communicating with each other and variable values are not being confused or sent to the wrong lt span gt in the displaying html.


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?


How to access files in Chrome So, I am making a game like html file that needs to load a few assets. I have a loading animation which uses the timing of the loading files to create a progress bar. This all goes fine. The files all load, and the app launches. However, none of the files can access each other as they are all in different script tags. And I cannot merge them because the JS is never actually put into the html. So what I need to do is to access the local file system (it uses the file prototype) and read the file, then stick the text into a script tag. However, all of the examples I have found on the web throw this error Xhtmlrequests can only access (list of protocols not including file) What I need is a JS way to access the files with no input from the user (other than opening the application). How can this be done?


Scrolling Box2D DebugDraw I'm developing a game using Box2D (javascript implementation Box2DWeb), and I would like to know how I can pan the debug draw. I know the usual answer is don't use debug draw, it's just for debugging. I'm not, however not all my objects are on the same screen, and i'd like to see where they are in the physics representation. How can I pan the debug drawing? As you can see the debug draw stuff, is show on the top left, but it only shows a small part of the world. Here is an example of what I mean http onedayitwillmake.com ChuClone The game is open source, If you'd like to poke through and note something that perhaps i'm doing something that is obviously wrong https github.com onedayitwillmake ChuClone Here's my hacky way that I'm using now to scroll the b2DebugDraw view, in which I added a property offsetX and offsetY into b2DebugDraw


How to fix thi gameover scene audio transition? I created a gameover scene in a crafty.js project but it does not run. Crafty.scene('gameover', function() Crafty.background(" ccc") Crafty.audio.stop("bg") ) var gameOver function () Crafty.scene('gameOver') The background music ("bg") doesn't stop playing once the game ends. How do I fix this?


I need a map generation algorithm for towerdefense I'm making a simple JavaScript tower defense game, I've experimented on some map generation my self, i seem to get one that works properly. What I want is for you to provide a start point (possibly an end point) and an algorithm to generate a random path between them in a tower defense like style. Examples


Phaser How to call a function inside another function? So I actually have the following code that works var player var box tnt function create () this.physics.add.collider(player, box tnt, hitTnt, null, this) the function hitTnt stop the game because the player died function hitTnt (player, boxes) this.physics.pause() console.log('Game Over!') textGameOver.setText('GAME OVER') player.setTint(0xff0000) player.anims.play('default') gameOver true and I want to do something like var player var box tnt function create () this.physics.add.collider(player, box tnt, hitTnt, null, this) the function hitTnt stop the game because the player died function hitTnt (player, boxes) gameOver() other stuff here function gameOver () this.physics.pause() console.log('Game Over!') textGameOver.setText('GAME OVER') player.setTint(0xff0000) player.anims.play('default') gameOver true but I have the following error message TypeError gameOver is not a function Do you have please any ideas how to do it properly?


MVC How To Handle Animations? I am working on a turn based game that utilizes the model, view, controller design pattern to separate logic from input from rendering. I am still a little new to the pattern, but from my understanding I have laid out the following MVC system. The model(s) comprise a set of pawns with game flow and interaction logic. Pawns models know how to interact with each other and the model world, but only when signaled to do so via function calls. (i.e. pawn.move(startLocation, endLocation) or pawn.attack(enemyPawn)) The view(s) make up everything that is viewable by the player. This includes menus, visual representations of the pawns models, and any user interface components like cursors and buttons. The view(s) query the model for data to draw visual representations of pawns. The view(s) also can dispatch user interface events to any observers interested in these events. The controller(s) handle all transition and input logic. When an interesting user interface or input events occur, the controller decides what the model should do and signals the model to do it. The controller also handles swapping out of views when necessary. I know there are many ways to implement MVC and I am open to suggestions if something seems off with this design, but the real problem I am having is how to handle animations in the view. Say the user commands a pawn to move 5 spaces North and 1 space West. I want an animation to show this over several seconds. How would I handle something like that?


Skeletal Animation No initial bone rotation I am currently trying to implement animations in my game. I am having an issue where the bones do not rotate properly. In my program, I apply an inverse bind pose to each bone to move them to bone space. Then I recursively calculate the transformations for each bone for the keyframe. The bone transformation looks like this bone.Transform InverseRootGlobal Global bone.InversePose InverseRootGlobal is the inverted root node transformation Global is the recursively calculated transformation bone.InversePose is the inverse pose matrix It appears that all is correct apart from the bones initial rotation. When I move the bones to bone space, they loose their rotation from the bind pose and 'point up'. Here's what it looks like If it helps, I am using Assimp to import the data. Thanks in advance.


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


Stop current animation and re play immediately? When the player hit something, I'm playing hit animation from animation player. However when player hit something while hit animation is playing, it just ignored and play previous hit animation. I need to stop the animation, but couldn't find any related information. How do I stop the animation and play again immediately?


3ds Max Rigs to Cinema 4D I exported the rig from 3ds Max as a FBX file and opened it with Cinema 4D. Everything works great, but the model and a different look to it. Also the mask on her head has a different texture, but it was imported with only 1 object. Just wondering if it can be fixed, if not its ok.


Efficient sprite animation display methods? I'm making a game sprite, with animations for transitioning to different states, such as idle, sleeping, etc. I'm wondering what the most efficient way to play the animations is. As of now, I have a couple of ideas store all frames as separate PNG images, and display only the frames for the current state (e.g. play frames 1 5 for idle, 5 10 for transitioning, 10 15 for sleeping) make the animations into GIFs and play the one corresponding to the current state. merge them all into a spritesheet. Please let me know which would be the best approach, or if there's a better way to do things. I'm new to handling images and animation with code, so I'm not sure what the advantages and disadvantages are. Thanks! In case the information helps anyone, I'm planning to use Python for this (although I could also do Java or C , if there are good solutions in those languages), and the sprite image size isn't large, it's pixel art.


Guidelines when rigging a character Just wondering that how many IK (Inverse Kinematic) bones should you apply to a game character before it starts to go resource hog. Basically should you try to get rid of IK bones and just try to animate without them but using IK bones makes things easier for the animator but might cause unnecessary use of resources and possibly cause bottleneck when calculating bone and mesh translations. I'm using Blender and couple of animation tutorials are suggesting to use IK controllers and they indeed help a lot but when importing the character into a game they might be plain pointless since they are used only to help the animator.


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.


Animation with non uniform frame sizes How do you know when to draw the next frame if its bounding box is larger smaller than the current? For example, in KOF, some characters have elastic arms and things of the like..How are these handled in a game?


Calculate smooth transition between local space angles I'm trying to calculate direction of moving character (to rotate it's animation). I have something like this Character can have 4 cardinal directions. The rotation is calculated from the current cardinal direction. So for example For north we have 90 degrees from N to W and 90 degrees from N to E. From E to N we have 90 degrees and from E to S we have 90 degrees. The problem occurs when character is switching directions.It happens at about half the distance between cardinal directions. At this point current rotation is switching from negative to positive number (or other way around), and there is noticeable hitch. When for example going from E to N, it switches to N direction but it was at about 45 degrees which in N space it places for a frame or two between N and W directions. Why do I calculate angles in cardinal direction space ? Animations are prepared for strafing or moving backward (or any other angle) and I need to assume that the direction of animation is 0 degrees and calculate from here. Is there way to smoothly change angle between cardinal directions ? For now I tried to lerping between them when switching (which improved overall look but is far from smooth transition), tried to track from which direction the switch is coming, but it didn't really improved anything. FVector Right Character gt GetActorRightVector() FVector Forward Character gt GetActorForwardVector() FTransform Transform Character gt GetTransform() FVector CurrentAcceleration CMC gt GetCurrentAcceleration() FVector CurrentVelocity CMC gt Velocity FVector AccelerationDirection CurrentAcceleration.GetSafeNormal2D() FVector VelocityDirection CurrentVelocity.GetSafeNormal2D() FVector LocalAcceleration Transform.InverseTransformVectorNoScale(AccelerationDirection) FVector LocalVelocity Transform.InverseTransformVectorNoScale(VelocityDirection) float DeltaTime Output.AnimInstanceProxy gt GetDeltaSeconds() float Atan2Angle FMath Atan2(LocalVelocity.Y, LocalVelocity.X) const int32 ChildIndex FMath RoundToInt((Atan2Angle 2 PI) 4) 4 float VelAngle FMath RadiansToDegrees(VelQuat.GetAngle()) float OldOrient CurrentOrient EFCardinalDirection Dir static cast lt EFCardinalDirection gt (ChildIndex) EFCardinalDirection OldDir static cast lt EFCardinalDirection gt (OldDirection) float DirDot 0 main switch wihin which I determine from where calculate angle. switch (Dir) case EFCardinalDirection N FQuat ForwardQuat FQuat FindBetween(Forward, CurrentVelocity) float OrientN FRotator(ForwardQuat).Yaw CurrentOrient OrientN FMath FInterpConstantTo(OldOrient, OrientN, DeltaTime, 300.0f) break case EFCardinalDirection E FQuat LeftQuat FQuat FindBetween(Right, CurrentVelocity) float OrientE FRotator(LeftQuat).Yaw CurrentOrient OrientE FMath FInterpConstantTo(OldOrient, OrientE, DeltaTime, 300.0f) break case EFCardinalDirection S FQuat BackQuat FQuat FindBetween(Forward ( 1), CurrentVelocity) float OrientS FRotator(BackQuat).Yaw CurrentOrient OrientS break case EFCardinalDirection W FQuat RightQuat FQuat FindBetween(Right ( 1), CurrentVelocity) float OrientW FRotator(RightQuat).Yaw CurrentOrient OrientW FMath FInterpConstantTo(OldOrient, OrientW, DeltaTime, 300.0f) break default break


Optimizing the economy of a resource management game I am an amateur game designer. I am designing a resource management game involving real money. This is my first time designing such a game. I explain the design and mechanics below. I need feedback from experienced game designers regarding i) The sustainability of the core economic loop of this game, ii) Concrete suggestions to de risk or fine tune it (if you can think of any) My game is about digging up treasure. Treasure is real players can cash out. The objective of the game is to make as much money as possible. Players utilize digging machines (excavators) to unearth treasure. The attributes of these digging machines are Digging prowess Most machines are mediocre diggers. I.e. they unearth small treasure. A few rare machines can dig up really big treasure. And then there are other types in between these two extremes. Scarcity Only a finite number of machines are available in this game world. Transparency Machines' visual design varies in accordance to their digging prowess. I.e. players can easily spot which machine is better than the rest. Main mechanics When a new player joins this game, they utilize real to buy one or multiple such machines. Once bought, each machine can either be Stored away (unused), or Put to work. Note that when a machine accumulates 1 hour of digging time, it unearths treasure. The amount unearthed is always proportional to the machine's digging prowess. Putting machines to work has an upside and a downside Upside Machines that are put to work unearth treasure (actual players can claim). Downside Working machines can be forcefully bought by another player (for the machine's current value 5 profit). No permission is needed. This permanently increases the value of the machine. Which means, if you want to snatch it back, you pay a further 5 increment on top of everything. Storing machines away has an upside and a downside Upside Nobody can forcefully buy them from the player. Downside They don't help the player earn anything. How do we finance the treasure finds? There is a pool of money in the back end that finances each and every treasure finding. We finance this pool in two ways The first time a digging machine is bought, 90 of the proceeds are routed to this pool (10 are pocketed by the game developer). I earlier mentioned that whenever a machine is forcefully bought, a 5 profit is paid by the buyer to the unwitting seller. We route 10 of that profit to the treasure pool, 10 to the game developer, and 80 to the unwitting seller of the machine. It would be great to get feedback from experienced game designers regarding the economic viability of the game's core loop. How do we Make it sustainable? What are the economic risks? How can they be quantified? Are there any risk minimization tactics we can bake in?


Is correct to calculate values in percentage, using the total number of iterations? Trying to clarify the problem. Imagine a factory that produce soccer balls if you produce 1 ball, it will take a certain amount of game cycles. For sake of simplicity, let's say it could take between 5 and 15 cycles (depending from various conditions, like number of workers, quality of workers and so on). Once you make a certain amount of soccer balls, the process is considered done. Now, I want to display a value in percentage for costs, and a value of defective balls made. with "cost", I am trying to display how much did I spent (materials, workers wage and so on), at the moment. The number in currency is self esplicative, but I believe a percentage value could help to know if you are using too many workers, or burning too many resources, resulting in a waste of money. To calculate the percentage of defective is relatively simple, since every X amount of time, when I refresh, I can check the balls produced against the defective ones, and the result should be Total produced 100 defective percentage of defective. But for the costs, things are different so I was planning to use the number of cycles to calculate percentage for costs cycles 100 current costs percentage of costs Would this be considered correct? Since the number of cycles for a whole batch of balls may vary slightly, this may represent that when there are less cycles, it means that you spent less money, henche the percentage will be smaller.


How to compare different states of my game? (rpg) I'm working on a rpg, the battle system. I want to compare different scenario with each other. For example, what if I play move A then move B ? or two times move A ? or ...? I'm using a tree structure to generate all possible scenario that can happen during the battle. There is no movement involved, I'm using a battle system as in FF7, only skill choice matters. 4vs4 units Trick is, the battle is turn based but not static. There is an Action Point bar for each unit (filling at different speed based on the unit's stats) and the unit with the most Ap (only if 100) can play. If no unit is 100, a "turn" will happend and all unit will gain some AP based on their speed. If no unit can play, a new turn will happen...until a unit is 100 ap. Each skills takes a different amount a AP to use. At turns 0 for example, we may have a unit with 140 AP that will play two times in a row for 2 actions of 20 AP each. Then other units at 100 AP may play. It means that when I'm running a simulation of all possible outcome of a battle for my AI, I will have states (node in the tree), that will have a number a turns very different from other and from nodes at the same depth. I dont know how to compare these nodes at all. I was using Hp at first, but it is not enought. To prove it, consider the example 1 vs 1 match. Unit A (opponent of AI) has only 1 move, a small attack that requieres 20 ap. Unit B (AI) has two moves a small attack that takes 40 ap (and overall hit for very low damage compared to the opponent attack) and a second move that does nothing but consume 20 ap and that move can only be used during the 1st turn. I will then have to compare two states State 1 AI use its attack . Opponent his attack. Units are at 60 80 ap respectively. 20 game turns passes and they are now at 80 100 ap. Opponent use his attack. 20 game turs passes and they are at 100 100 again and we are at turn 40. State 2 AI use his move that does nothing. Opponent his attack. Units are at 80 80 ap. 20 games turns passes, they are now at 100 100 and we are at turns 20. If I compare only HP, In state 1, AI will have an overall score a lower than in state 2 since it got attacked twice in state 1 and 1 times only in state 2. If I only compare by Hp difference between AI amp its opponenent, I would choose state 2 since AI lost less Hp than in state 1. Running the simulation after state 1 and 2 will continue to show the same difference since after that point, both unit can only use one attack. In the end, it makes my AI choose a stupid move because she thinks she is less likely to loose selecting it. Granted both move will eventually result in the defeat of the AI since its main attack is weak but I'd like my AI to nonetheless select as its first move, her attack skill and not a skill that does nothing. I've tried weithing the overall gradient of score between the root state and the state I'm simulating by the number of turns but it does not work in all cases (it greatly depends on the number of turns and the difference between the root). I was thinking of adding Ap ratio to my evaluation of states but in that example, we can see that in State 1 amp 2, units are at the same AP anyway so it doesnt provide extra informations. Anyone got ideas on how to compares my states from different turns ?


Player experience using a server in single player adventure to prevent cheating I'm making a game where the user can sell items he finds during the the "single player" adventure on an online, I was looking at ways to prevent any malicious user to create rare and expensive items from scratch to sell them on the net. I tried obfuscation but soon or later someone will successfully break into my code and I can't afford that, for obvious reasons. Items are stored in files, so I thought about making client add a digital signature to generated files but I have to keep the key on the client machine, so same problem if someone finds his key he can apply digital signature algorithm to generate the valid key for any file he creates. So I ended up think the only secure option was to make the single player adventure interact with the server (everyone around here tends to say this is the way to go, like this subject, in my opinion the accepted answer explains it well). But what about the user friendly aspect? My game is divided in two parts. Firstly the "real" single player adventure, where you can cheat all you want because everything is stored on your pc and server won't ever use it ( 24h), then you beat the final boss and you're notified you're able to go online to battle against other players with the stuff you acquired on the single player map. At this point of the adventure, my idea was to record everything the player is doing in singleplayer mode onto the server, so whenever he plays a tournament, his stuff is verified. I can't verify stuff just before a tournament begins because overpowered items can be obtained but are very rare, I want to systematically know if it was hardly obtained or cheated. Do you think it would be acceptable for a player to play "single player mode using internet" if he was told this will allow him later to rank up online and be The single player map will be kind of mixed with the multi player area, but maybe I can think about a feature to play totally offline but then you won't be able to use your "online items" during this time. EDIT My app might outputs txt file (representing an item) with its corresponding digital signature, so I just need a way to be sure that it's my app (and not a modified copy) that has created a given file. That's why I'm reading about Trusted computing and Memory curtaining right now, but maybe I should head to security.stackexchange?


Creating Level iPhone I am thinking about a new game idea for the iPhone and presumably all the levels would have to be made programatically. So Im wondering what the best method to approach it? Say I have a game with a standard typical 2d, top down maze. Thise maze is simply made up of walls, multiple rectangles on screen, making paths. Do I have to manually work out the position of every rectangle and put it in with an x and y position or is there a better way? I see this taking, forever, there must be certain ways developers approach these situations to get by them efficiently and quickly surely? Thanks.


How to design simple turn based combat system with multiple difficulties? I am developing a small, turn based game with spaceships. The user controlled spaceship has two modes, let's call them offense and defense mode. The user can freely switch between modes. There are three types of enemy ships. Whenever the user's ship meets one or more enemy ships, a fight calculation should take place, which can have exactly two outcomes either the user's ship wins (and does not carry away any damage), or the game is over. Encounters are kinda, but not completely random so one can expect a certain enemy and change the mode accordingly. For reference, multiple enemy encouters at once might happen, and as a rough idea, the userShip usually is expected to lose if it has to fight 2 5 enemies. Like 2 are too much, if the active fight mode is disadvantageous, whereas the userShip can win against up to four ships, if the mode is advantageous. For encounters with multiple enemy types, the numbers shall be somewhere in between. My requirements for the combat system are completely deterministic one mode must not be clearly superior to the other mode. Ideally, one mode is advantageous against a certain enemy type, while the other mode is advantageous against another enemy type (not sure what to do about the third enemy type though) must be somehow scaleable, i.e. there should be three difficulty settings which shall be taken into account. ships have three attributes Attack, Defense, Speed (however, this isn't set in stone and could be changed at will) My best idea so far assign each ship type base stats (Attack Defense Speed, floating point numbers) userShip (10 10 10) enemy 1 (5 10 15) enemy 2 (15 5 10) enemy 3 (10 15 5) create a modifier table that multiplicates the userShip baseStats with a multiplicator depending on a) userShip mode and b) enemyShip type. have the combat system compare each of the three stats (if multiple enemies involved, their combined strength), and depending on the difficulty setting, the userShip wins if the difference of at least 2 of the 3 attributes is smaller than . That way, I would have the scalability. However... I was unable to design the modifier table in a way that the modifiers actually make a noticeable difference AND the user has an incentive to switch between modes when he expects a certain enemy in the next turn. The biggest problem is the nature of the binary combat outcome. This makes it that the floating point multiplicators neglegible most of the time. Also, I feel like I have way too many parameters (fight mode, attack, defense, speed, difficulty setting, modifier) for such a simple calculation, but I cannot really remove any other than the modifier, and they all should be at least a little bit relevant for the combat outcome. Also, I'm not sure how to deal with the third ship type, as there only are two modes. If the mode does not matter at all, that's poor design I think. I could add a third mode for the userShip, however that would introduce even more parameters for the combat. Unsure about that. Any ideas how to design a combat system under these conditions?


How would you define this mechanic in narrative based games? I'm a researching a certain game mechanic that seems very commonplace in modern narrative based games. The mechanic is defined (by me) as a user action that the player can take while in a dialogue or a cutscene, which affects the course of the narrative (and sometimes has a long lasting impact on the game progression in general). The interaction can be of several types press a button click a character hit a sequence of keys button mashing. Here's an example from Game of Thrones https www.youtube.com watch?v ykq213pPD6Q amp feature youtu.be amp t 181 In Mass Effect it is referred to as an interrupt https www.youtube.com watch?v 9TgTLJXoD o Here's one from King's Quest https www.youtube.com watch?v KhOkqn6qE2g I'm looking for more info on this type of mechanic. Specifically Is there an accepted name for it? What other games have this mechanic, and use it in an interesting way? (I would appreciate links to videos demonstrating it) What types of interactions (such as the ones I've described) have you seen implemented in this mechanic? Thanks ) (BTW if you think this game design related question is more suitable for StackExchange's Arqade do let me know and I'll ask to move it there)


What are the other three "game dynamics"? Seth Priebatsch recently gave a tedtalk entitled Building the game layer on top of the world. In it, Seth described four game dynamics, techniques used by game designers to make games fun and addictive. The four dynamics that Priebtsch described were Appointment dynamic a dynamic in which to succeed, one must return at a predefined time to take a predetermined action. (Real life example happy hour) Influence and status the ability of one player to modify the behavior of another's actions through social pressure. (Example different color credit cards as a reflection of status) Progression dynamic a dynamic in which success is granularly displayed and measured through the process of completing itemized tasks. (Example linkedin profile progress bar) Communal discovery a dynamic wherein an entire community is rallied to work together to solve a challenge. (Example finding interesting content on Digg.com) Seth explained these four game dynamics in his talk and added that his company has an additional three. Does anyone know (or have any theories) about what the other three game dynamics are?


How do you handle loss aversion in probability based games? The psychological phenomenon of loss aversion refers to how players feel losses twice as powerfully as victories. For example, Bite Fight's PvP is a simulation based on probabilities related on character skills, and players voice this feeling many times per week in the community forums. If you don't want to create a pay to win game, but you do want to let the worst players win often enough to feel good about it, how can you do that? The question has two parts How do you handle it technically? Do you use some kind of math techniques or a memory based simulation to avoid many loses in the row for a certain player? How do you handle it from the community point of view? What do you do about complaints like this on public forums?


Huge procedurally generated 'wilderness' worlds I'm sure you all know of games like Dwarf Fortress massive, procedural generated wilderness and land. Something like this, taken from this very useful article. However, I was wondering how I could apply this to a much larger scale the scale of Minecraft comes to mind (isn't that something like 8x the size of the Earth's surface?). Pseudo infinite, I think the best term would be. The article talks about fractal perlin noise. I am no way an expert on it, but I get the general idea (it's some kind of randomly generated noise which is semi coherent, so not just random pixel values). I could just define regions X by X in size, add some region loading type stuff, and have one bit of noise generating a region. But this would result in just huge amounts of islands. On the other extreme, I don't think I can really generate a supermassive sheet of perlin noise. And it would just be one big island, I think. I am pretty sure Perlin noise, or some noise, would be the answer in some way. I mean, the map is really nice looking. And you could replace the ascii with tiles, and get something very nice looking.


What is the difference between dynamic generation and procedural generation ? When I think of a dynamically generated game, I think of things like Diablo with randomly generated levels. When I think of a procedurally generated game, I think of things like Flappy Bird and other infinite runners. But both of these just randomize a level. Is it that procedurally generated games are constantly being generated and dynamically generated games are all generated up front? Or are these terms interchangeable? What is the difference between a dynamically generated game and a procedurally generated game?


How to build a better game save? I am making a roguelike card game like dream quest, and I want to improve my dungeon level save method. Here's what my levels look like I checked dream quest saves but I don't like their method because it uses a simple text file for all the information. it's also really messy, repetitive and not extendable. I used the format below for the first couple of months "Wall", "Wall", "Room", "Room", "Room", "Merchant", "Room", "Room", "Wall", "Wall", , "Wall", "Wall", ... But at the time I did not have multiple enemies, merchants, items. I simply read the file by using an enum which matched the strings used in the save format (item, enemy, merchant etc.) then passed them into an array to create the board. As I started to create different kinds of enemies, items, and merchants, my current game wouldn't support this. I don't want to create an enum like enemy1, enemy2, enemy3 ... How can I improve the scalability amp legibility of this save game format, so I don't have to keep adding new enum categories for each variety of content?


Generating a set of islands in real time With thismethod I can create multiple separated islands just by randomly choosing a point as the center for a gradient. Now what I want to do is to have a system of real time generation like the one in Minecraft. When I generate a new chuck, some random points inside of it are chosen to be the center of a gradient. However, if one of these points gets positioned near the border of the chuck, the gradient will cross the border and affect the other chunk. But if that other chunk was already generated and visited by the player, I couldn't update that chunk to include the new gradient, so I would end up with something that looks like this What could be a method to avoid this?


Town generation algorithms In this RPG.SE post a long lost page with several online generators is mentioned. I'm particularly curious about the way towns were generated. Take this image for example Although a lot of things could be improved graphics wise, it was very good considering the tools available at the time (mid to late 90s) The road layout seems fairly organic (even considering all roads are placed in an orthogonal manner). Not all roads are necessarily connected, but it feels right. Buildings are placed in believable spots. Even trees seem to be placed in logical spots. I think it would be fun to give it a shot and try it myself. Especially since my previous attempts have been too quot blocky quot You'll notice that I'm describing many of the qualities with not quite measurable adjectives (seems, feels, believable, etc) so I'm having a hard time translating them to instructions and ultimately to an algorithm. Are there any tried and true algorithms for town generation? I understand this seems to be too broad, so consider this If I asked for an algorithm for generating maps of continental land masses, I'd get references to Perlin and other noise algorithms right away closely followed by Voronoi. I've seen questions like this one but they seem to have a more concrete idea already in mind (ie 2x2 houses, fixed number of houses, canal and road placement restrictions). What I'd like to have is something less constrained. Except maybe for the grid layout, which should be a lot easier for a first attempt than, say, L system.


Workflow for creating spherical heightmaps I'm wondering how I can create a spherical heightmap. In my ideal workflow, you'd see a 3D sphere that you can edit using procedural terrain techniques (like World Creator) and that spherical terrain can be exported into six seamless images based on what layout you want your images to fold up into a cube in game to create your planet. Another option would be if you can at least tell the program you want specific images to tile with other images, such as the designated 'front, right, back, left' images tile with each other and the 'up, down' images seamlessly. Specifically, I'm making planets for a game that wraps six images into a cube and 'inflates' them into a planetary terrain. I've made a few basic heightmap sets in a program called Scape, and flipped them so at least four of the images mirror each other, then I edited the interior of those maps to all be different so the landscape isn't repetitive. However, manually editing the top and bottom maps is very daunting to get perfect, and I'm creating a dozen or more planets. I'd like to know how to make 'front, right, back, left' images tile with 'up and down' images and I can edit the interiors of the images in a 3D program of choice. I've been directed to this site from search queries many times, but I'm a newbie to all things code so I have no clue how to use things such as the Diamond Square method or any algorithms to achieve seamless textures (what program do you actually use, literally a python script you write in Notepad or something?).


Floating point determinism with respect to procedural generation, clustering and GPU offloading I've been designing a distributed procedural generation system for a while now in my spare time and one of the problem's I've been thinking about recently, with respect to the broader architecture, is that of floating point determinism inconsistency when you can't ensure that you have a homogeneous cluster of machines running a persistent world. Part of my design requires that any given machine can regenerate procedural content as needed, allowing for unimportant but resource hungry content to be destroyed and recreated as needed on whatever machine is available to do the work. I have been running on the basic idea that I will use high precision 32 64 bit integers for most things, and that generally works fine, but the standard coherent noise algorithms all use floating point values in their calculations. Do I need to implement custom non floating point versions of all those algorithms (i.e. using longs) or is there a better approach? Should I be using fixed point types for this kind of thing, and if so, how does that impact my desire to have the option to offload some of the PCG work to the GPU, when possible? Also, are fixed point types fast enough for heavy use within a game engine? Can I ignore floating point precision issues if I can get away with a maximum level of precision? i.e. If I'm happy to use no more than, say, six decimal places of a result, does that keep me safe across different machines and architectures? Note my engine is purely the simulation side of things. It doesn't matter to me if there are slight rendering inconsistencies when a user is playing the game all that matters is that the procedurally generated source data is consistently regenerated no matter which machine in a cluster is doing the work.


FMB alteration based on derivative and noise value I'm still working on my procedural terrain generation and kind of sniffing ideas from Sean Murray (No Mans Sky programmer). So I watched this GDC17 presentation, but some things just don't make sense to me Altering amplitude based on currentGain AND noise value? This just makes all heights (large noise val like 1) do no alteration and the small ones to make the amplitude really tiny. How does that represent Altitude Erosion? The audio also doesn't help much, has he isn't going into code detail. Any ideas to makes sense out of this?


2D Procedural resource generation I'm currently building a Mars colonization game and I'm wondering if anyone can point me to resources on how to procedurally create resources and biomes within a 2d game. Much like in a game like Factorio were different resources and such are spread around the map. Thanks in advance!


2D Car Simulation with Throttle Linear Physics I'm trying to make a simulation game for an automatic cruise control system. The system simulates a car on varying inclinations and throttle speeds. I've coded up to the car physics but these do note make sense. The dynamics of the simulation are specified as follows a V' V T (k1)V (k2) ma V' (1 (k1 m) V) T ( k2 m) Where T throttle position k1 viscous friction V speed V' next speed angle of incline k2 m g sin a acceleration m mass Notice that the angle of incline in the equation is not chopped up by sin or cos. Even the equation for acceleration isn't right. Can anyone correct them or am I misinterpreting the physics? Source "scribd.com doc 105335356 124 INDUSTRIAL APPLICATIONS" Page 508. Number 13.2.


How can velocity be normalized after a collision if a projectile needs to maintain its height? I want a thrown disc to travel along the same height, even after collisions. The problem is, there's an edge case that I'm not sure how to deal with. The lowest tech solution would probably be to quickly interpolate the rotation of the disc so that it's flat, and also interpolate its height so that it never collides with another object in a way that would impact its height, but that might be a bit heavy handed. I worry that it would look really bad if you're holding the disc at an angle when releasing it for a throw, and it just suddenly "swooshes" flat mid flight. Would that seem janky? If I don't do that, and I simply retain the disc's rotation as it flies along its path, then it might collide with an object's edge in a way where the correct bounce angle would send it upwards or downwards, which I don't want. But if I simply hard code the y velocity to 0, then in those instances, the lateral velocity becomes very low. Should I just check for a "minimum" speed, and increase it to that if it falls below that? Because the issue is that in the case where it bounces upward, there's a good chance that the correct bounce angle, if the y velocity is ignored, results in the disc continuing in the same direction rather than bouncing. So I'm honestly leaning towards extending the collision boxes for these objects really far above and below where the disc could possibly be thrown, that way regardless of its orientation, it would always be the side of a cylinder colliding either with the side of a box or one of its vertical edges, and the velocity change should thus (hopefully) always look like it makes sense.


How can I resolve collisions a little better? I'm currently developing a physics engine and I'm not sure the best way to go about resolving my problem. I have a little box, that I can move around with in my scene. When I'm resolving collisions, I take in the two bodies that are colliding, determine what both of their normal forces are and apply it to them (I also multiple it by a small number, if I don't I can't continue to walk around the scene). Anyways, while I'm resolving the collision I do this a.Position a.Velocity b.Position b.Velocity I know this isn't a very good way to resolve the collision, but I'm just not sure how to do it correctly. How should I go about resolve collision correctly? Also, here is the whole method I use to resolve collision at the moment private void ResolveCollision(Body a, Body b) Calculate normals forces (N M G) Vector2 normalForceA this.CalculateNormalForce(a) Vector2 normalForceB this.CalculateNormalForce(b) Resolve collision, which is super buggy and obviously a bad idea. a.Position a.Velocity b.Position b.Velocity Apply normal forces a.ApplyForce( normalForceA 11) b.ApplyForce( normalForceB 11) EDIT This is for a 2D game. EDIT Here is a video of what's going on when I applied TomTsagk's answer. The video is here


Box2D Asteroids Like Spaceship Physics I'm new to Box2D (JavaScript) (and the world of physics mathematics) so I'm having a hard time working out the methods I need to use to make a spaceship act like it does in the classic arcade game Asteroids. I've tried varying methods and nothing works quite right (as I obviously don't understand what I'm doing). For example, in Asteroids you can rotate the ship but it turns at a constant rate and won't continue to spin after you let go of the key, unlike the rest of the ship's physics. So I tried SetPositionAndAngle(position, angle 0.1) as an example to make the ship turn without having it rotate after key up, however when I then press the up key to make the ship go forward, it turns left as well as going forwards (via ApplyForce). Can anybody give some tips on how I should be dealing with Asteroids type spaceship physics?


What is a simple deformer in which vertices deform linearly with control points? In my project I want to deform a complex mesh, using a simpler 'proxy' mesh. In effect, each vertex of the proxy collision mesh will be a control point bone, which should deform the vertices of the main mesh attached to it depending on weight, but where the weight is not dependant on the absolute distance from the control point but rather distance relative to the other affecting control points. The point of this is to preserve complex three dimensional features of the main mesh while using physics implementations which expect something far simpler, low resolution, single surface, etc. Therefore, the vertices must deform linearly with their respective weighted control points (i.e. no falloff fields or all the mesh features will end up collapsed) as if each vertex was linked to a point on the plane created by the attached control points and deformed with it. I have tried implementing the weight computation algorithm in this paper (page 4) but it is not working as expected and I am wondering if it is really the best way to do what I want. What is the simplest way to 'skin' an arbitrary mesh, to another arbitrary mesh? By skin I mean I need an algorithm to determine the best control points for a vertex, and their weights.


Box2d Body to follow mouse movement I am trying a box2d body to rotate following the mouse. Here's an image to clarify what I mean. The red and blue circles are current point of the mouse and the body (of corresponding color) moving rotating to follow it. Basically the rectangle should rotate with its one end pointed towards where the mouse pointer is. Here's my code so far, World world Body body, bullet Box2DDebugRenderer debugRenderer OrthographicCamera camera Override public void create() world new World(new Vector2(0, 0f), true) debugRenderer new Box2DDebugRenderer() float w Gdx.graphics.getWidth() float h Gdx.graphics.getHeight() BodyDef bodyDef new BodyDef() bodyDef.type BodyDef.BodyType.DynamicBody bodyDef.position.set(10, 10) body world.createBody(bodyDef) PolygonShape shape new PolygonShape() shape.setAsBox(2, 5) FixtureDef fixtureDef new FixtureDef() fixtureDef.shape shape fixtureDef.density 1f Fixture fixture body.createFixture(fixtureDef) shape.dispose() Gdx.input.setInputProcessor(this) camera new OrthographicCamera(200, 100 (h w)) camera.position.set(camera.viewportWidth 2f, camera.viewportHeight 2f, 0) camera.update() Override public void render() Gdx.gl.glClearColor(1, 1, 1, 1) Gdx.gl.glClear(GL20.GL COLOR BUFFER BIT) world.step(Gdx.graphics.getDeltaTime(), 6, 2) camera.update() debugRenderer.render(world, camera.combined) Override public boolean mouseMoved(int screenX, int screenY) int mouseX screenX int mouseY Gdx.graphics.getHeight() screenY float rotateAngle MathUtils.radiansToDegrees MathUtils.atan2((float) mouseY (float) body.getPosition().y, (float) mouseX (float) body.getPosition().x) body.setTransform(body.getPosition(), rotateAngle 57.2957795f) return true And here's a gif of how it appears now. as you can see the body gets skewed and also doesn't rotate properly. What am I missing?


Build a convex hull from a given mesh in Bullet According to this tutorial, a convex hull is the most accurate shape one can build from a mesh? I have two questions regarding this How do I build a convex hull from a given, complex mesh in Bullet? Should this be done offline? How do most people do this? (that is, create a collision shape from a mesh in games)


Precision problem when doing collision detection? I've got this problem, and I don't know what may be the cause of it. I finished reading this article on sphere triangle collision. My character (the sphere) stops before it reaches the triangle, and then over like 2 seconds it slowly reaches the "expected" spot where I really want it to stop. Thing is, I tried switching my whole algorithm from floats to doubles, and they problem stays. So I'm not really sure if that's a number precision problem, although after many debugging I think that there could be a problem with the precision of the next calculation (t0 and t1) Real signedDistToTrianglePlane trianglePlane.signedDistanceTo(colPackage gt basePoint) Real normalDotVelocity glm dot(trianglePlane.normal(),colPackage gt velocity) t0 ((Real) 1.0 signedDistToTrianglePlane) normalDotVelocity t1 ((Real)1.0 signedDistToTrianglePlane) normalDotVelocity Could the dot product function be a trap for precise calculations? (signedDistanceTo() uses glm dot as well) Here's my collision detection amp response algorithms. One last thing to note is that on page 47 in the article, the author uses a verySmallDistance number where he only updates some variables if distanceToCollision is bigger than it. I don't understand these lines. I've been struggling with this issue for a week now. Any help or idea on the subject will be highly appreciated!


multiplayer networking with physics I'm curious how multiplayer networking with physics is implemented in racing games. We have a physical world with multiple fast moving vehicles controlled by different people. Let's say that vehicles have weapons and can shoot each other (Twisted Metal, Vigilante v8) I'm anxious about hits and collisions. Authoritative server or a better alternative?


What to call an Object that falls only when it's collided with? I am currently working on Objects Blocks for my 2D Jump'n'Run. Now I want to add a new type of block, which falls down only if the player an actor collides with it. But I don't know what to call this type. Or more generally Objects that only do stuff change behaviour if interacted with. How should I name the first type and the second more general type?


Android 2d scrolling background I am a very beginner in game development. All I want to achieve in the beginning is a free scrollable background like in a strategy game with my custom graphics. In my case it is supposed to be a 2d city map where the user can select buildings. How can I achieve that as easy as possible in android? With OpenGL? Die you have any examples especially for this scrolling functionality?


How do I store level data in Android? I'm building a game where enemies come in waves. I want to create a file where I can define data about the waves ( of enemies, spawn times, speeds, etc.). I come from a background in iOS and would normally use something like a plist. What would be the best way to do something like this in Java and Android?


how to play a video with Android or AndEngine I don't know if it's possible to show a video like the videos in Angry Birds (Something in Flash or another format) in middle of a game with Android or AndEngine or are they animations what they are made with Sprites and a more programming process?? How do they show those videos?


How do I find an optimal FPS for best user experience while preserving battery life? I'm developing an Android game. The "graphics" I'm using need little CPU GPU, so they run with high FPS. Because saving energy is important on Android devices, I want to limit frame rate (if deltaTime lt limitDeltaTime gt Thread.sleep(...) ). How high should the frame rate be to get an optimal balance between saving resources and a "fluid" gameplay experience. At which point is the user experience optimal or no longer improving?


What's wrong with this Open GL ES 2.0. Shader? I just can't understand this. The code works perfectly on the emulator(Which is supposed to give more problems than phones ), but when I try it on a LG E610 it doesn't compile the vertex shader. This is my log error(Which contains the shader code as well) EDITED Shader uniform mat4 u Matrix uniform int u XSpritePos uniform int u YSpritePos uniform float u XDisplacement uniform float u YDisplacement attribute vec4 a Position attribute vec2 a TextureCoordinates varying vec2 v TextureCoordinates void main() v TextureCoordinates.x (a TextureCoordinates.x u XSpritePos) u XDisplacement v TextureCoordinates.y (a TextureCoordinates.y u YSpritePos) u YDisplacement gl Position u Matrix a Position Log reports this before loading compiling shader 11 05 18 46 25.579 D memalloc(1649) dev pmem Mapped buffer base 0x51984000 size 5570560 offset 4956160 fd 46 11 05 18 46 25.629 D memalloc(1649) dev pmem Mapped buffer base 0x5218d000 size 5836800 offset 5570560 fd 49 Maybe it has something to do with that men alloc? The phone is also giving a constant error while plugged ERROR FBIOGET ESDCHECKLOOP fail, from msm7627a.gralloc Edited "InfoLog " refers to glGetShaderInfoLog, and it's returning nothing. Since I removed the log in a previous edit I will just say i'm looking for feedback on compiling shaders. Solution More questions Ok, the problem seems to be that either ints are not working(generally speaking) or that you can't mix floats with ints. That brings to me the question, why on earth glGetShaderInfoLog is returning nothing? Shouldn't it tell me something is wrong on those lines? It surely does when I misspell something. I solved by turning everything into floats, but If someone can add some light into this, It would be appreciated. Thanks.


openGL ES change the render mode from RENDERMODE WHEN DIRTY to RENDERMODE CONTINUOUSLY on touch i want to change the rendermode from RENDERMODE WHEN DIRTY to RENDERMODE CONTINUOUSLY when i touch the screen. WHAT i Need Initially the object should be stationary. after touching the screen, it should move automatically. The motion of my object is a projectile motion ans it is working fine. what i get Force close and a NULL pointer exception. My code public class BallThrowGLSurfaceView extends GLSurfaceView MyRender renderObj Context context GLSurfaceView glView public BallThrowGLSurfaceView(Context context) super(context) TODO Auto generated constructor stub renderObj new MyRender(context) this.setRenderer( renderObj) this.setRenderMode(RENDERMODE WHEN DIRTY) this.requestFocus() this.setFocusableInTouchMode(true) glView new GLSurfaceView(context.getApplicationContext()) Override public boolean onTouchEvent(MotionEvent event) TODO Auto generated method stub if (event ! null) if (event.getAction() MotionEvent.ACTION DOWN) if ( renderObj ! null) Log.i("renderObj", renderObj "lll") Ensure we call switchMode() on the OpenGL thread. queueEvent() is a method of GLSurfaceView that will do this for us. queueEvent(new Runnable() public void run() glView.setRenderMode(RENDERMODE CONTINUOUSLY) ) return true return super.onTouchEvent(event) PS i know that i am making some silly mistakes in this, but cannot figure out what it really is.


Rotating each quad in a batch separately? Background In my app I use the following code to rotate my quad Code Rotate the quad Matrix.setIdentityM(mRotationMatrix, 0) Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f) Matrix.rotateM(mRotationMatrix, 0, angle, 0, 0, 0.1f) Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f) And then apply the matrices Combine the rotation matrix with the projection and camera view Matrix.multiplyMM(mvpMatrix2, 0, mvpMatrix, 0, mRotationMatrix, 0) get handle to shape's transformation matrix mMVPMatrixHandle GLES20.glGetUniformLocation(iProgId, "uMVPMatrix") Apply the projection and view transformation GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix2, 0) The above code works great when I'm drawing single quads. Problem However, if I have a few quads with the same texture to draw, I batch them up and draw them with one call to glDrawArrays. I can't work out if it is possible to rotate each individual quad before drawing them (or how to do it if it is possible) I realise, they will all be rotated the same amount at the same time but this isn't an issue). Rotation method public void rotateBatchQuads(int coordinates, int angle) for (x 0 x lt coordinates.length x 2) Center of quad (Along the x) float centreX coordinates x quadWidth 2 Pseudo code float centreY coordinates x 1 quadHeight 2 Pseudo code Center of quad (Along the y) Rotate the quad Matrix.setIdentityM(mRotationMatrix, 0) Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f) Matrix.rotateM(mRotationMatrix, 0, angle, 0, 0, 0.1f) Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f)


How to fit a bitmap to a random size rect so it does not strech? (Android Studio) I'm trying to fit a bitmap to a random size rect but I don't want the bitmap to be streched out. I've tried using BitmapShader and tile it but it become animated and not fixed. Here is my code without BitmapShader. public void draw(Canvas canvas) Paint paint new Paint() canvas.drawBitmap(spike1, null, rectangle, paint) canvas.drawBitmap(spike1, null, rectangle2, paint) Here is my code with BitmapShader. public void draw(Canvas canvas) Paint paint new Paint() paint.setShader(new BitmapShader(spike1, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT)) canvas.drawRect(rectangle, paint) canvas.drawRect(rectangle2, paint) Here is a picture of my problems Can somebody tell what I need to do so the image is fix but not stretched?


How do i update opengl lightning equation in my fragment shader to make my texture less glossy and more like a fabric I built a model in blender, and am currently trying to import it into my android app using assimp together with opengl, i dont have any issues with the importing but my goal is to make the object look realistic as possible, and this is where my problem lies...I have implemented normal mapping using both the diffuse and normals of my texture but after rendering it the objects looks smooth and glossy, yes the bumps were rendered well and i like it but i need the material to look more like a fabric (cloth textile), please how can i do this? do i need to update my lighting equation or the issue is with my original diffuse texture? Here is my original diffuse texture Here is my rendered model Here's my fragment shader void main() obtain normal from normal map in range 0,1 vec3 normal texture2D( normalMap, textureCoords ).xyz transform normal vector to range 1,1 normal normalize(normal 2.0 1.0) this normal is in tangent space get diffuse color vec3 color texture2D( textureSampler, textureCoords ).xyz ambient vec3 ambient 0.1 color diffuse vec3 lightDir normalize(tangentLightPos tangentFragPos) float diff max(dot(lightDir, normal), 0.0) vec3 diffuse diff color specular vec3 viewDir normalize(tangentViewPos tangentFragPos) vec3 reflectDir reflect( lightDir, normal) vec3 halfwayDir normalize(lightDir viewDir) float spec pow(max(dot(normal, halfwayDir), 0.0), 32.0) vec3 specular vec3(0.2) spec gl FragColor vec4(ambient diffuse specular, 1.0) Here's my vertex shader mat3 transpose(mat3 m) return mat3(m 0 0 , m 1 0 , m 2 0 , m 0 1 , m 1 1 , m 2 1 , m 0 2 , m 1 2 , m 2 2 ) void main() gl Position mvpMat vec4(vertexPosition, 1.0) vec3 fragPos vec3(model vec4(vertexPosition,1.0)) vec3 T normalize(normalMatrix tangent) vec3 N normalize(normalMatrix normal) T normalize(T dot(T, N) N) vec3 B cross(N, T) mat3 TBN transpose(mat3(T, B, N)) values for fragment shader tangentLightPos TBN lightPos tangentViewPos TBN viewPos tangentFragPos TBN fragPos textureCoords vertexUV


Phone complains that identical GLSL struct definition differs in vert frag programs When I provide the following struct definition in linked frag and vert shaders, my phone (Samsung Vibrant Android 2.2) complains that the definition differs. struct Light mediump vec3 position lowp vec4 ambient lowp vec4 diffuse lowp vec4 specular bool isDirectional mediump vec3 attenuation constant, linear, and quadratic components uniform Light u light I know the struct is identical because its included from another file. These shaders work on a linux implementation and on my Android 3.0 tablet. Both shaders declare "precision mediump float " The exact error is Uniform variable u light type precision does not match in vertex and fragment shader Am I doing anything wrong here, or is my phone's implementation broken? Any advice (other than file a bug report?)


2D platformers why make the physics dependent on the framerate? "Super Meat Boy" is a difficult platformer that recently came out for PC, requiring exceptional control and pixel perfect jumping. The physics code in the game is dependent on the framerate, which is locked to 60fps this means that if your computer can't run the game at full speed, the physics will go insane, causing (among other things) your character to run slower and fall through the ground. Furthermore, if vsync is off, the game runs extremely fast. Could those experienced with 2D game programming help explain why the game was coded this way? Wouldn't a physics loop running at a constant rate be a better solution? (Actually, I think a physics loop is used for parts of the game, since some of the entities continue to move normally regardless of the framerate. Your character, on the other hand, runs exactly fps 60 as fast.) What bothers me about this implementation is the loss of abstraction between the game engine and the graphics rendering, which depends on system specific things like the monitor, graphics card, and CPU. If, for whatever reason, your computer can't handle vsync, or can't run the game at exactly 60fps, it'll break spectacularly. Why should the rendering step in any way influence the physics calculations? (Most games nowadays would either slow down the game or skip frames.) On the other hand, I understand that old school platformers on the NES and SNES depended on a fixed framerate for much of their control and physics. Why is this, and would it be possible to create a patformer in that vein without having the framerate dependency? Is there necessarily a loss of precision if you separate the graphics rendering from the rest of the engine? Thank you, and sorry if the question was confusing.


Making Edges of Hand Drawn Tileset Match Up I'm making a tile based platformer. A friend at college is doing all my art, and so far it's beautifully hand drawn. The problem is, I can't seem to make the edges of the tilesets match up. He measures them meticulously to get sections to match up, but, due to variations in his art medium, tiles that aren't next to each other in his drawing don't match up. For example, he's drawn a basic 9 slice tileset, and the top to center, left top to left center, right top to right center, etc. all connect perfectly because they're touching each other in his drawing. But when I clip the tiles apart and put them together in other variations or try to put other "change up" tiles together (any tile that wasn't touching in his drawing), the larger features fit together because of his measurements, but you can see an obvious seam where they join. I've been using the heal tool in my graphic editor to fix the seams and re export the tiles with edited edges to fit together correctly, and it works well, but when I heal the edges for one seam, it makes another seam appear. Note I don't want a solution to fix the seams at runtime using graphical filter magic or something on the code side. I'm looking for a solution to process the images and export them so that they fit together. EDIT Here's one of the tiles for reference. It tiles along the bottom of a block of stone. And here's a 9 slice thumbnail of an early stage of the tileset Edit again To be clear, it's not the big ish things (stone sides, grass, etc.) connecting that's my problem. My artist already measures everything to make it match up. It's the variations in shading and impreciseness of the physical medium that's the problem.


What does the term 'photorealistic' really mean? I was wondering about the term 'photorealistic' in regards to rendering and was wondering how this is used. Is it used to describe a shader (or set of) that have certain quantifiable features? Or any rendering thats not meant to be abstract, like the cartoon effect seen in Borderlands? Or is it just a subjective term meaning 'really really realistic'?


Creating graphics at different angles for sprites I am developing a Java game that uses sprites for the graphics. It's just a top down shooter and our ship sprites look like the following These work fine, but they're hard to create and the artist who created them is no longer working on the game. I could easily create a top down view of a ship in Photoshop myself, but I'm not sure how to get all the angles. What do you think would be the best program or approach would be for me to create more?


Why are huge polygon amounts bad? It is always said that the polygon amount of a single modell must be as little as possible when it comes to realtime simulations such as computer games. (Or at least lower than when rendering a movie) I am fully aware that this must be done in order to save performance. But aside from that information i cannot find why huge polygon amounts must be avoided. (In Short I know that polygons eat performance. I want to know why they eat performance) So my question would be What happens when a frame is rendered? The polygons are surely somehow processed in the graphicard. What happens there?. If possible i would like to have some links to sites containig this information.


Drawing the same mesh or drawing the same material? I was wondering. Suppose I have a 1000 grass meshes. They all have the same material, but I create them separately, because they look slightly different, because they have different heights. Does my GPU speed up if I only draw one mesh over and over again? Or is only the material switching and uniform setting the main problem? So Should I consider going to only one mesh a 1000 times, or is it ok to have a lot of different meshes with only the same material?


How many polycount for smartphone hardware starting from 2015? I already know that the answer is "depends". Depend if the hardware is low mid or high hend. So, I try to re formulate is 100K concurrent polycount in a 3d game for smartphone too much ? How many is it a good compromise ? Thanks


How do games deal with Z sorting partially transparent foliage textures? I was busy implementing basic transparency in a prototype I'm working on when something occurred to me. In order for a given texture's transparency to work as expected, the (semi )transparent texture must be drawn after whatever is behind it, right? Well, if we take for example a tree or shrub in a game like Skyrim, the texture(s) that make up the foliage on that tree or shrub must include some transparency somewhere, right? A vertex perfect leaf model would be far too resource intensive. But the player can move around, and sometimes through, any plant at will, thus changing the relative position of all textures to the camera. Doesn't this mean that the game has to constantly Z sort all textures, both between models and even within a single plant model, whenever the player moves (so potentially every single frame)? Isn't that very resource intensive? How do games with lots of partially transparent textures deal with this?


Gravity independent of game updates per second Edit Just for clarification, my sprite's 'movement' isn't the problem. If I set my Time variable to 4 seconds, then it will cross the screen in exactly 4 seconds regardless of logic updates rate per second, rendering rate per second or screen resolution. So I am pretty sure I'm scaling the sprite's movement correctly. What I'm pretty sure I'm not doing correctly, is scaling acceleration. Original Question I'm trying to implement gravity in my 2d platformer and am having a few problems understanding how to keep it consistent when I change my updates per second. Here's what I have. My Gameloop overview Currently, my gameloop renders at the maximum rate allowed by device and the updates are 'clamped' to an upper limit (At the moment, 60 per second). I am working on the assumption that most of the time, my game will have no problem hitting this, even if the actual rendering dips. Thus I am doing all of my calculations based Delta Time derived from this fixed 'ticksPerSecond' value. I don't know for sure that this will remain at 60, I may decide at some point during the development to lower this upper limit. My Gravity variable declaration and initial values At the moment, I have float spriteYTime 7f This is the (initial) amount in seconds that this sprite will take to move from the top of the screen to the bottom. float fallAccel .5 This is the value that will subtracted from he sprite's fall speed (To make it fall ever faster) float terminalVelocity 1.5f Cap speed at this rate (1.5 seconds) my sprite's position is worked out on dt as follows Delta time float ticksPerSecond 60 float dt 1f ticksPerSecond Velocity spriteYVel 1 spriteYTime Update position spriteYReal spriteYReal (spriteYVel dt) Convert to screen coordinates (will be drawn at this Y coordinate) spriteyScreen (int) (furmanYReal height) My Gravity code If my sprite's state is 'f' (meaning falling) then apply gravity if(sprite.getState('f') true) Calculate new position spriteYReal spriteYReal (spriteYVel dt) Convert to screen coordinates sprite.yScreen (int) (spriteYReal r.height) Reduce time by fallAccel amount amp update velocity value based on new time value (So sprite falls slightly faster this frame compared to the last spriteYTime fallAccel spriteYVel 1 spriteYTime Check that speed isn't faster than terminal velocity if (spriteYTime lt spriteVelocity) spriteYTime spriteVelocity The problem Now, this does work, but if I change my ticksPerSecond value, it goes wrong (it falls at different rates). I know that 'Earth Normal' gravity is approximately 9.8 meters per second per second, but this is measured 'per second' whereas I (think) I need to work with 'per frame'. This is where I'm getting confused. So, take this example If set my initial Time value to 4 seconds, then if it remained constant at this speed, it would take 4 seconds to reach the bottom, if I changed my ticksPerSecond, because the time value is worked out using delta, it would still take 4 seconds but if I apply 'fallAccel" to the Time value (i.e. subract it), it goes wrong when I change the ticksPerSecond value why? How can I get this to fall at the same rate regardless of the value of 'ticksPerSecond' any help in understanding this would be appreciated.


Geometry Shader and Stream Output with Directx11 I am having trouble trying to send verticies generated in the Geometry Shader to Stream Output. What I am trying to accomplish is to generate verticies from the Geometry Shader and store them to a vertex buffer so that I can use the vertex buffer to draw later. I read that I have to use the CreateGeometryShaderWithStreamOutput function to create a Geometry Shader that can send verticies to Stream Output instead of the rasterization stage. This is how I am trying to use it device gt CreateGeometryShaderWithStreamOutput(this gt mGSBlobSO gt GetBufferPointer(), this gt mGSBlobSO gt GetBufferSize(), so decl, 1, amp stride, 1, D3D11 SO NO RASTERIZED STREAM, NULL, amp this gt mGeometryShaderSO) I am getting an E INVALIDARG at this line. I am specifying D3D11 SO NO RASTERIZED STREAM because I think this means that I do not want to send data to the rasterizer but I am not sure. When I replace D3D11 SO NO RASTERIZED STREAM with a 0, I do not get this runtime error, but I do not get the result I want. How can I setup the geometry shader to store vertices to a vertex buffer in Stream Output?


Cocos2d Check if place is free before moving (all objects) Is there a method in Cocos2d like CGRectIntersectsRect, except instead of limiting it to one sprite, it checks for ALL objects?


Creating multiple fixtures in one body I want to create this type of fixture in one body. Here square and circle both are different fixtures but attach to one body. How do I do this?


What is the correct way of changing image of existing CCSprite? How do I correctly change sprite to show another image? Or to have another texture? This is the way I do it now. When I need to change sprite image I increase state variable. So i have one picture for 0, another for 1 and another for 2. First i tried just saying mysprite CCSpriteWithFile "sprite.png" but that didn't end up too well since I was making new objects every frame and it got messy pretty fast. So I added a check. There is another variable that is stateChanged and it starts at zero. So I compare state to stateChanged before actually making any sprites and if it differs I do the magic. But here comes the problem. Somehow this sprite won't flip. And I believe the problem is in this method. (void) updateState if (stateChanged ! state) if (state 0) currentSprite CCSprite spriteWithFile "eggclosed.png" self addChild currentSprite if (state 1) currentSprite nil self removeAllChildrenWithCleanup YES currentSprite CCSprite spriteWithFile "eggopen.png" self addChild currentSprite if (state 2) currentSprite nil self removeAllChildrenWithCleanup YES currentSprite CCSprite spriteWithFile "yoshi.png" self addChild currentSprite stateChanged state TLDR How to correctly change image of sprite. I have a Pet object that has a CCSprite property. And I sometimes need to change sprte to look another way. How do?