Game Development Community

Generating Sprites?

by Arland (Barry) Woodham · in Torque Game Builder · 07/12/2005 (10:41 am) · 4 replies

Ok there is a project I am going to start working on soon that will use a lot a user created sprites which will be created by overlaying multiple sprites and generating a new one from what has bee created. Since there will be several hundred in use at any one time I feel it would be best to go this route rather than storing the overlay infromation and have 5 or 6 times as many sprites. I guess a picture is in order and the closest thing I can think of to what I am talking about is kirby's dream course for the snes.
www.cartoon-combat.com/t2d/kirby.jpg
Basically the user has a simple paint program and can create an icon to represent their player. In my use the program will come with many premade sprites but allow the user to create their own for use as well hence the need to generate image files. So while this is confusing for you to read it is just about as much for me to try to put in words.

What I am asking is for the code guru's out there to give me a place to start looking on how to make this work as a have no idea except for a modifed print screen call that would crop and save, but then multiple resolutions could cause problems.

#1
07/12/2005 (10:55 am)
My first inclination would be to approach the problem as not necessarily trying to generate a valid jpg/gif/png image (which i imagine is a tough task unless tge supports this somehow). Instead, look at is as storing the mappings for a 64x64 block grid. Each block can be a different color, and can be rendered as a block sprite in t2d. The combination of all the seperate blocks is your image. Each block is essentially a 'pixel' in the image. Although, depending on your chosen resolutions and number of objects on the screen at once, this could quickly eat up performance.

edit: while rereading your first paragraph i see where there is a need for many of these objects at once. Hmmmm..... I'll be curious to see others responses on how to handle this.
#2
07/12/2005 (3:24 pm)
I don't think that T2D(or Torque in general) supports this out of the box. I think you might be able to hack in a bit of functionality if you look at the various bitmap handling source files though.(look for SDK/engine/dgl/bitmap*.cc and SDK/engine/dgl/gBitmap.cc files). You could possibly create a function to create a composite bitmap out of several other bitmaps using the info in those files.
#3
07/12/2005 (6:38 pm)
Thanks Joshua at least thats a place to start looking. I knew T2d wouldn't support it out of the box and I figured it would involve some hefty c++ work. I just wanted some opinions from some the coders out there about where to start because I'm only a decent coder not great. Tomorrow I will try to post a little more information that will explain a little better what I am trying to do and why I need to do it this way.

** Off to wonder about hacking the screenshot code **
#4
07/14/2005 (6:37 am)
I've done some groundwork on altering gBitmaps procedurally in C++ via scripted objects ... but it's extremely low-level, clumsy, slow and immature at this point. I'm not sure how long it would take me to write up something on the basics, but I can try if that would help.