Image capacities

Hey all, I had a question:

OK, right now, I have an image for every frame of animation. There are 56 total frames of animation (including all the poses, etc) for each type of player. At the moment there is only one type of player, but there will be more. This brings the image total to 56.

I want to display items that are equipped on a player. So, if he picks up a sword, I want it to go in his hand. Now, I have an image for the item, and I have a SpriteManager program which lets me set the orientation and position of any item for any frame of animation. The idea is that I can just have one drawing of the item, and it will handle everything else (hopefully).

Here’s the dilemma: If I use AffineTransform to position the item, I pay a huge CPU cost (for some reason, affinetransforms are slow as dirt). Instead, I was thinking of making a separate image for every item type for every player type for every animation frame. The problem is that if there are 10 types of items and 10 types of avatars, each with 56 animations, that’s 5,600 images!

Each image is 128x128, and uses bitmask transparency. Much of the item images will be empty space.

Any suggestions?

Well for one thing, AffineTransforms aren’t THAT slow. I use them and they work well for me even for large numbers of objects. Also, what about just having each weapon rendered at different angles of a swing? It’s no problem to position them if you already have the right angle you need.

What type of game is this? Is this a Street Fighter type game? If so, you could just pre-render your different frames for the two characters. 56 animations for characters, 56 animations for their item at the moment, maybe much less if you can reuse some, and then 2 characters. That’s 204 images at the most. Not nearly so bad…

You could also go 3D have 1 model for the character, 1 model for the item, then have scripted movement sequences :wink:

[quote]Well for one thing, AffineTransforms aren’t THAT slow. I use them and they work well for me even for large numbers of objects. Also, what about just having each weapon rendered at different angles of a swing? It’s no problem to position them if you already have the right angle you need.

What type of game is this? Is this a Street Fighter type game? If so, you could just pre-render your different frames for the two characters. 56 animations for characters, 56 animations for their item at the moment, maybe much less if you can reuse some, and then 2 characters. That’s 204 images at the most. Not nearly so bad…

You could also go 3D have 1 model for the character, 1 model for the item, then have scripted movement sequences :wink:
[/quote]
Well, going 3d is a pain in the ass, so I’ll leave that to the cool people.

I haven’t gotten to adding the item locations to all of the sequences, but when I do, I will try using AffineTransform to position the items in realtime before I go the caching route.

Right now my game can handle a ton of players on the screen and on the server at the same time, so I have a lot of CPU to play with.

I was having major CPU issues with AfifneTransform, but now that I look back on it, I think it has to do with drawing the image in reverse. When I was facing right (the way the image is originally designed), my FPS was fine, even as I zoomed in and stuff. When I changed direction, my FPS dropped.

I tested this, and it’s true. Try drawing something with a negative width and/or height. It will be painfully slow (compared to drawing the same image with a positive width and height). So, I think as long as I have 4 images for each item (one for a negative width, one for a negative height, one for both negative, and the original), so I’m always transforming to a positive width & height, I should be ok.

I’ll let you know how it goes.

http://ucfpawn.homelinux.com/java/twinserpents/client/GameApplet.html