Tag Info

New answers tagged

0

I just figured it out. The mGridPositionOffset is pointing to the top-most corner of the grid. So that makes it (grid.height + mGridPositionOffset.height). As you can notice. That was very wrong. The mGridPositionOffset is already accounting the height of the gridBox plus the grid height. I just figured it out when I make realtime and actual measurement. ...


1

I can't quite spot the error in your code, but this looks odd. cocos2d::Size gridPixelSize = cocos2d::Size(mGridSize.width * mOffset, (mGridSize.height-1) * mOffset); Why the - 1 on height? Also, in general to do something like this, you should abstract away the screen coordinates entirely. Make a hierarchical system so that when handling clicks, you ...


1

The fast and simple solution is just to increment all returned Y values by 2. I'm not seeing an obvious error although I can't see the whole situation. I suspect when you subtract 74 pixels to offset the grid you either did or didn't also subtract 74 pixels from every pixel input to methods. It may also have something to do with your offsets or your ...


0

As mentioned in one of the comments, you want to partition the world into sections by using oct/quad trees. Then as the player moves, using the tree you can quickly get all the nearest elements in your world. Only those closest to the player are the ones you have to react to.


2

Typical approaches to reduce processing are: Spatial subdivision / coherence - Don't process everything in the whole world, instead only do so in pertinent regions - usually only those in close proximity to the player(s). - Group units close together as a single unit to reduce overall count (Rome: Total War). Common in real-time rendering fields. ...


4

One way to go is to split the whole world into chunks, and load just the chunk the player character is currently in (or any number of chunks that are closest). This way you only have to listen for events in this chunk. This does not mean you have to split everything into "levels". Minecraft is a fairly good example of splitting a giant world into chunks that ...


0

Trabant is a rapid prototyping tool for nailing the game mechanics only. It sounds like a perfect fit for you, as it has ugly graphics, no animations, and it is very basic but also extremely powerful. Disclaimer: I'm the author of Trabant. Hope you find it useful!


0

I agree with everything @Waterlimon stated, that's how our custom game engine works: traverse the scene graph, collect every item to be rendered into either an opaque or transparent render queue (each entry is a pointer to a mesh plus the current world matrix for that mesh and any other render values calculated during the scene graph traversal, like ...


2

As far as I know, modern high performance rendering engines gather render operations into a so called "render queue". Each such operation is basically a single drawcall: it has buffers, shaders, shader uniform data, textures, whatever other state needed... These are then sorted, most expensive to switch property first. Shaders are expensive to switch, so ...


1

There isn't any libGDX function for this particular problem, but it should be something like: Vector2 closestToFinger(Vector2[] vectorsArray, Vector2 touchPosition) { float shortestDist = 0; Vector2 closestVector = null; for(point in vectorsArray){ float dst2 = touchPosition.dst2(point); if(closesVector == null || dst2 ...



Top 50 recent answers are included