Sprite Files for Dummies by Wk15

The best Modding forum in the Armada community, some of the best modders come here.

Moderators: MrVulcan, thunderchero

Post Reply
User avatar
willsk8forfood
Cadet 1st Year
Cadet 1st Year
Posts: 5
Joined: Fri Jun 16, 2006 2:00 am

Sprite Files for Dummies by Wk15

Post by willsk8forfood » Sun Jul 09, 2006 1:53 am

*****************//==============\\**********************
****************//Sprite Files for Dummies\\*********************
***************((-----By willsk8forfood15---))*********************

------------------------------------------------------------------
Introduction:
------------------------------------------------------------------

Yes, I am releasing a small tutorial on sprite modding. Now I am
definitely not the most experienced in this category by any means but
I noticed the community was somewhat let down by the release of such a
tutorial only on pga. I am doing my own version through what I have
figured out myself but mostly through glows that Ryan taught me via IM.
So if this is credited to anyone, let that person be AdmarilRyan,
If you want a better tutorial then go to the only site Ryan released it
on: http://www.phoenixgalacticalliance.com/pGA/index.php and look for
it :p

Ok well I'll try to keep it organized so here ya go.


------------------------------------------------------------------
Table of Contents:
------------------------------------------------------------------

1. Intro to sprites
2. What you will need
3. General Sprites Modding
4. Glows
5. Ending Notes
6. Legal
7. Contacts


------------------------------------------------------------------
1. Intro to Sprites:
------------------------------------------------------------------

.spr or Sprite files are a way to manipulate textures and models to
make certain effects in the game. Wepons effects and other animations all
trace back to a sprite file. Sprites also make up map items like nebulas
and asteroids. And gui files which are different than other sprite
files. Gui files are mostly for the global build button and wireframe
management and the gui_race files are for different races Interface. But
this tutorial focuses more on effects, one of which are engine glows.


------------------------------------------------------------------
2. What you will need:
------------------------------------------------------------------

When adding new sprites to ships like glows for instance, it recquires
knowledge of harpointing. To make life easier for us both, go to Major A
Payne's tutorial and make sure you understand everything there and can
fully hardpoint a model by yourself. MaP's tutorial can be found here:
http://armada2.filefront.com/info/maptut

1. Text editor(such as note pad or wordpad)
2. Some basic modding skills(it helps;) )
3. A modelling program (must be sod compatible)
4. .SOD importer and exporter. Available at http://assimsoft.com

-Thats really all you need. So let's get started


-------------------------------------------------------------------
3. General Sprites Modding
-------------------------------------------------------------------

> Adding a basic explosion sprite:=================================
First, Im gonna walk you through some basic sprite modding. Go to your
sprites folder and open up explosion.spr This sprite file controls how
the explosion textures are used. For learning purposes, we're going to
make a large explosion. Now for this we're gonna use one of Freyr's
explosions from the a2 upgrade project. Go to this link and download the
explosion's tga file:
http://abettermod.com/tutorial/tutexplosion.tga


Heres what that looks like:



Ok, place the tga file into your textures/rgb folder and go back to
that explosion.spr file. At the top you should see some text like this:

__________________________________________________________________

sprite_table

##### Explosion Sprites #####

## SPRITE DEFINITIONS ##

# @reference=texture size in pixels from which the u,v,w, and h values
# were measured. This value will effect all subsequent textures until
# a different value is specified.

# texture cutsize and animation
@reference=128
@tmaterial=additive

bigorange Xcritical01 0 0 32 32 @anim=tex4x4_1.1
sparkball1 Xcritical06 0 0 32 32 @anim=tex4x4_1.3
sparkball2 Xcritical07 0 0 32 32 @anim=tex4x4_1.5

___________________________________________________________________

Basicly, that tells the game what textures are used and the size for
them. For example, the reference bigorange uses the texture, Xcritical01
and tells the game that the u,v,w,h values are 0 0 32 and 32. Thats
saying that the size for the texture is 32 by 32.

OK, right under the sparkball2 sprite, add this line(align as needed):

bigexplosion tutexplosion 0 0 32 32 @anim=tex4x4_1.5

Now you may be wondering what that "@anim=tex4x4_1.5" means. Well if you
take a look at the texture, you'll see it has different "stages". The
anim line tells the game how to handle the sections, or "stages".

Allrighty, now that we've told the file what texture to use and how to
use it. Lets add the node. Near the end you shoul see this:

___________________________________________________________________

# @sprite_node name sprite animation (width,height) (r,g,b)
# RGB Colour values range from 0 (none) to 1.0 (full intensity)

#exposion sprite nodes
@sprite_node critical1 bigorange explode1.1 (40,40) (1,1,1) billboard
@sprite_node critical2 sparkball1 explode1.3 (32,32) (1,1,1) billboard
@sprite_node critical3 sparkball1 explode1.3 (32,32) (1,1,1) billboard
@sprite_node critical4 sparkball1 explode1.3 (21,21) (1,1,1) billboard
@sprite_node critical5 sparkball1 explode1.3 (18,18) (1,1,1) billboard
@sprite_node critical6 sparkball2 explode1.5 (15,15) (1,1,1) billboard
@sprite_node critical7 sparkball2 explode1.5 (12,12) (1,1,1) billboard
@sprite_node critical8 sparkball2 explode1.5 (12,12) (1,1,1) billboard

___________________________________________________________________

Lemme explain this one in steps;

@sprite_node -This is script which tells a2 that it is an actual node
and lets it know that it is a seperate sprite.

critical(x) -This is the name for the sprite. So when you want an
explosion odf to use the sprite, you'll have to make sure
you include the sprite's name.

bigorange -This references the texture handling that we did earlier.

explode(x.x) -This tells the game more details about the animation. This
line references keyframes etc in your animation.spr file.

(xx,xx) -This tells the total width and height of the srite. This is
what controls the scale of the sprite.

(x.x.x) -This is the color defines for the texture file. Since
explosions are already colored, we can have the rgb values
all at 100% so it shows the colors exactly how they appear
in the texture.

billboard -This states that the effect is 3 dimensional. Its neccesary
for viewing the effect from different perspectives.

Small Note: I know this may begin to get confusing, but have patience and
dont give up. You'll know sprites like the back of your hand before you
know it. (*looks at back of hand*, hey thats new!;))

Now replace that last line with:

@sprite_node critical8 bigexplosion explode1.5 (60,60) (1,1,1) billboard

Now when a big explosion sprite is used, it will use the sprite we just
made. You'll notice it because it stands out from the stock a2 explosions
and it'll be really big.


Congratulations!!! You just did your first sprite, Yahoo! Now you should
be familiar with sprites a little more. Hopefully enough to teach yourself
your own tricks. Other than that lets get to the Glows.


----------------------------------------------------------------------
4. Glows:eek:
----------------------------------------------------------------------

Ok, now you're ready to learn one of my favorite things about sprite
modding; Glows. First we're gonna make one using the stock games glow
texture hanldler.

Now glows are a sprite that the game considers a light effect. So
makes sense it would be in the lights.spr file:) So lets open that bad
boy up and get started.

At the beginning you should see:
______________________________________________________________________
sprite_table

##### Ship light sprite effects #####

## SPRITE DEFINITIONS ##

# @reference=texture size in pixels from which the u,v,w, and h values
# were measured. This value will effect all subsequent textures until
# a different value is specified.

# Name File U V W H

@reference=64
@tmaterial=additive

Ballflare xlite1 0 0 32 32
SmallStar xlite1 32 0 32 32
RedMulti xlite1 0 32 32 32
AmberMulti xlite1 32 32 32 32
Spot xlite2 0 0 64 64
Borglight1 xborglight 0 0 32 32
Borglight2 xborglight 32 0 32 32
Borglight3 xborglight 0 32 32 32
flare xflare 0 0 32 32
Borglight4 xborglight 32 32 32 32
dmoonglow Mdmoonglo4 0 0 64 64
softglow xglow_soft 0 0 64 64
_____________________________________________________________________

You see the softglow lone at the end. Thats what we're gonna do to
add our first glow. Scroll down until you get to this:

_____________________________________________________________________

## SPRITE NODE DEFINITIONS ##

# @sprite_node name sprite animation (width,height) (r,g,b)
# RGB Colour values range from 0 (none) to 1.0 (full intensity)

# blue lights
@sprite_node blueconst AmberMulti const (.7,.7) (0,0.5,1)
@sprite_node blueconstbig Ballflare const (1,1) (0,0.1,1)
@sprite_node bluestrobe SmallStar strobe1 (.5,.5) (0,0.1,1) billboard
@sprite_node bluestrobebig RedMulti strobe1 (1,1) (0,0.1,1) billboard

# green lights
@sprite_node greenconst AmberMulti const (.7,.7) (0,1,0)
@sprite_node greenconstbig Ballflare const (1,1) (0,1,0)
@sprite_node greenstrobe AmberMulti strobe (.5,.5) (0,1,0) billboard
@sprite_node greenstrobebig AmberMulti strobe2 (1,1) (0,1,0) billboard

# red lights
@sprite_node redconst AmberMulti const (.7,.7)) (1,.8,0)
@sprite_node redconstbig Ballflare const (1,1) (1,.8,0)
@sprite_node redstrobe RedMulti strobe (.5,.5) (1,.8,0) billboard
@sprite_node redstrobebig RedMulti strobe2 (1,1) (1,.8,0) billboard

# white-ish lights
@sprite_node whiteconst Ballflare const (.5,.5) (.7,.8,1)
@sprite_node whiteconstbig Spot const (7,18) (.7,.8,.8)
@sprite_node whitestrobe Ballflare strobe (.5,.5) (1,1,1) //billboard
@sprite_node whitestrobe2 SmallStar strobe2 (.5,.5) (1,1,1) billboard
@sprite_node whitestrobebig RedMulti strobe (2,2) (1,1,1) billboard

# amber lights
@sprite_node yellowconst AmberMulti const (1,1) (1,1,0)
@sprite_node yellowconstbig Ballflare flicker (2,2) (1,.8,.8)
@sprite_node yellowstrobe SmallStar strobe (.5,.5) (1,1,0) billboard
@sprite_node yellowstrobebig RedMulti strobe (1,1) (1,1,0) billboard
@sprite_node bigbillboard Ballflare flicker (1,1) (1,.8,.8) billboard

_______________________________________________________________________

Now heres where we are gonna add our engine glow. Now right after the
# amber lights definition, add this line(align as needed):

#Tutorial Blue Engine Glow
@sprite_node gcglow softglow const (1.9,1.9) (0,0.1,0.2) billboard

Thats it, you just did your first glow(Yahoo etc ect:p)!!! But now
we gotta add it to a ship. For this example we are going to add it to
the federation enterprise.

Open up ms3d and go to file>import>Armada sod. Make sure it says
Armada 2 sod and not armada 1 sod. Ok, yuo should be browsing in your
a2 sod directory. Find fente.sod and double click. Yay, now you should
see the Federation Enterprise. Go to the joints tab and make sure the
box that says "show skeleton" is checked. If it is, you should see alot
of confusing blue circle things.



Those are joints, or hardpoints as a2 uses them.

Quick note: As stated above, you should be very familiar with
hardpointing as well as the armada 2 hierarchy. If you aren't then I
suggest going back to the "what you will need" section.

Ok, assuming you are familiar with hardpointing lets continue.
On the joints tab still, select the one named "h_lights". Now you
should see some off those blue joint turn colors(normally to green)
like so:



Now with the h_lights joint selected go to the model tab.
Then click joint and click on the top viewport somewhere near
the middle of either of the nacelles. Ok now it should look like this:


(see where the mouse cursor is, thats where you should click)

Now you have to name the joint so it uses the glow sprite we made.
Highlight the joint you just made in the joints tab and in the box
to the right of rename, replace whats in it with this:
gcglow_01

OK, now if all has gone well, you can export the model to sod
and if you look very closely wherever you added the glow. You'll
see a blue glow. But thats only one sphereical spot. To fully
add the engine glow to the whole nacelle, you have to add a new
hardpoint in equal intervals along the nacelle. But to do this
you have to make sure the h_light joint is selected and that you
name each new glow joint according to its consecutive number.
This means that the first glow node was gcglow01 and the second
should be gcglow_02 and so on and so forth. You can view my example:



Now use your Enterprise in game and admire the realistic glowing
nacelles. If the glow seems to big or too small, you shoul've learned
enough in this tutorial to change them to taste.

--------------------------------------------------------------------
5. Ending Notes:
--------------------------------------------------------------------

Thank you for reading this tutorial. I hope it really helps you
to learn how to edit sprites and add glows to the awesome models
I've seen out there. Credits go to Admaril Ryan- for teaching me alot
of what I know about glows, MaP for helping out the a2 community in
so many ways, and the community that supports this. Thank you all!!!

--------------------------------------------------------------------
6. Legal:
--------------------------------------------------------------------

I nor anyone else can be held resposible for damage the use of
this tutorial may do to your game or computer. This includes but is
not limited too Activision, Mad doc, and any of their respective
subsidiaies and or affiliates. And I am only releasing this on a few
sites. You can use this tutorial on your site ONLY if you make sure
you let me know first.

--------------------------------------------------------------------
7. Contacts
--------------------------------------------------------------------

If you need to reach me, my email is willsk8forfood15@abettermod.com.
You can also go to my teams' mod's forum at http://abettermod.com/phpbb

Thats it, Happy Modding everyone


Wk15

User avatar
cecilzero1
Past Administrator
Past Administrator
Posts: 2226
Joined: Fri Apr 25, 2003 2:00 am
Location: from the Dark Side of the moon
Contact:

Post by cecilzero1 » Sun Jul 09, 2006 3:51 am

topic stickyed for now ;)
Image

User avatar
Elrond
Past Administrator
Past Administrator
Posts: 2629
Joined: Mon May 03, 2004 2:00 am

Post by Elrond » Sun Jul 09, 2006 4:28 am

Great dude! Glad to see a tutorial like that for sprites!!! :)
Dead

User avatar
willsk8forfood
Cadet 1st Year
Cadet 1st Year
Posts: 5
Joined: Fri Jun 16, 2006 2:00 am

Post by willsk8forfood » Sun Jul 09, 2006 5:17 am

Glad to give it. I was planning on it taking only about 3 days but It only took a day and a night. Enjoy it guys.

Heh, I like the name. that was a last second thing. Elrond I'll post it on PGA as well. I mistakingly thought Ryan had already done a sprite tut and didn't release there because of that. I'll head on over to pga now :D
[img]http://abettermod.com/images/TSOT.jpg[/img]

User avatar
Elrond
Past Administrator
Past Administrator
Posts: 2629
Joined: Mon May 03, 2004 2:00 am

Post by Elrond » Sun Jul 09, 2006 10:58 am

cool, thanks!! :D
Dead

User avatar
ryan1
Cadet 3rd Year
Cadet 3rd Year
Posts: 66
Joined: Sat Jul 30, 2005 2:00 am
Location: England
Contact:

Post by ryan1 » Sun Jul 16, 2006 6:49 am

he only tut I have written was one on the AI ages ago, lol If I didn't have so much GCSE coursework at the moment I would write one, perhaps I'll have a day for it during the summer.

uss_capital
Lieutenant-Commander
Lieutenant-Commander
Posts: 1091
Joined: Tue Feb 17, 2004 3:00 am
Contact:

Post by uss_capital » Tue Sep 05, 2006 12:39 am

does these work the same way in max ?

User avatar
icewolf132
Lieutenant-Commander
Lieutenant-Commander
Posts: 1026
Joined: Fri Apr 25, 2003 2:00 am
Contact:

Post by icewolf132 » Tue Sep 05, 2006 11:10 am

Yep, except you have to obviously spawn them diffrently in max :)
Star Trekkin' across the universe, because I STILL can't find reverse!

Usage Permission; All are free to use and edit my work in any way they see fit, so long as credit is given where it is due.

User avatar
JkerPlay
Cadet 3rd Year
Cadet 3rd Year
Posts: 80
Joined: Sat Apr 26, 2003 2:00 am
Location: USA
Contact:

Post by JkerPlay » Tue Sep 05, 2006 12:19 pm

Great TUT. I used a similar method to make custom damage Sprites for ships when I was still modding. I found it easier to have a seperate Damage Sprites for each ship as they could be specific to each ship. Great for making a ship look like its missing parts of its hull.

uss_capital
Lieutenant-Commander
Lieutenant-Commander
Posts: 1091
Joined: Tue Feb 17, 2004 3:00 am
Contact:

Post by uss_capital » Thu Sep 07, 2006 12:25 am

icewolf132 wrote:Yep, except you have to obviously spawn them diffrently in max :)
what would be the sprite for engine glow in max ? (tired tonight lol)

User avatar
STA_KID
Cadet 1st Year
Cadet 1st Year
Posts: 13
Joined: Sun Oct 01, 2006 2:00 am

Post by STA_KID » Mon Jan 01, 2007 9:58 am

this is an excellent example tut..ive been attempting to add the glows to stock planets i figured out the spr portion on my own but was missing the portion for the models..ahh the missing link.

User avatar
ryan1
Cadet 3rd Year
Cadet 3rd Year
Posts: 66
Joined: Sat Jul 30, 2005 2:00 am
Location: England
Contact:

Sprite Animation

Post by ryan1 » Fri Feb 09, 2007 12:43 pm

Going Technical: Sprite Animation

Ok willsk8forfood told you how to make things glow, but that is a bit basic don't ya think. Well i do anyways, so i'm going to give you a crash course in sprite animation for Glows. (I just wrote this on the spur of the moment so it isn't gunna win any literature awards. There may also be technical inaccuracys which for super advanced modding matter but for basic sprite modding are fine.)

Now there are two types of animation that can relate to this. (there are others like texture animations but that is another story.)

The two types are "draw" and "colour"

Draw is like a light switch, it has two settings on and off. In the game this is used for things like the lightning in meteron nebulas, it allows things to flash to any timing that you want, however as I said, it has only on and off.

Colour (proper English for color) is what you are likely gunna want to use for glows. It allows for colour changing, including fading between shades and brightness of colours. An excellant example of this is the Dilthium moon. It has a pulsating glow which changes in brightness not shade of colour.

Now to start us off I'll use the animation entry of the Dilithium moon.

Code: Select all

# Dmoon nimbus pulse
@animation moonpulse
colour 2 1.5 linear
@keyframes
0.0	(0,0.5,1)
1.0 	(0,0.2,0.4)
Now this entry explained is quite simple. The first line is the comment by the game developers explaining what the sprite entry is. Note the # at the start of the line works like the // in odfs.

Next is a line which firstly defines this sprite entry as an animation, and then there is a space followed by the unique name for the animation, in this case it is called moonpulse.

The next line basically explains the animation to the computer. First it defines it as a colour animation. Next it states the number of keyframes in the animation which I will explain in a moment. After that it has the total time in seconds of the animation. Finally it has the word linear which all the colour animations have. (all the draw ones have step.) the exact function of this is unknown to me, if anyone finds out I'd be interested to hear.

Next is the keyframes. A keyframe is a stage in the animation where things are at the exact specification as defined in the keyframe. In this case, in the first keyframe at 0 seconds (you must have a keyframe at this point) the colour of the animation is (0,0.5,1) in RGB which is a shade of light blue I think. The other keyframe is the same colour as the ratios between the colours are the same, but as the numbers are lower so the sprite is dimmer. Between the keyframes, the game engine steadily fades from one keyframe to the next, which in this case is how the moon glow dims. As in this case the total time is 0.5 seconds after the last keyframe, the computer will use that time to fade the last frame back into the first one.

Havign made your animation you can allow any sprite to use it. In willsk8forfood's tutorial you used the would "const" in your sprite node which stands for constant. Change that word for the name of your animation and see what happens.

The exact colour of the sprite in any point in an animation depends on three things. Firstly the colour defined in the animation, secondly the colour defined in the sprite node and thirdly, if the texture used is not greyscale but colour. These various factors are blended together to make various shades. When using sprite animation I advice having greyscale textures, the sprite node set to (1,1,1) and let the animation control the colour and brightness. In some cases you may have the texture coloured to allow for different shades of colour to show up in the animation (maybe for a very clever nebula.). If you do have colours for the texture, sprite node and animation it is all trial and error (mainly error) to get it right as it is like mixing various shades of paint.

Now due to hard drive errors in the past i don't have the animations for any neacelle glows that I don't really want to guess the the colour combinations but I think you can work it out from the moonglow one and if you have a nose around your animation.spr file you'll get the idea pretty quickly.

AdmarilRyan

ps: I'd like to thank Icewolf for orginally teaching me the very basics of sprites and inventing the glows thus allowing me to work from there. Also willsk8forfood deserves credit from writing the tutorial I was too lazy to write myself, lol

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests