Tag Info

Hot answers tagged

50

My suggestion Too many small PNGs will add a lot of network overhead (because of the size of the HTTP requests, but also the PNG header, and, probably even more importantly, the inability to compress efficently). On the other hand, one very large PNG has the drawbacks that it takes some time to load, and needs to stay permanently in memory (40 megabytes for ...


16

You need to set the sampler state. The default for SpriteBatch is SamplerState.LinearClamp (ie: linear interpolation - the smooth/blurry one). Choose one of the SpriteBatch.Begin calls that takes a SamplerState and pass in SamplerState.PointClamp (selects the pixel at that precice "point").


16

Am I the only one who uses SpriteSheetPacker? It's free and open source so you can modify it and learn how it works.


12

From the problems that you are having I recommend that you do the following: First, work with layers and folders. It really does help, Group individual sprites together in folders so that you can move the whole of them around and parts that are replicated should exist on seperate layers. (So if there is a sword or something it should be on a layer, eyes ...


10

You can always make looong buffer "vertex;texcoord" repeat. And just use indices how you said. It is propably most easy and kinda similar to what you know. If you want to save some memory. There is pretty neat solution and it is to have one sprite in buffer with unite texcoords and create UVs transformation matrix and send it to your shader and multiply ...


10

To do this effectively without 'generating all possible options,' you're going to want to use a layering approach... at least in theory, even if in practice you eventually collapse the layered textures to a single sprite for draw-call reduction, which I think you should and will detail later. The layering approach involves having a sprite set for all your ...


9

The problem with using texture atlases and adjacent texels leaking has to do with the way linear texture filtering works. For any point in the texture that is not sampled exactly at the center of a texel, linear sampling will sample 4 adjacent texels and compute the value at the location you asked as the weighted (based on distance from the sample point) ...


9

I've been using TexturePacker to create sprites from a folder of PNG images. I'm porting a game originally developed in Flash, so I'm simply exporting each frame of the MovieClip to png and then importing those images in Texture Packer. Another similar tool is Zwoptex (The latter is Mac software, but TP has a version for Windows too.)


8

It is possible that the total size of a sprite sheet will affect performance of your game in some reasonably small fashion. Extremely small sprite sheets generally mean that you have many, which in turn implies many state changes, and frequent state changes are not good for performance. Extremely large sprite sheets consume more GPU RAM, and if they need to ...


8

Regardless of the level of details and the number of pixels you have, you must start with a thorough understanding on how walking works. If your character looks like shaking its legs, it probably because, that's all you drew : shaking its legs. Just search "Walk cycle" with google image and you'll find plenty of examples. Here is a little example of what ...


6

http://spriters-resource.com/ has tons of different spritesheets from games.


6

I bet it's because AnimationDelay manages to make it past 6 somehow. I'd change the if statement to: if (AnimationDelay >= 6)


6

Most sprite sheets of non-identical dimensions usually have some kind of meta data with where the anchor of the sprite is. There are a lot of tools that do things like strip out full alpha pixels and give you the data you need so that this data isn't manually generated. If you don't have this meta data you have to author it yourself. The most accurate way ...


6

ImageMagick's montage command can do this. For example, to compile a bunch of irregular-sized sprites into a sheet of 32 × 32 pixel tiles, you can do: montage sprite*.png -geometry "32x32>+0+0" -background none sheet.png The -geometry "32x32>+0+0" option above will resize all the sprites to 32 × 32 pixels (adding transparent space ...


6

It may not be a direct answer to your question, but it is my advice ;) Do not move your sprites based on the number of frames, but do it based on wall-clock time. Why? Oh well, it is very easy for a game to have a variable frame-rate, so, imagine your character is jumping from platform to platform, and the PC lags for some reason. If his movement is based ...


5

One solution would just be to pack as much as you can on a single sheet: Texture packing algorithm Part of the data that results from that is where the sprite is in the texture and how big it is, so you can use that information to draw the portion of the image that you need for a given sheet. Be sure to not use mipmaps, though.


5

You're telling it how many rows and columns it has. Simply also tell it how many sprites it has on it. Therefore allowing you to skip over the final sprites as you loop. (I assume you know how to index rows and columns with / and %? If not then this will tell you.) So for something like this: const int rowCount = 3; const int columnCount = 6; for(int i = ...


5

Since you wont answer my comment above I will give you a few options. 1 . Use a tilesheet that spans multiple Textures. 2 . Use a List<Texture2D> You can make this easier by making a png sequence with BigImage0001,BigImage0001,BigImage0001.... Import all of those. Make a method that takes a name, Trailing numbers, and total frames. Have it ...


5

Basically if you are targeting towards Direct9 then you can't use HiDef. You could always create a smaller animation and just set the scale to a higher amount(allowing it to zoom in on the image), if its a vectors image it won't skew the image.


5

Don't think there is a huge advantage to using one or the other, but it makes porting your game/graphics a lot easier, as any platform can use spritesheets. If you are doing a strict flash game, probably comes down to preference/quickness.


5

Some popular flash game engines (eg. flixel) use sprite-sheets for sprite-animations. This is mainly because they also implemented a bitmap-based rendering engine which doesn't use the native flash display-classes like "Sprite", "MovieClip" for each object but rather a big bitmap-image where stuff is drawn onto using pixel-operations. Using a bitmap-based ...


5

How is the rotated sprite generated? Are these screenshots of a rotating 3D model? The facing angle could be off due to the camera perspective of the 3D modeling tool. Isometric perspective is not an accurate representation of the 3D space. Stuff far away from the 'camera' does not get smaller. If you just want a quick fix. Solution 2 might be difficult ...


5

One huge spritesheet is (likely) going to give you better performance, simply because one of the biggest causes of lag is the round trip from browser request to server to browser. 10,000 HTTP calls is going to take much, much longer than 1 HTTP call that returns a file that is 10,000 bigger. There might be other things you can use to decrease lag, ...


5

My TexturePacker currently supports Ubuntu. What Linux would you need? The command line works too - and it has all the features you need.


5

First of all I recommend separating it so that the frame is updated in the Update method instead of the Draw method. That's because XNA is free to skip a few Draw calls to make up for lost time when the game runs slowly, but not Update, so it should run more consistently. It's also a better idea to leave the Draw method just for rendering, and putting any ...


5

Swapping textures will kill your performance. Modern hardware has only gotten more susceptible to this problem, not less, as the speed and power of the shader units and video RAM are growing much faster than the speed increases of the bus between system RAM and the GPU. The only sane approach is to cut down your texture sizes, or generate procedural ...


5

Try Sprite Decomposer or Sprite Vortex, I believe both of them have automatic sprite cutting based on alpha.


5

Unless you have a high frame rate and very low size requirements, the number of sprites you're talking about won't matter compared to, say, the audio files (especially music!). If game size was the only requirement, I'd say go with pre-baked animations. As long as you only have ten weapons, either way will be roughly the same amount of work for the artist; ...


5

The idea behind condensing sprite sheets is that the actual loading of the file (the sprite sheet) is considered heavy lifting in any game system. Imagine you have this system where all your data types are highly optimized and all these algorithms to reduce the memory foot print but then you have to constantly bottle-neck memory with loading and parsing ...


5

After spending a week searching the web and checking every related blog post, i found the solution. http://www.denysalmaral.com/2012/04/px-spritesrender-3ds-max-scripted.html This script renders and names the images perfectly, after it i combine them using "GlueIT" Works like a charm, Hope it will help others.



Only top voted, non community-wiki answers of a minimum length are eligible