Page:43 - News Archived: 3437

Title Date
in-engine tool vs external tool - Link Wed, 02 Sep 2015 14:22:27

Im in the process of creating an RPG and recently discovered that I can extend unity3d editor to create tools inside it. Inmediatly I thought I could make my dialog editor inside unity but the lack of proper documentation and other considerations have cooled my entusiasm. Do you think it is a good idea My first approach was to code my dialog tool in CQt. The disadvantages are that I have to code the dialog parser again in C instead of reusing the game parser. Advantages it is engine independent. The Unity integrated tool has the disadvantage that documentation is scarce oriented to old style gui OnGUI based and the advantage is that it would be integrated in the engine if that is and advantage and reuse the dialog parser. What do you think about this

Feedback for a tree structure design - Link Wed, 02 Sep 2015 13:56:12

I currently have a SceneGraph which resembles a tree of SceneNodes where each SceneNode has its own vector of children. The terminology might be off but you get the point. This adds alot of indirection and jumping around in memory when traversing the tree. Im thinking of an alternate approach where all SceneNodes are stored in a single container and the only information each SceneNode has is its own parent. Then if the relationships between the SceneNodes change such as a new child is created or removed the SceneGraph is marked as dirty. Then once per frame if SceneGraph is dirty another data entity traverses the tree and for each SceneNode constructs an Iterator that can be used for traversing all immediate children. Since the children will probably be spread out in the container the Iterator needs some additional metadata rather than just beginend index to iterate correctly. Optionally one could also let this new data entity reshuffle the SceneNodes in the container each time it is dirty so that all immediate children are contigously placed infront of their parent using memcpy or similiar to move SceneNodes around. Since a SceneNode has no complex constructordestructor typically just a name some world transform data and ID of its parent it wouldnt be much of a problem. As for storing the iterators simply keeping a mirrored container and use the same index as the SceneNode in question to get its Iterator seems solid enough And so finally to traverse all immediate children of a SceneNode one just asks the SceneGraph for an Iterator for a particular SceneNode. Im mainly looking for some feedback. Is this a reasonable idea Would the gain of memory coherence plus nice decoupling of responsability compared to previous solution - each SceneNode is more dumb outweigh the cost of reconstructing the Iterator sets possibly but not probably each frame Is the memcpy option reasonable Any feedback is welcome

Fractal terrain generation on an hexagonal grid - Link Wed, 02 Sep 2015 13:24:41

Hello everyone Im generating a fractal terrain using Perlin noise for an RTS game and I want to make it look like the terrain in Civilization V Some of the key features that I want to extract from it are It has a pointy hexagonal grid. Each grid cell has a possible type Water Plains Hills or Mountain. One grid cell can only have one type. The terrain features are aligned to the grid. You can notice how the mountains are actually centered in their cell but also affect neighbor cells slightly. Its continuous You dont get the appearance of white noise in the terrain. There are no small islands spread all around or mountains in the middle of the ocean. Mountains are usually near hills which are usually near plains. My current approach is I generate a 64x64 Perlin noise texture where each pixel maps to a terrain type 0 0.3 is water 0.3 0.6 is plains and so on... I generate a 256x256 texture by interpolating some points in the middle of the Perlin noise texture using bicubic interpolation so everything is smoothed out and is continuous even in the first derivative. Then I apply the thresholding for the different terrain types I generate three 256x256 perlin noise textures for the different land types with different roughness I mix these with the landmass texture calculated in step 2 and blend them using linear interpolation. The end result might look something like this which needs tweaking but is promising The problem is The above procedure works for square-cell grids but I have an hexagonal grid. Ive tried the following approaches but none worked Triangulating the hexagons by making a triangle fan from the center. For the hexagon vertices I compute the average color of each of the three neighbors that touch it. Problem Its a linear interpolation and edges are noticeable in the final result. Also makes it necessary to guess the color of the hexagon vertices by calculating that average which might not be the color we are actually expecting in that point. Triangulating the hexagonal grid by joining the centers of the hexagons. Problem Its a linear interpolation again. Joining 4 hexagon centers into a quad unskewing it making a bicubic interpolation and skewing it again. Problem The terrain looks skewed and not really centerd on the grid cells. At this point Im pretty lost on what else to try to make it look like the one from Civilization V. Any ideas please Thank you Attached Thumbnails

How much work would be needed to port Android to a particular phone - Link Wed, 02 Sep 2015 06:55:03

Its a big topic I know but for some rough idea lets say you have a phone for which the manufacturer hasnt released a verion of lollipop for yet yet you have the latest linux kernel and the latest Android source well how much work is needed to port these two sources to a particular phone. You would need the correct drivers compiled into the kernel for that phone roughly how would you approrach the interface between the Android java source and the kernel then Is this a huge amount of work or has most of the work been done already

Write to a texture with a Compute Shader - Link Wed, 02 Sep 2015 02:06:15

I am struggling to see any data in a texture that I write to with a compute shader. The shader declares it as RWTexture2Dltfloat4gt OutputTexture registeru0 And writes some relatively arbitrary non-zero data to it. Ive set up aD3D12_UNORDERED_ACCESS_VIEW_DESCwith a Format ofDXGI_FORMAT_R16G16B16A16_FLOAT and a ViewDimension ofD3D12_UAV_DIMENSION_TEXTURE2D and passed the ID3D12Resource of a texture created with the same pixel format toCreateUnorderedAccessView. Ive calledCreateShaderResourceViewwith the same ID3D12Resource and tried to use the SRV to paint a quad that Im displaying. I see absolutely nothing. I know that if I load the texture with pixel data by more conventional means by loading it from an upload heap or rendering to it with a pixel shader it works just fine. But I cant figure out how to get the Compute Shader to have any effect on it

Code generation and entropy coder - Link Tue, 01 Sep 2015 23:37:10

Hi everyone Ive written a few blog posts that I thought might interest people around here one is about a code generator and the other is about entropy codingcompression. httpsworldoffries.wordpress.com20150901code-generator-and-other-fun-stuff httpsworldoffries.wordpress.com20150825simple-entropy-coder Enjoy

Steps for multi-platform - Link Tue, 01 Sep 2015 20:04:28

So I have a tiny game engine made in Java and it is solelyfor Android. I plan to go back and refactor adding features and what not. but one big thing I would like to do is make it multi-platform. Be able to code once and then build accross PC iOS Android etc I kind of feel like a whole rewrite will be needed. but Im wondering what would be the steps in order to do this make my engine multi platform I have a few ideas but Im not sure how correct they are 1. I would need to write my core classes in C C. Classes like Rectangle and its intersect method would fall under here. 2. Anything that would be platform dependant would have to be done in some native language. EG Android would be Java and iOS would be Objective-C. Things like using the Game Center or handling phone calls would fall here 3. If I wanted to use OpenGL would that fall under something I cold do under my core lib or would it have to be platform specific code

What is latest version of DXSDK - Link Tue, 01 Sep 2015 18:57:55

Hi all What is the latest version of DXSDK and where can I download it from a precise URL will be greatly appreciated Im creating a desktop application for Windows 8 using Visual Studio 2015with VC MFC. Best Regards STX970

How to add primitives to texture with occlusion testing - Link Tue, 01 Sep 2015 15:41:55

Hi This is my first post here sorry if this is the wrong place to ask. I am relatively new to opengl but have to use an old gl implementation which applies filtered blending to a given object. The result I get from this implementation is a texture drawn onto a screen quad. This texture has some black untextured holes in it. Therefore I rendered my model with a nice phong shading into the attached texture of a FBO I also attached a renderbuffer for depth. Then I wrote a shader which gets the greyshading texture and the black-hole-texture which I put into another FBOs texture to combine them and fill the holes with the grey shading texture. So now I have the wanted texture. This works fine so far but my next task is that I want to add primitives rectangles... to the scene. The problem here is that I need occlusion testing for those primitives to determine where they intersect with my previously rendered object. But since I only have a texture with no depth values at this moment I wonder where and how I could get the depth values from and how to do the occlusiondepth-testing. I thought about taking the depth values from the grey shading FBO since the model was rendered there with a renderbuffer depth attachment. Sadly I did not understand so far how this attached renderbuffer works and if there really are depth values in it which I could use for further rendering. Since I am not totally confident in my opengl skills and how this FBO of mine works with the depth attachment I want to show you the rough outline of the code I have right now. My greyshading FBO is created like this the FBO glGenFramebuffers1 mGreyShadingFBO glBindFramebufferGL_FRAMEBUFFER mGreyShadingFBO greyshading texture glGenTextures1 mGreyShadingTex glBindTextureGL_TEXTURE_2D mGreyShadingTex glTexParameteriGL_TEXTURE_2D GL_TEXTURE_MAG_FILTER GL_NEAREST glTexParameteriGL_TEXTURE_2D GL_TEXTURE_MIN_FILTER GL_NEAREST glTexParameteriGL_TEXTURE_2D GL_TEXTURE_WRAP_S GL_CLAMP_TO_EDGE glTexParameteriGL_TEXTURE_2D GL_TEXTURE_WRAP_T GL_CLAMP_TO_EDGE glTexImage2DGL_TEXTURE_2D 0 GL_RGB 640 480 0 GL_RGB GL_FLOAT 0 glFramebufferTextureGL_FRAMEBUFFER GL_COLOR_ATTACHMENT0 mGreyShadingTex 0 greyshading depth buffer glGenRenderbuffers1 mGreyShadingRB glBindRenderbufferGL_RENDERBUFFER mGreyShadingRB glRenderbufferStorageGL_RENDERBUFFER GL_DEPTH_COMPONENT 640 480 glFramebufferRenderbufferGL_FRAMEBUFFER GL_DEPTH_ATTACHMENT GL_RENDERBUFFER mGreyShadingRB Set the list of draw buffers GLenum DrawBuffers1 GL_COLOR_ATTACHMENT0 glDrawBuffers1 DrawBuffers I got most of this code from httpwww.opengl-tutorial.orgintermediate-tutorialstutorial-14-render-to-texture but since I have a relatively old ati graphics card I had to adjust some parts of the code. In that tutorial they talk about the depth values a bit but I just can not figure out how to get them in the first place and then how to get them into my a final FBO with my combined texture to add those primitives... Do I just have to attach another texture with glTexImage2D as GL_DEPTH_COMPONENT and it will be filled with depth values during rendering automatically I render into the greyShading FBO by glBindFramebufferEXTGL_FRAMEBUFFER_EXT mGreyShadingFBO glViewport0 0 640 480 glClearGL_COLOR_BUFFER_BIT GL_DEPTH_BUFFER_BIT glUseProgramgreyShadingProgram glEnableGL_DEPTH_TEST getMesh.render glUseProgram0 Then I combine the grey shading texture with the black-hole texture and draw it to the screen. glUseProgramfinalShaderProgram draws grey values instead of black at holes glBindFramebufferEXTGL_FRAMEBUFFER 0 glActiveTextureGL_TEXTURE0 glBindTextureGL_TEXTURE_2D mGreyShadingTex glActiveTextureGL_TEXTURE1 glBindTextureGL_TEXTURE_2D blackHoleTex drawScreenQuadinputWidth inputHeight glUseProgram0 Some questions occurred to me when looking on the code Does it make sense to do it like this or should I render the image into a renderbuffer instead of a texture Is the depth automatically stored into my renderbuffer with the depth attachment during rendering If yes how do I access it My plan was to attach the final texture instead of drawing it to the screen to a FBO and add the depth to this FBO as well to be able to add those primitives with depthocclusion testing. But as said I neither understand how to get the depth information nor how to use it for adding my primitives. Let me know if some pictures or more code would help to get a clearer picture of my problem. Hope you can point me into the right direction on how to add some primitives to the given texture while doing the depthocclusion testing with the model where I got the texture from. Thanks in advance. And thanks for all the information I already got from this community. PS any ideas why the site for writing topicsreplying to messages on gamedev is totally messed up on my chrome and i have to use the IE to fully see the menu

Extending Unity editor and new UI - Link Tue, 01 Sep 2015 15:40:25

I want to implement some tools inside Unity like our dialog editor but found a couple of tutorials and they use the old gui system OnGUI. Does somebody knows some example based on the new system

Data Flow Between Systems - Link Tue, 01 Sep 2015 14:08:33

Hello I was recently watching Mike Actons talk at the CPP Con regarding Data Oriented Design and Ive been thinking a lot about how I might be able to structure my game code to better take advantage of cache coherency. The ideal here would be that all major processing is done on contiguous arrays of data directly in-order. But Ive been struggling on one particular aspect of this the problem is that the ordering requirement between various systems is not the same. For example suppose I have a typical flow of data I have high-level behavior that updates positionsrotations which then needs to be transformed by collision and collision response and then converted into matrix transforms for draw calls. There are distinct ordering requirements for each step here behavior will want data grouped by type collision will want it grouped by spatial locality and rendering will want it grouped by draw ordermaterialetc. Beyond that these requirements will change as the state of my game changes not referring to static objects here . This means that I cannot simply set up fixed arrays and run my processing in the same order across the board. Somehow I have to convert between the different orderings as I go. Specifically I am considering the efficiency of the reads from the source the writes to the destination and then the reads at the destination. I have thought of three possibilities to do this Maintain the data in linked lists per-system - This is what I have done for many years to solve this problem. It is easy to use and there is no major processing required to maintain ordering. But the issue is you end up iterating reads at the destination out of order and you have all the node values filling up your cache. Use linked lists for indexing and copy to arrays per-system - I have just recently tried this out. The iteration at the destination is noticeably faster but the copy writes to the destination is now out of order and takes longer. Overall it has been only a minor speed boost for me. Copy to arrays directly and sort per-system - I have not tried this out yet but I intend to. Theoretically this could have the least amount of cache misses as everything is done in order. Its hard to believe that the cost of running the sort algorithm would not outweigh the gains but Ill have to test that. Does anybody else out there have solutions that I am not thinking of Id be greatly interested to know how people tackle this kind of problem. Thanks for reading

Working on D3D11OGL wrapper - Link Tue, 01 Sep 2015 11:37:48

To deepen my knowledge of these APIs. Here I will post some misc questions on cross-API wrapper. They are supposed to be associated with each other so I decided unite all in single topic if moderators will accept this. My main purpose is to get as much as possible of the features of both APIs using single aproach in my wrapper architecture. At this moment im trying to find common things in OGL and D3D11 buffer representation. First issue is binding point. In OGL parameter target may be set as GL_ARRAY_BUFFER GL_ELEMENT_ARRAY_BUFFER GL_UNIFORM_BUFFER GL_COPY_READ_BUFFER - whats proper equivalent in d3d11 GL_COPY_WRITE_BUFFER- whats proper equivalent in d3d11 GL_PIXEL_PACK_BUFFER- whats proper equivalent in d3d11 GL_PIXEL_UNPACK_BUFFER- whats proper equivalent in d3d11 GL_TRANSFORM_FEEDBACK_BUFFER - whats proper equivalent in d3d11 To simplify task I could use special transform feedback object in OGL 4.1. GL_TEXTURE_BUFFER- this we omit its used with special function glTexBuffer - am I right In D3D11 we have D3D11_BUFFER_DESC which has two elements with similar meaning - D3D11_BIND_FLAG and D3D11_RESOURCE_MISC_FLAG I will get to this much much later but still possible values of D3D11_BIND_FLAGare D3D11_BIND_VERTEX_BUFFER D3D11_BIND_INDEX_BUFFER D3D11_BIND_CONSTANT_BUFFER D3D11_BIND_SHADER_RESOURCE D3D11_BIND_STREAM_OUTPUT D3D11_BIND_RENDER_TARGET D3D11_BIND_DEPTH_STENCIL D3D11_BIND_UNORDERED_ACCESSD3D11_BIND_DECODERD3D11_BIND_VIDEO_ENCODER I ignore last three. They are seemed to be quite tricky and I dont know well how they are working. Problem is that these flags can be combined except D3D11_BIND_CONSTANT_BUFFER. But if we do this we disallow GPU to do smart managing with this buffer. Can I afford this Are there so many cases when someone prefer to use several flags Next thing about buffers is usage. D3D11_USAGE_DEFAULT - no problem with this glBufferData D3D11_USAGE_IMMUTABLE - this buffer cant be changed after creation. Does glBufferStorage with proper flags do the same And do these flags really add to performance D3D11_USAGE_DYNAMIC - in OGL i would use GL_DYNAMIC_DRAW however it can be ignored by OGL. Anything elese D3D11_USAGE_STAGING - could i use this for transform feedback To reach the same things in both APIs we need to find proper combination of binding ponts buffer usage in OGL and appropriate combination of binding flags and usage in D3D11. These combinations can be reached by different ways because buffer binding in OGL is dynamic while with D3D11 we have to set it strictly at creation. Am right with this point. The only way i see is to make single classes for uniform buffers vertex buffers index buffers and transform feedback buffers. In special cases we have immutable buffer which cannot be transform feedback buffers as i suppose. Please answer questions in previous sections and suggest your approaches.

Driver Stops Working On Calling Present After Shader Switch - Link Tue, 01 Sep 2015 07:30:58

Greetings Ok I am trying to turn ON and OFF tessellation at runtime by setting hull and domain shader to turn it ON and setting both of them to NULL to turn it OFF. My code runs perfectly if I start my program with hull and domain shader set and also when I start my program with both of them set to NULL. Meaning without switching them in runtime they correctly. This shader switching works without problem for when I switch vertex shader pixel shader geometry shader at runtime. But when I switch hull shader and domain shader in runtime and call swapchain-gtPresent function BOOOOM my windows says Display Driver Stopped Working And Recovered and the swapchain-gtPresent function returns this error code 0x887a0005 with message The GPU device instance has been suspended. Use GetDeviceRemovedReason to determine the appropriate action. So I did call device-gtGetDeviceRemovedReason and it gives me this code 0x887a0006 and this message The GPU will not respond to more commands most likely because of an invalid command passed by the calling application. and now I have no Idea what to do. Please help me Thanks a million in advance

Where do I start C - Link Tue, 01 Sep 2015 02:36:13

Hello. Ive recently learned the basics of C. Id like to start making a game but I just dont know where to start. Id like to make a 2d game for a learning experience but I dont know where to start. Should I use an engine Should I make it myself Theres so much stuff I dont know. If anyone could help me by giving me a shove in the right direction or giving me a list of stuff I need to know Itd be helpful. Thanks.

D3d12 in C - Link Tue, 01 Sep 2015 00:10:34

Hi I am having trouble getting d3d12 working in C. I cant seem to manage to create a descriptor heap. Every time I tried to call a method of the heap it crashes with a access violation exception. Am I doing something wrong include stdafx.h include lttchar.hgt include ltd3d12.hgt include ltdxgi1_4.hgt define CALLmethod object ... object-gtlpVtbl-gtmethodobject __VA_ARGS__ define __riidx REFIID_IID_ x typedef HRESULTWINAPI FN_CREATE_DXGI_FACTORY1REFIID void typedef HRESULTWINAPI FN_D3D12_CREATE_DEVICEIUnknown D3D_FEATURE_LEVEL REFIID void static const IID _IID_IDXGIFactory4 0x1bc6ea02 0xef36 0x464f 0xbf0x0c0x210xca0x390xe50x160x8a static const IID _IID_ID3D12Device 0x189819f1 0x1db6 0x4b57 0xbe0x540x180x210x330x9b0x850xf7 static const IID _IID_IDXGIAdapter 0x2411e7e1 0x12ac 0x4ccf 0xbd0x140x970x980xe80x530x4d0xc0 static const IID _IID_ID3D12DescriptorHeap 0x8efb471d 0x616c 0x4f49 0x900xf70x120x7b0xb70x630xfa0x51 int main HRESULT hr HMODULE dxgi_dll FN_CREATE_DXGI_FACTORY1 CreateFactory1 IDXGIFactory4 factory4 IDXGIAdapter adapter HMODULE d3d12_dll FN_D3D12_CREATE_DEVICE CreateDevice ID3D12Device device ID3D12DescriptorHeap heap dxgi_dll LoadLibraryEx_Tdxgi.dll NULL 0 CreateFactory1 FN_CREATE_DXGI_FACTORY1GetProcAddressdxgi_dll CreateDXGIFactory1 CreateFactory1__riidIDXGIFactory4 voidfactory4 hr CALLEnumWarpAdapter factory4 __riidIDXGIAdapter voidadapter d3d12_dll LoadLibraryEx_Td3d12.dll NULL 0 CreateDevice FN_D3D12_CREATE_DEVICEGetProcAddressd3d12_dll D3D12CreateDevice hr CreateDeviceIUnknownadapter D3D_FEATURE_LEVEL_12_0 __riidID3D12Device voiddevice D3D12_DESCRIPTOR_HEAP_DESC desc .NumDescriptors 1 .Type D3D12_DESCRIPTOR_HEAP_TYPE_RTV .Flags D3D12_DESCRIPTOR_HEAP_FLAG_NONE .NodeMask 0 hr CALLCreateDescriptorHeap device desc __riidID3D12DescriptorHeap voidheap CALLGetDesc heap access violation exception return 0

Odd issue with Separating Axis Theorem - Link Mon, 31 Aug 2015 18:25:41

I have the collision detection working great. I have a hallway I generate with a box that moves down it. I have gravity that will pull the object down when I raise it with space. If I turn off collision response the box will stop if its next move will collide every time. But with collision response on it will follow most surfaces without penetrating perfectly. But certain spots of some faces will cause the collision response to tell it to go to an opposing face versus along the face it is against. Like if it was moving along the face with an -x normal it will jump to the face with the -y normal instead. And when I look at the list of axes and minmax the minmax differences all have a much larger gap that it should. Has anyone run into anything like this The hallway is composed of 4 different OBB one for each wall.

Is my object-structure bad Related to Text RPG - Link Mon, 31 Aug 2015 18:25:01

Im building a text-RPG and while everythings working fine for now Im concerned that my structure sucks. The primary objects in play are Characters Rooms Items Notifiers Handlers Attack Item and Movement handlers World stores handlers notifiers and events The basic process is something like this Character.move from Room A to Room B World registers a move-event MoveNotifier.notify Registered handlers receive notification and do their thing i.e. - MoveHandler takes the pointer to Characterstored in a member ofRoom A and moves it to the respective member in Room B. DescriptionHandler prints out the appropriate Room B description what items it contains etc. I know the notifier-handler thing may be a bit overkill for a single-player text-RPG but this is all practice for the big pictureplease think of this as early practice for creating a larger multi-player game. Heres my worry Many of these objects store pointers to other objects. Character has a pointer to the Room in which it stands while Room has a vector of pointers to every Character contained within it. This doesnt feel right. Part of me thinks that Charactershouldknow what Room it stands in but another part of me wants every object to be totally independent and self contained. If everything should be self-contained then my question is Is there a standard line of containment Should Room know what Character is in it Should a Character know what Item it has equipped Should an Item know what Enhancements its infused with If nothing should be aware of anything else then should everything be stored in a relational database Ive been looking into object storage w MySQL or some SQL variant anyway.

Horizontal Flip Custom HitBoxes With Sprite Flip in 2D Game - Link Mon, 31 Aug 2015 17:15:13

Hello Everyone I have Custom Hitboxes defined per sprite for enemies as stdvectorltRectanglegt where each rectangle is relative coordinates to the sprite when doing collision detection i just translate those Rects coordinates to screen coordinates and check for colliding objects and it works fine when sprite is not flipped and its in the same shape when the hitboxes were defined for it however in some cases when the enemy gets behind the player character it flips horizontally to give the enemy the ability to attack the player as well there is no vertical flipping thus hitboxes positions are now invalid and will cause wrong collision detection im trying to find an algorithm to flip hitboxes sort of mirroring them. what is the easiest way to not sure about the right term here flip hitboxes to match same positions when the sprite gets flipped. Thanks for help.

C cross platform resolve hostname to ip library - Link Mon, 31 Aug 2015 17:11:32

As the title says Im thinking about using a small library to do just that resolve a hostname to an ip address without having me to rewrite the code for windows linux. Anyonw have recommendations for a smaller simple lib to achieve that

Revolute quaternion constraint - Link Mon, 31 Aug 2015 16:30:59

So Ive been trying to implement a revolute joint using quaternion constraints as described by Claude Lacoursire in Game Physics Pearls but without too much luck. It seems to only work when the bodies are not rotated and the joint frame is axis-aligned. Ive attached a pdf I made this morning of my derivation and what follows is some of the relevant code inline mat4_t L_matrixconst quat_t q mat4_t result result.a q.w result.e -q.z result.i q.y result.m q.x result.b q.z result.f q.w result.j -q.x result.n q.y result.c -q.y result.g q.x result.k q.w result.o q.z result.d -q.x result.h -q.y result.l -q.z result.p q.w return result inline mat4x3_t GT_matrixconst quat_t q mat4x3_t result result.a q.w result.e -q.z result.i q.y result.b q.z result.f q.w result.j -q.x result.c -q.y result.g q.x result.k q.w result.d -q.x result.h -q.y result.l -q.z return result inline mat4_t R_matrixconst quat_t q mat4_t result result.a q.w result.e q.z result.i -q.y result.m q.x result.b -q.z result.f q.w result.j q.x result.n q.y result.c q.y result.g -q.x result.k q.w result.o q.z result.d -q.x result.h -q.y result.l -q.z result.p q.w return result inline mat4x3_t ET_matrixconst quat_t q mat4x3_t result result.a q.w result.e q.z result.i -q.y result.b -q.z result.f q.w result.j q.x result.c q.y result.g -q.x result.k q.w result.d -q.x result.h -q.y result.l -q.z return result Initialisation quat_t e conjugatebody1-gtxform.q frame quat_t f conjugatebody2-gtxform.q frame mat2x4_t P P.a 1.0f P.c 0.0f P.e 0.0f P.g 0.0f P.b 0.0f P.d 1.0f P.f 0.0f P.h 0.0f joint-gtP P R_matrixf transposeL_matrixe Pre-step quat_t rq conjugatebody1-gtxform.q body2-gtxform.q mat2x3_t G1 -0.5f joint-gtP ET_matrixrq mat2x3_t G2 0.5f joint-gtP GT_matrixrq joint-gtG1 G1 joint-gtG2 G2 mat2_t K G1 body1-gtmass_ang_world_inv transposeG1 G2 body2-gtmass_ang_world_inv transposeG2 joint-gtinv_K inverseK Solving the velocity constraint const mat2x3_t G1 joint-gtG1 const mat2x3_t G2 joint-gtG2 vec2_t GV G1 body1-gtvel_ang G2 body2-gtvel_ang vec2_t lambda joint-gtinv_K -GV body1-gtvel_ang body1-gtmass_ang_world_inv transposeG1 lambda body2-gtvel_ang body2-gtmass_ang_world_inv transposeG2 lambda It would be greatly appreciated if someone who has experience with this Dirk Gregorius to take a look at this and point out where Im going wrong. Attached Files derivation.pdf 105.73KB 118 downloads

Gpu Stress - Link Mon, 31 Aug 2015 14:54:00

Hello Does anyone know of any benchmark using which we can stress a particular pipeline stage isolatedly. For example stressing only the Vertex shaders or increasing stress using Tessellation alone. I am trying to analyze how the game play is effected under different stress. Also if i want to create a benchmark myself say for example i want to stress the vertex shader part. Does simply adding some dummy calculation in the vertex shaders do the trick It will be great if one could give guidelines on creating a simple GPU-stress benchmark. Thanks.

Best shading algorithm nowadays - Link Mon, 31 Aug 2015 14:51:48

Hi i would like to improve photorealism of real-time 3D engine that is used for room interior visualization. Questions what shading algorithms is most suitable in your opinion for such purposes I tried to google a little. But all results were 10 years old..

Find tile coordinates within a given radius - Link Mon, 31 Aug 2015 14:41:48

I am developing a game where the top left corner of the world is coordinate 00. Thus x is increasing while moving right and y down. I am trying to come up with an algorithm that finds the coordinates of the tiles within the given circle. The method signature could look like this ArrayOfCoordinates findCoordsint centerX int centerY int radius Example if radius is set to 1 it would search something like this If it is 2 And 3 4 And so on.

About Quadtree spatial partitioning - Link Mon, 31 Aug 2015 14:26:16 I am wondering how do I identify which node is walkable. Say when I first break up a tile which covers the whole scene into 4 divisions. And there are heaps of obstacles in the leaf node how can I tell the obstacles are located in there I am using DX9 D3DX.... Update BTW how do I use AStar or TimeAStar with QuadTrees Thanks Jack

Car Physics Questions about traction and grip - Link Mon, 31 Aug 2015 14:02:02

Hello all I have been working on a simple top-down 2D car simulator and have some questions to anyone who is experienced with this. The main problem I have is how to simulate a wheel losing grip. I have been reading Brian Beckmans series on racing and I understand that the tires have an adhesive limit and that the circleellipsis of traction can be used to know whether a wheel is gripping or not. Am I right to presume that the amount of traction on a tire needs to be capped to the circle This is my per-frame code at the moment float speed glmlengthvelocity_local Calculate weight distribution. float weight description.mass G float wheelbase description.cg_to_front_axle description.cg_to_back_axle float front_weight description.cg_to_back_axle wheelbase weight - description.cg_height wheelbase description.mass acceleration_local.x float rear_weight description.cg_to_front_axle wheelbase weight description.cg_height wheelbase description.mass acceleration_local.x Assume the wheels are rolling and calculate the engine torque. float wheel_angular_velocity velocity_local.x description.wheel_radius float transmission description.gear_ratios91gear description.differential_ratio description.transmission_efficiency float engine_rpm ANGULAR_VELOCITY_TO_RPM wheel_angular_velocity transmission float engine_torque throttle lerp_curvedescription.torque_curve engine_rpm 0.0f Simplified traction model - use the torque on the wheels. float drive_torque engine_torque transmission float traction_force drive_torque description.wheel_radius Calculate the braking torque on the wheels. float braking_torque reverse 3500 0 float braking_force -braking_torque description.wheel_radius glmsignvelocity_local.x Calculate the lateral slip angles and determine the lateral cornering force. float front_angular_velocity car_angular_velocity description.cg_to_front_axle float rear_angular_velocity -car_angular_velocity description.cg_to_back_axle float slip_angle_front stdatan2velocity_local.y front_angular_velocity stdabsvelocity_local.x - glmsignvelocity_local.x steer_angle float slip_angle_rear stdatan2velocity_local.y rear_angular_velocity stdabsvelocity_local.x float cornering_force_front front_weight -description.cornering_stiffness slip_angle_front float cornering_force_rear rear_weight -description.cornering_stiffness slip_angle_rear The wheels have a limited maximal traction before they start to slide. float traction_circle_radius 0.8 glmvec2 front_total_traction glmvec20 cornering_force_front stdcossteer_angle glmvec2 rear_total_traction glmvec2traction_force braking_force cornering_force_rear bool front_slipping false float front_total_traction_length glmlengthfront_total_traction if front_total_traction_length front_weight gt traction_circle_radius front_total_traction front_total_traction_length front_total_traction traction_circle_radius front_weight front_slipping true bool rear_slipping false float rear_total_traction_length glmlengthrear_total_traction if rear_total_traction_length rear_weight gt traction_circle_radius rear_total_traction rear_total_traction_length rear_total_traction traction_circle_radius rear_weight rear_slipping true Calculate the torque on the car body and integrate car yaw rate and orientation. float cornering_torque_front front_total_traction.y description.cg_to_front_axle float cornering_torque_rear rear_total_traction.y description.cg_to_back_axle float car_torque stdcossteer_angle cornering_torque_front - cornering_torque_rear float car_angular_acceleration car_torque description.inertia car_angular_velocity car_angular_acceleration dt orientation car_angular_velocity dt Calculate the wind drag force on the car. Simplification that the area facing the velocity direction is the front. float area description.height 2.0f description.halfwidth float drag_multiplier 0.5f description.air_density area description.drag_coefficient glmvec2 drag_resistance -drag_multiplier speed velocity_local Calculate the rolling friction force on the car. glmvec2 rolling_resistance glmvec2-description.wheel_rolling_friction velocity_local.x 0 Sum the forces on the cars CG and integrate the velocity. glmvec2 force rear_total_traction front_total_traction drag_resistance rolling_resistance acceleration_local force description.mass velocity_local acceleration_local dt Calculate the acceleration and velocity in world coordinates and integrate world position. float sn stdsinorientation float cs stdcosorientation acceleration.x cs acceleration_local.x - sn acceleration_local.y acceleration.y sn acceleration_local.x cs acceleration_local.y velocity.x cs velocity_local.x - sn velocity_local.y velocity.y sn velocity_local.x cs velocity_local.y position velocity dt This gets me a car that can accelerate and steer however the tires never seem to lose grip the way I expect them to. I can move at 200 kmh and make a abrupt turn without spinning the car simply moves in approximately the same arc as when going slow. Am I missing some step to simulate a sliding car apart from capping the traction Also as a side question is using the torque on the rear wheels as the forward traction force an acceptable approximation I saw this being done in on the envelope calculations by Brian ignoring slip ratios and wheel turn rate integration. However I am not sure how correct this actually is. Any input is appreciated

Parameter-Based Argument Sending - Link Mon, 31 Aug 2015 12:54:56

hi I recently imagined a model of parameter-based argument sending worrying about how I deal with memory management. so I want your some opinions. 1. all type of sending argument to functions have only one data for labeled parameter like this struct STD_PARAM int num_param915 char str_param9110 .... struct STD_PARAM fordata_param void func_a int data0 fordata_param.num910 int data1 fordata_param.num911 ... void func_b int foradd fordata_param.num910 int formultiple fordata_param.num911 .... 2. all functions should have a consistent rule for using parameter of course all rules should explicate their purposes manifestly. so I can get some concludes 1 consecutively defined assigned released data can be avoided. 2 all functions can freelyget data return data use pointer or direct return 3 this can cause many confusions of purpose occasionally Ill wait your some opinions hopefully.

Fill Texture resource with data from file - Link Mon, 31 Aug 2015 12:14:58

Hi I am started to deal with Direct3D 12 and want to understand how in 12 version I can load my texture from file to texture instance. In DX 11 I used WIC loader solution from sharpdx to load textures from file. For 2d textures I end my loading with DataBox array with one element which contains start pointer and size of the texture. For texture cube dtabox aaray contains 6 elements correspondingly. How to write that data to texture 2d in Direct3D 12 I know that I can write to texture using that method texture.WriteToSubresource I suppose that corect code will texture.WriteToSubresource0 null databox.DataPointer databox.RowPicth dataBox.SlicePitch Am I correct with this Could anyone point me

self illumination in glsl - Link Mon, 31 Aug 2015 12:03:32

hello i search for my project a shader effect like sketchup are called self illumination light i would that my hardware instancing in glsl is illumined without light light position attenuation eccc... THANKS

Entities interaction - Link Mon, 31 Aug 2015 12:00:55

hello this weekend I went back to an old multiplayer prototype I was working on. For now I render the world state 100ms back in time and interpolate the server states to compensate for lag and updating the server-controlled entities smoothly. When the client performs an action I send the action to the server roll back the server state to match more or less how the client saw it when performing the action and execute it. Than I send the response back to the client. Everything seems to work fine but I have issue when simulating two players interacting with the same entity. Lets assume the entity is a monster and both players will level up if they kill it. Player A has a very slow connection Player B a very fast one. A attacks and a few milliseconds later B does the same. As long as B has a faster connection B gets its event to the server earlier get it processed kills the monster get the response and levels up. While this is happending the event from A arrives the state goes back to when the moster was still alive the monster gets killed again and the response is sent back to A and B. A levels up correctly because he killed the moster first but than B is in this weird state where he leveled up but the new server state says it never did and I need to somehow rollback. How do you guys solve normally situation like this one I could execute the events as they arrive to the server without rolling back. But than nothing works decently cause my game is an action-packed game and I have to keep lag in consideration. Any suggestion Thanks

Please help me fix my Mono class. - Link Mon, 31 Aug 2015 10:38:36

Hi I would like to ask you for a little help or advise with my class. In short what is it supposed to do is to draw a texture which works well. Further it is supposed to follow the mouse position. Also here is the problem it is supposed to check for collision with Rectangle objects argument in Update -gt ListltObstaclegt _obstacleList. Once it does collide with a rectangle it is supposed to bounce in the other direction. Right now when bouncing back the mouse position is also changed via Mouse.SetPosition. My problem is sometimes the collision checks simply do not work. It feels like collision checks fail if I move the mouse to fast. I am also not sure whether my CheckMinkowskiSum method does the calculations right. It would be great if somebody more experienced could have a look at my class. I know it is a mess right now but I guess it is still readable using System.Collections.Generic using System.Diagnostics using Microsoft.Xna.Framework using Microsoft.Xna.Framework.Graphics using Microsoft.Xna.Framework.Input using System using System.Windows.Forms using MonoTest.Environment using ButtonState Microsoft.Xna.Framework.Input.ButtonState namespace MonoTest public class Companion private Texture2D texture private Vector2 position private MouseState oldMouseState private GraphicsDevice graphics private ListltITriggerObjectgt triggerObjList private int xBounceVelocity 0 private int yBounceVelocity 0 private int maxBounceVelocity 5 private bool isBouncing false private int maxBounceFactor 15 private int currenBounceFactor 0 public CompanionTexture2D _texture Vector2 _position GraphicsDevice _graphics ListltITriggerObjectgt _triggerObjList this.texture _texture this.position _position _graphics this.triggerObjList _triggerObjList Mouse.SetPositiongraphics.Viewport.Width 2 graphics.Viewport.Height 2 Set the mouse to a position where no collision appears public void UpdateListltObstaclegt _obstacleList MouseState mState Mouse.GetState if isBouncing CheckCollision_obstacleList mState else Bounce oldMouseState mState Called while still bouncing private void Bounce if currenBounceFactor maxBounceFactor isBouncing false currenBounceFactor 0 xBounceVelocity 0 yBounceVelocity 0 else currenBounceFactor position new Vector2position.XxBounceVelocityposition.YyBounceVelocity Mouse.SetPositionintposition.X xBounceVelocity intposition.Y yBounceVelocity Checks for collision with all Rectangles in the level private void CheckCollisionListltObstaclegt _obstacleList MouseState mState position new Vector2mState.XmState.Y bool collides false string collisionFrom string.Empty Rectangle collisionRectangle new Rectangle foreach Obstacle obstacle in _obstacleList if obstacle.BoundRectangle.Intersectsthis.BoundingRect collides true collisionFrom CheckMinkowskiSumthis.BoundingRect obstacle.BoundRectangle collisionRectangle obstacle.BoundRectangle break If a collision occured mark bouncing true if collides switch collisionFrom case bottom yBounceVelocity -maxBounceVelocity isBouncing true break case top yBounceVelocity maxBounceVelocity isBouncing true break case left case right if collisionRectangle.Center.X lt this.BoundingRect.Center.X Left xBounceVelocity maxBounceVelocity isBouncing true else right xBounceVelocity -maxBounceVelocity isBouncing true break Returns the direction from which the collision took place public string CheckMinkowskiSumRectangle pRectangle Rectangle oRectangle http58gamedev.stackexchange.comquestions24078which-side-was-hit2409124091 float wy pRectangle.Width oRectangle.Width pRectangle.Center.Y - oRectangle.Center.Y float hx pRectangle.Height oRectangle.Height pRectangle.Center.X - oRectangle.Center.X if wy gt hx if wy gt hx -1 return top else return left else if wy gt -1 hx return right else return bottom public void DrawSpriteBatch spriteBatch spriteBatch.DrawtexturepositionColor.White public Rectangle BoundingRect get return new Rectangleintposition.X intposition.Y texture.Width texture.Height

entity component system object creation - Link Mon, 31 Aug 2015 10:30:59

Okay so im making a top down classic styled RPG using SFML. But i have a question and i only ask because yes Ive done some googling and either its a stupid question or i cant find the right keywords. So about a week ago now i discovered Entity Component Systems and its variations and i fell in love with the structure. So i built a test program to see if i liked it. and i think 2 days of reading articles and then 3 days of programming later ive got a game that functions exactly the samethe bare basics a player and a world that the player moves on Nothing super fancy but i like everything so far For reference ill just describe what i have hopefully thatll help answer my question that ill write in a second. -So ive got an Entity class thats got an id and a vector of Components. -Comonents are added as needed to each entity. Originally each Component had data and an update function that messed with its data when it needed. I later moved the contents of the update function up to the System Managers after reading some more articles i might revert back to the original not sure witch way of updating the components i like better Examples of some Components are Physics Input Graphics. -Then Ive got System managers that manage updating for its component type -And lastly a Manager that holds the System Managers and any other variables i need stored there like my RenderWindow Im still tinkering with it but i like this a lot better than the traditional OOP approach. However theres one problem lol it could totally just be an issue of me overthinking thats arisen. So every entity is functionally the same its the components it stores that make it into something different. So back in OOP if i wanted to create a Player for instance id probably have to make a player object and then just create an instance of it. Now if i wanna make a Player i make a new Entity and add all the appropriate components creating any new components as necessary. So my first question is should i define each new type of object i need in some form of fileif so what type would be best or should i just manually code them in as needed somewhere in a System Manager or something Im not really sure if this makes sense -.- let me know if im just rambling or if some part of this didnt make sense I also had another question but forgot it while typing this oh well maybe itll come back to me later.

Strange pinching effect with raytraced reflections - Link Mon, 31 Aug 2015 04:14:08

Hi all Finally making progress on reflections. I cant seem to find what is wrong with my reflection rays. It is creating reflections that are pinched to the center of the spheres Vector3 ReflectionDirection newRay.direction.nor.cpy.subsurfNorm.sclnewRay.direction.cpy.dotsurfNorm.scl2.0f Ray ReflectionRay new Rayinter ReflectionDirection CastRayReflectionRay true Any idea why this is happening

Looking into fix my time step - Link Mon, 31 Aug 2015 03:49:52

Hello all. I was looking at changing my game loop. But I have some questions Q1Like why do they have the accumulator in a while loop Q2does that loop do the update or doyou wait until the loop ends. Q3 What is t with long waits this just counts up and up each timeyou do a pass. Q4lloks like it only works when frame time is small Q5My test code maybe wrong. Q6How do you proccess 8000 objects in a small amount of time. That will not make the time delay blow up. Q7Its just me I have it all wrong Hoping. This does not look wright if Iadd a 1 second delay at the end of the loop the while accumulator will spin for like depending on the wait can spin upto 615 steps in the loop and more this seams wrong why waste that loop. I noticed in the article they put a ifframeTime gt 0.25 frameTime 0.25 whats the point of calling thy timer. In my current setup I just hard coded a 0.20 as my frame delta and vsync thats why I want to change to this But Im missing something. this is the article May be I have it wrong here is my test app. . ifndef WIN32_LEAN_AND_MEAN define WIN32_LEAN_AND_MEAN endif includeltWindows.hgt include ltstringgt include ltiostreamgt include ltsstreamgt includeltGameTimer.hgt int mainint argc char argv91 Enable run-time memory check for debug builds. if definedDEBUG defined_DEBUG _CrtSetDbgFlag _CRTDBG_ALLOC_MEM_DF _CRTDBG_LEAK_CHECK_DF endif stdcout ltlt Press Q to quit ltlt stdendl __int64 ctr1 0 freq 0 __int64 currentTime 0hires_time_in_seconds int acc 0 i 0 get the time ifQueryPerformanceCounterLARGE_INTEGER currentTime FALSE stdcout ltlt Timer error ltlt stdendl QueryPerformanceFrequencyLARGE_INTEGER freq double t 0.0 const double dt 0.01 double accumulator 0.0 size_t listsize 0 stdstring line stores the most recent line of input whilestdgetlinestdcin line read entire lines at a time deal with the contents of line ifline.compareq 0 line.compareQ 0 break ifQueryPerformanceCounterLARGE_INTEGER ctr1 FALSE stdcout ltlt Timer error ltlt stdendl __int64 newTime ctr1hires_time_in_seconds double frameTime newTime - currentTime 1.0 freqconvert to seconds ifframeTime gt 0.25 frameTime 0.25 stdcout ltlt CurrentTime ltlt currentTime ltlt stdendl stdcout ltlt NewTime ltlt newTime ltlt stdendl stdcout ltlt Current Frame Time ltlt frameTime ltlt stdendl currentTime newTime accumulator frameTime int count 0 while accumulator gt dt count Sleep200 stdcout ltlt accumulator ltlt accumulator ltlt Steps ltlt count ltlt stdendl stdcout ltlt Current Frame Time ltlt frameTime ltlt stdendl integrate state t dt accumulator - dt t dt stdcout ltlt Time t ltlt t ltlt stdendl Sleep1000 end while running return 0 . Just found this postNow if I set a DT of 1120 and a sleep1000 there is over 23000 steps lol say good by to your game loop hehehe. 130 seams to work a lot better but what happens if your render takes a second say good bye again. Cant you just set a timer to fire every 0.03 seconds and update. I think I may have to move this into my real app and see what happens.

C Physics Engine - Link Mon, 31 Aug 2015 02:45:11

I need a C 3D physics engine for Visual Community 2015. Can anyone recommend one Id really like to use PhysX but the C wrapper is incomplete. -T

How to Set Pixel Shader Constants - Link Mon, 31 Aug 2015 02:05:18

Alright Im getting back into trying to run a shader through DirectX. This time Im looking at DirectX11 and DirectCompute as it was suggested. It appears to make it simpler than with DX9 to run the shader without needing to configure tons of stuff that isnt directly related to what Im doing like vertexes. Now I have a question as to how to configure the shader parameters. In DirectX 9 this works m_pPixelConstantTable-gtSetIntm_pDevice name value m_pPixelConstantTable-gtSetFloatm_pDevice name value m_pPixelConstantTable-gtSetBoolm_pDevice name value In DirectX 11 it appers I have to instead use ID3D11DeviceContextPSSetConstantBuffers and create a ID3D11Buffer for each parameter. This would require considerably more code and more importantly... how does the shader know the data type of a parameter Whats the simplest syntax for defining parameters for the shader Thanks

Need Some Resources for Multi-Threading - Link Mon, 31 Aug 2015 00:14:40

Lo all I need some primary resources for a number of things to fix my engine up a bit with. But those can all wait for later as there is one major concern. Multi-threading. Unfortunately information on this topic is lacking and most books Ive picked up only spend a brief second to talk about it... because it is still assumed that Multi-threading is a concept of the past. Does anyone have any reference material that they can suggest to me And if language is a needed information... I primarily work with Lua and C. And I do read the Bitsquid Blog... but some of the things are lost on me... as these are concepts I hadnt brushed by yet.

Triangle-AABB intersection test - Link Sun, 30 Aug 2015 21:53:53

I want to implement octrees where I store a limited number of triangles in each octree node. One triangle can exist in multiple nodes. Before i can add it I need to figure out if the triangle intersectsoverlays with the sub cube of the node. It is only necessary that a part of the triangle is inside that cube. Here are my querys I already implemented A triangle is partly inside an AABB if at least one of the three corner points is inside AABB at least one of the three edges intersects with at least one of six AABB planes Now there is a third possibilty where a triangle intersects with the AABB and that is if only the surface goes through one of the six planes. I know that 2 intersecting planes can form a line but then I dont know how this might help me. Do you have any ideas how to estimate the third possibility lg Chris PS follow me on my blog where I explain computer graphics in pure C no OpenGL or DirectX

Why driver gives a gain of FPS - Link Sun, 30 Aug 2015 21:41:33

Hi The changelog of the driver always says it gives a gain of FPS on multiple games. Why does it happen Thanks

Translate Planet around a circle path on X Z axes - Link Sun, 30 Aug 2015 20:57:13

I am not 100 sure how to do this but guessing sin and cos I am lost on what the correct formula is to move planets node around my sun... Thanks

acos in Java has gone bezierk - Link Sun, 30 Aug 2015 20:11:49

A bizarre thing Math.acos0.24309845 in my java code gave1.3252374720942488 degrees but arccos0.24309845 is really 75.9305 degrees So why is Math.acos giving me the wrong value OR maybe what am i doing wrong My bet is im doing something stupid but cant see it yet

Getting correct coordinates after pinch zoom drawing line Android - Link Sun, 30 Aug 2015 19:58:22

I am trying to draw the line following by the users fingertouch. It is quite easy task to implement if there is no scaling. Drawing without scaling works perfectly here is an screenshot Works well. As you can see. But if I scale an canvas it begins to draw points with some marginmeasurement errortolerance. It seems that I have not taken some value in advance while calculating scaled touch points I have tried a lot of different formulas but nothing helped. Here is the result of zooming the canvas. It seems that the problem in some delta value that I have to take into consideration Because if I use this version of scale function it works well but scales only to the left top corner. canvas.scalemScaleFactor mScaleFactor With this scaling canvas.scalemScaleFactor mScaleFactor scalePointX scalePointY Multitouch zoom pinch works well but coordinates are not correct. Please help to solve the problem it seems that I have to take these scalePointX scalePointY variables when calculating scaled x and y. Here is my code. Any help will be highly appreciated. private void initWorkSpaceContext context mPaint new Paint mScaleDetector new ScaleGestureDetectorcontext new ScaleListener mRect new Rect mPath new Path mPaint.setAntiAliastrue mPaint.setColorColor.BLACK mPaint.setStylePaint.Style.STROKE mPaint.setStrokeJoinPaint.Join.ROUND mPaint.setStrokeWidth10f Override protected void onDrawCanvas canvas super.onDrawcanvas canvas.getClipBoundsmRect canvas.scalemScaleFactor mScaleFactor scalePointX scalePointY canvas.translatemRect.topmRect.left canvas.drawPathmPath mPaint canvas.restore when ACTION_DOWN start touch according to the xy values private void startTouchfloat x float y mPath.moveTox y mX x mY y when ACTION_MOVE move touch according to the xy values private void moveTouchfloat x float y float dx Math.absx - mX float dy Math.absy - mY if dx gt TOLERANCE dy gt TOLERANCE mPath.quadTomX mY x mX 2 y mY 2 mX x mY y public void clearCanvas mPath.reset invalidate when ACTION_UP stop touch private void upTouch mPath.lineTomX mY Override public boolean onTouchEventMotionEvent ev Let the ScaleGestureDetector inspect all events. mScaleDetector.onTouchEventev final int action ev.getAction Log.eTOUCHREAL X ev.getX REAL Y ev.getY Log.eTOUCHRECT TOP RECT LEFT mRect.left RECT RIGHT mRect.right RECT BOTTOM mRect.bottom final float scaledX ev.getXmScaleFactormRect.leftmScaleFactor final float scaledY ev.getYmScaleFactormRect.topmScaleFactor switch action MotionEvent.ACTION_MASK case MotionEvent.ACTION_DOWN final float x ev.getX - scalePointX mScaleFactor final float y ev.getY - scalePointY mScaleFactor cX x - mPosX scalePointX canvas X cY y - mPosY scalePointY canvas Y Remember where we started mLastTouchX scaledX mLastTouchY scaledY Log.eDOWNScale FACTOR mScaleFactor Log.eDOWNX mLastTouchX Y mLastTouchY scalePointX scalePointX scalePointY scalePointY Log.eDOWNLast X mLastTouchY Last Y mLastTouchY startTouchmLastTouchX mLastTouchY invalidate break case MotionEvent.ACTION_MOVE final float x ev.getX - scalePointX mScaleFactor final float y ev.getY - scalePointY mScaleFactor cX x - mPosX scalePointX canvas X cY y - mPosY scalePointY canvas Y Only move if the ScaleGestureDetector isnt processing a gesture. if mScaleDetector.isInProgress final float dx x - mLastTouchX change in X final float dy y - mLastTouchY change in Y mPosX dx mPosY dy invalidate Log.eACTION_MOVEScale FACTOR mScaleFactor Log.eACTION_MOVEX scaledX Y scaledY cX cX cY cY Log.eACTION_MOVELast X mLastTouchX Last Y mLastTouchY mLastTouchX scaledX mLastTouchY scaledY moveTouchscaledX scaledY invalidate break case MotionEvent.ACTION_UP mLastTouchX 0 mLastTouchY 0 upTouch invalidate return true private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener Override public boolean onScaleScaleGestureDetector detector mScaleFactor detector.getScaleFactor scalePointX detector.getFocusX scalePointY detector.getFocusY Dont let the object get too small or too large. mScaleFactor Math.max0.1f Math.minmScaleFactor 10.0f mScaleFactor mScaleFactor lt 1 1 mScaleFactor invalidate return true

Game Object Architecture for RTS - Link Sun, 30 Aug 2015 18:59:06

Hi my current project is a rts game using my own game engine C OpenGL 4.2. My game engine doesnt provide its own game object architecture because I wanted to try different approaches. However a rts game is yet different again. Im tending to use a property-centric architecture since all units have mostly everything in common. For example those properties HP Mana Mesh CollisionBoundary and so on. But I need it to be extensible through scipts. I am going to add hell a lot of units let alone be the human race with around 50 units. Is an property-centric suitable for a rts game or does there exist another approach other than ECS which supports data locailty

Recreating some NES limitations - Link Sun, 30 Aug 2015 18:32:31

Ive got a little side-project going that is designed to be an old NES RPG. As Ive looked into it more I have become enthralled by following the same limitations that the NES had it has really engaged me in the project to constrain myself so. EDIT To be clear Im not talking about building an actual NES ROM Im talking about building a modern stand-alone game that is designed to be like an NES ROM. Anyway there are a couple limitations for the NES that have not been able to find information about and I was hoping someone here might have experience with it and could help me. The first is that I am wondering what limitations it would have in regards to the games code. I am not actually writing this in an old language or such thing but I would like the final to reflect the limitations of the original system. Basically Im not concerned about how the actual code functions per-se but for what the final result looks like to the player. Of course this still entails much of the code following the original limitations. Off the top of my head Im pretty sure I cant use floats at all. Also I would want most variables to only use bytes or otherwise to not use values above 255. I think it would be technically possible to use higher numbers but they would have to be used sparingly and I do not know what those upper limits would be. Another question I have about limits is the game size. This one I am really not sure about and I suspect would be really hard to determine when I am hitting that limit. I have no real way to gauge how much space the code is taking up and music sound map data and more are going to be hard to figure out how much space they would use on the NES compared to how much space they are using for me. About the only thing I can concretely determine how much I have is the artwork. Since how much space I am using is so ambiguous I guess Id really like some sort of primer to help me understand how the space is limited and how things eat up that space. And while I am on the subject of NES limitations I am wondering if someone can explain this one thing to me. When I look at the NESs color palette the selection of the ones that are available on the system there are ten blacks and two whites. Why is there an extra white and an extra black And why are the E and F columns blank

D3D12 Evict and MakeResident. - Link Sun, 30 Aug 2015 18:24:39

The question i have is do i need to have a fence whenever i call Evict and MakeResident. Or these will happen immediately. Or do you only need to worry about fence only and only if you are messing with the commandlist.

D3D12 Create anything anywhere - Link Sun, 30 Aug 2015 18:03:52

D3D12 Forgetting performance it seems at least to me to be possible to create anything anywhere. A index buffer in system memory rather than graphic local memory or to use D3D12 terminology an index buffer in POOL_L0 rather than POOL_L1. Am I reading things wrong or can you create anything anywhere Or is this GPUdriver dependent So if I wanted to create a default heap in POOL_L0 create a placed resource lets say index buffer in said heap and render from it there would be no problem right

What to do with reflected color - Link Sun, 30 Aug 2015 17:04:24

Hi all Just about to implement reflection in my tracer. I can calculate the reflected ray just not sure what to do with the color it hits Do I just return the color of the object the reflection ray hits and add it to the first objects color Or do I need to do something else with it Do I need to take into account shadow and speculatity of the second object or do I apply that to the blended color Also if the reflection ray hits the sky so I just add nothing Thanks

lame question how to delete something from vector - Link Sun, 30 Aug 2015 15:03:07

so i have stdvectorltgt list now int i list.erasei doesnt work Description Resource Path Location Type no matching function for call to stdvectorltTEventItemgteraseint event_chat.h i just dont understand why i cant simply delete x item on the list...

Distance Between Points Range Question - Link Sun, 30 Aug 2015 13:39:38

Hello Im wondering if someone could teach me how to find the farthest distance an object could be in a range of points. I know the formula for distance between points but not sure how to find the two farhest away points from this range. The numbers are from the functions below. Y randomenemyUnit.Y - 80 enemyUnit.Y 80 X randomenemyUnit.X - 75 enemyUnit.X 75 These are two random points being set to X Y. After this is calculated I lerp towards X Y point from current point. The last thing I do is test distance away from the new point and see if its so many px away yet. This is what trips me up. The distance event doesnt fire every time because I might be short. I need to know how to figure out ranges like this so being short cant happen. How do you tell the farthest away these two points can be. This is really dumb I know lol. To be honest Im not even sure if this can be calculated or if I have enough numbers. For a more visual look Im messing with Construct. The events are below.

Monster AI Timer Loop - Link Sun, 30 Aug 2015 08:02:34

Long story short my gameserver is written in V8 JS nodejs. Its a instanced based game similar to Diablo 2. Players can join and leave games and when a player joins a game then goes to a dungeon specific map the temporary monster data chppositionid are loaded into the buffer. A player can move around the map XY ordinates so I do check collision and range for melee and ranged skills so I check against that serverside for each mob to see if the player is in range. With that said when a player gets close to a mob monster agro and AI attacking starts. This is where the Monster AI timer comes into play. So basically the monsters position in the buffer gets synced to that map instanceobject and then sent to the client. My question is Do I just run one main loop to handle all positioning updates and synchronization or do I need each game Instance Object to have their own specific timer

Background color ruins Antialiasing - Link Sun, 30 Aug 2015 07:42:32

Hi all I am having a new problem with my ray tracer. My Antialiasing is simply shooting 100 random rays at each pixel then averaging. This works great but only when the background color is black or white. As soon as I make it a different color every edge above the horizon looks fuzzy. Anyone know why this is I understand that if the sky is black then it adds nothing to the pixel color average and if its white it adds 1 and averages out. Is there a way to add a color in a way that doesnt ruin anti aliasing I should note that this happens to non gradient colored skies too.

Gaming News Headlines - Yahoo News - Link Wed, 02 Sep 2015 11:31:02

ltpgtlta srchttpl1.yimg.combtapires1.2UthO.My79JjhR7te7PcMfg--YXBwaWQ9eW5ld3NfbGVnbztmaT1maWxsO2g9ODY7cT03NTt3PTEzMA--httpmedia.zenfs.comen-UShomerunpolygon.vox.com1a3a53ed272fb7df67d50d3549b3e0bc 30 height86 altBrothers A Tale of Two Sons can now move you on PS4 and Xbox One alignleft titleBrothers A Tale of Two Sons can now move you on PS4 and Xbox One border0 gtltagtBrothers A Tale of Two Sons is available now at retail stores on PlayStation 4 and Xbox One publisher 505 Games announced today. TheXbox One version lists a release date of Aug. 12 and also sells for the same price as its retail counterpart. The gameamp039sPlayStation 3 andXbox 360 versions are available on their respective console stores for 14.99 making the current-gen ports 5 more expensive.ltpgtltbr clearallgt

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68

Welcome to

Floating Point Softwares is an Indie company started in 2015
focusing mainly on Android, iOS, HTML5 and PC game development.
Currently we also offer non-game related solutions, 
such as mobile apps depending on the demand, as well as pixel & vector graphics.

Read more

What's Going On?

Featured Shop Items