AndEngine TMX performance - andengine

The performance of displaying TMX maps in AndEngine is poor. Is there any chance of speeding it up? TMXLayer.draw() draws each tile separately. Any chance of putting multiple TMX tiles to a single vertex buffer and drawing them all at once? If so, could someone show some (pseudo) code please?

Related

OpenGL lines in Unity, draw once but show forever?

Right now in my unity project I am drawing OpenGL lines similar to the way drawRay() works in Unity. I have been trying to make it so that once the lines are rendered/drawn they stop redrawing themselves so that I can save on performance.
Is there a way to only draw an OpenGL line once in the OnPostRender() function but have it continually stay drawn in the unity scene as if it were a static image now?
You can't do this
If you want things to persist, then they need to be drawn. You can't have your cake (visible polygons) and eat it too (not draw them).
The only way to save on performance is to batch things together into larger blocks of drawable polygons and draw them all at once in one go.

Hexagon Unity TIles - Slow Performance

When implementing a large hexagonal grid (256x256) of tiles in a Unity game, the game becomes very slow and hardly able to function. The hexagons are in a prefab. A script controls the size of the grid and the spacing between each hexagon. How does one go about rendering a 1024x1024 grid of Unity objects?
When the game is built on Win64 it is also still quite slow.
This is an image of hexagons rendered:
http://i.imgur.com/UbA6USt.png
Try making the grid elements static and make sure static batching is turned ON in player settings. This will optimize their rendering significantly. You probably should even go as far as combining them all into a single mesh (see tools like this one for that purpose).
If you can show us the actual scene hierarchy and the actual structure of your grid nodes then we can help even more.
Because of how Unity works, non-static objects have a tendency to get heavy - they each end up with their own transforms and end up getting drawn even when they're not on screen.
It's the reason more minecraft clones aren't seen coming out of Unity.
If you can't set the hexagons to static for some reason (i.e.: creating procedural levels etc), you'll have to perhaps simulate the hexagons through creative shader manipulation (like saving each mesh into a single array of vertices with a second that tracks a corresponding mesh id) or by writing a script that creates/adds vertices and faces to a single mesh on a single game object.
You may also speed up the scene by creating smaller levels and loading/unloading them as the player moves towards them. See: Application.LoadLevelAdditive

Sprite Kit Load Large Background

Hey guys I'm using sprite kit to develop my game. I just want to create a big world for my player to roam around. But when I use large tile images of 1024 X 768 size it uses a lot of memory which I don't want for sure.
In my game the player as the ability to move in all directions. The camera is centered on the player. I've converted my tiles into 128 X 128. I've loaded all the tiles and added them to the array as in apple's adventure game. But, I want to load only those tiles which are at a particular distance (suppose x =1024 and y =768) from the player. And those tiles which are farther than that specific distance should be removed from the parent.
Is there a way to achieve this? And I'm open to all suggestions. Please Help.
Thank You.
I am currently working on a library for a tile scroller, it's not totally finished but it may suit your needs. It's using a Tableview datasource pattern to ask for the nodes, with a logic for node reuse included, it will going to be asking you for the tiles before showing them, and it will remove the not showed ones. Take a look at it:
RPTileScroller
I take some effort to make it the most efficient possible, but mind, I am not a game developer. I tried it with my iPhone 5 with random colors tiles of 10x10 pixels, and is running on a solid 60 fps.

iphone 2d sprites

I am looking at building a 2d game for the iphone. I am using the cocos2d framework to build the game. However, I am not very good with graphics so I was hoping there were some good repositories out there for some free 2d sprites that are open source. I searched around but most of the articles are 2 years older or more. Does anyone have places they go to get 2d graphics for games? Also could I use 3d graphics in a 2d game and if so any resources for 3d graphics would be nice to.
I went down this road several times before. It is not fruitful. You will spend a lot of time trying to find free sprites. You amass lots of sprites all of which don't really fit what you need in terms of: looks, size, transparency, image format, shape, and what not. You'll waste time converting, scaling, filtering and otherwise mangling with these images. Still, the end result is nothing but a gross mashup of graphic styles.
As a game programmer with no artist, it's your job to define the size and shape of the images used in your game. An artist can later fill these out perfectly.
You'll be much better off to simply use dummy graphics which may not be more than a color gradient, a circle, an X, etc. But at least they're the correct size, shape and format. In particular size and shape will ultimately define how the game plays. You don't want that to be defined by whatever "free sprites" you can find.

how to deform image?

Hi Friends
I Want to make a simple gaming Application in which the user hit the car and car breaks from that point means the image get little deformed when the user hit the car image. I know everything could be possible with using of lots of images and get change when user hit that car image but i don't want to use so many images.
is there any solution for this , how can i deform the image ..sorry for my English but , here i paste a link of the game that is on flash and this is what i exactly want..
http://www.playgecogames.com/file.php?f=657&a=popup
please respond soon
thanks
You don't say if this is in 2D or 3D, or what techniques you're going to use.
If you're implementing the game using OpenGL, it's fairly straightforward. The object can be made up of a regular mesh, with the image as a texture mapped to the mesh. When the user hits the object, you just deform the mesh.
A simple method would be to take a vector in the direction of the hit, displace the nearest vertex by an amount proportional to the force of the strike, and then fan out in to deform the rest of the mesh in decreasing amounts. By deforming the mesh, the image texture will be rendered with all the dents or deformations you like.
If you want to to this without OpenGL and just straight images, you could use image resampling to simulate the effect. You have your original pristine image which is 'filtered' to make up the resulting image. At first there are no deformations so you copy the original image verbatim. Each time the user hits the object, you can add a deformation using a filter or transform within a local region of interest. This function would resample the source image in a distorted manner, causing it to look like the object is damaged.
If you look up some good books on game development, you'll find a great range of approaches to object collisions, deformations and so on.
If you know a bit about image processing technics here is the documentation for accessing the pixels of the image :
Apple Reference
You also have libraries for this such as this one :
simple-iphone-image-processing
But for what you want to do this might not be the easiest way. What I would suggest is that you divide the car into several images depending on what areas can be impacted. Then you just change the image corresponding to the damaged zone each time the car is hit.
I think you should use the cocos2d effects http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide%3aeffects + multiple images. Because there are many parts which drops after the player kick the car. Like when user kick the side mirror you should change the car image with without side mirror car image.
The person that has made that flash game used around 4 images to display the car. If you want the game to be in 2d, the easiest way is to draw the car, cut it into about 4 pieces (: left side + right side (duplicate of the left side) hood and roof).
If you want to "really" deform the car you'll have to use a 3d engine like openGLES.
Id really suggest doing it in 2d :)
I suggest having a look at the cocos2d game engine. You can modify images with effects, which are applied using a virtual grid. Have a look at the effects page in their programming guide.