Topic: Revamp Guns
I know that there has be a lot of requests to add more guns to TeeWorlds in the past. That is not what this post is about. With the current system if the developer wanted to add more guns they would have to add it to the sprite sheet and then every current game.png file on the net would brake. Minecraft realized a few versions ago that using sprites can be a hassle. I say that you strip guns away from the game sprite sheet and create a new system that would be a lot easier to add to. Here is my proposal.
The guns, cross hairs, and ammo above would all be their own separate image. They were also not created by me, who ever did these did an awesome job.
new file structure:
data
└ weapons
├ ammo
│ └ weapon_name_ammo.png/.svg
├ cross_hair
│ └ weapon_name_cross_hair.png/.svg
├ muzzle_flash
│ ├ weapon_name_muzzle_flash_1.png/.svg
│ ├ weapon_name_muzzle_flash_2.png/.svg
│ └ weapon_name_muzzle_flash_3.png/.svg
├ particles
│ ├ weapon_name_smoke.png/.svg
│ └ weapon_name_explotion.png/.svg
├ sounds
│ ├ ammo_pick_up.wv
│ ├ weapon_fire.wv
│ ├ weapon_hit.wv
│ ├ weapon_reload.wv
│ ├ weapon_pick_up.wv
│ └ weapon_switch.wv
├ weapon
│ └ weapon_name.png/svg
└ weapon_name.xml
weapon_name.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<weapon>
<ammo>
<!-- Amount of ammo in a stack. -->
<amount>10</amount>
<!-- How many stacks of ammo a weapon can carry. -->
<ammo_stack>3</ammo_stack>
<!-- Name of the bollet/ammo. -->
<name>weapon_ammo_name.png/svg</name>
<!-- If no weapon can only carry one stack of ammo. -->
<reload>yes</reload>
<!-- Duration it takes to reload. -->
<reload_spead>0.97</reload_spead>
</ammo>
<cross_hair>
<!-- Name of this wepons cross hair. -->
<name>weapon_cross_hair_name.png/svg</name>
<!-- If yes when the player hits "Z" the chamera will move ferther. -->
<zoom>no</zoom>
<!-- How far the camera moves. -->
<zoom_amount>0</zoom_amount>
</cross_hair>
<muzzle_flash>
<!-- First muzzle flash image. -->
<muzzle_flash_1>weapon_muzzle_flash_1.png/svg</muzzle_flash_1>
<!-- Second muzzle flash image. -->
<muzzle_flash_2>weapon_muzzle_flash_2.png/svg</muzzle_flash_2>
<!-- Third muzzle flash image. -->
<muzzle_flash_3>weapon_muzzle_flash_3.png/svg</muzzle_flash_3>
<!-- X position relitive to the weapons image. -->
<x>234</x>
<!-- Y position relitive to the weapons image. -->
<y>15</y>
</muzzle_flash>
<projectile>
<!-- How fast the weapon can fire. -->
<fire_rate>50</fire_rate>
<!-- If yes ammo will ark like the curent grenade loncher. -->
<ark>no</ark>
<!-- Weapon projectile name. -->
<name>weapon_projectile.png/svg</name>
<!-- Weapon smoke name. -->
<smoke>weapon_smoke.png/svg</smoke>
<!-- X position relitive to the weapons image. where projectile and ammo exits. -->
<x>234</x>
<!-- Y position relitive to the weapons image. where projectile and ammo exits. -->
<y>15</y>
</projectile>
<sounds>
<!-- Sound for when the player picks up more ammo. -->
<ammo_pick_up>ammo_pick_up.wv</ammo_pick_up>
<!-- Sound for when the weapon fires. -->
<fire>weapon_fire.wv</fire>
<!-- Sound for when the ammo hits something. -->
<hit>weapon_hit.wv</hit>
<!-- Sound for when the player reloads. -->
<reload>weapon_reload.wv</reload>
<!-- Sound for when the player picks up a weapon. -->
<weapon_pick_up>weapon_pick_up.wv</weapon_pick_up>
<!-- Sound for when player switches to this weapon. -->
<weapon_switch>weapon_switch.wv</weapon_switch>
</sounds>
<weapon>
<!-- How much damage the gun deals. -->
<damage>5</damage>
<!-- Name of the image for this weapon. -->
<name>weapon_name.png/svg</name>
<!-- If yes a second hand will be holding the weapon when the tee looks left. -->
<two_handed>yes</two_handed>
<!-- Image of weapon for when the weapon is fired. -->
<fire_animation>weapon_fire_animation.png/svg</fire_animation>
<!-- X position of hand one. -->
<hand_one_x>234</hand_one_x>
<!-- Y position of hand one. -->
<hand_one_y>15</hand_one_y>
<!-- X position of hand two. -->
<hand_two_x>234</hand_two_x>
<!-- Y position of hand two. -->
<hand_two_y>15</hand_two_y>
</weapon>
<explosion>
<!-- If yes ammo will explode on impact -->
<explosive>no</explosive>
<!-- Image one for explotion. -->
<explosion_1>weapon_explosion_1.png/svg</explosion_1>
<!-- Image two for explotion. -->
<explosion_2>weapon_explosion_2.png/svg</explosion_2>
<!-- Image three for explotion. -->
<explosion_3>weapon_explosion_3.png/svg</explosion_3>
</explosion>
</weapon>
So the weapon_name.xml file is what tells TeeWorlds how this weapon acts and tells it what the names of the files to look for. TeeWorlds will expect to find the ammo, cross_hair, muzzl_flash, projectiles, sounds, and weapon in their repective folders and looks for the file specified in the xml file.
TeeWorlds will take care of everything the gun needs:ex if someone is making a bow n arrow weapon and wants it to arK like the current grinade loncher does all they need to do is set projectile ark to yes and TeeWorlds just knows what this means.
zoom is an atribute that TeeWorlds currently does not have. When the player is holding a weapon that can zoom, when they press the "Z" key the camera will move the distance specified in the xml file away from the player.
ammo stacks and reload is another attribute that is new. if reload is set then the weapon can have more than one ammo stack. when the player runs out of ammo reload_spead is the amount of time it takes to reload a stack. ammo is not reloaded one at a time like the current postal but all at once.
This is a better system because if a server wants to add weapons that is not in TeeWorlds all they will have to do is add an xml file, images, and sounds to their game. if a player does not have a gun that the server uses it will be downloaded for them and placed where everything needs to go. when a player joins a game TeeWorlds will check the xml file to see if they have modified it and redownload the weapon to insure they can not cheat.
Note: FileLocations, filenames, xml order and names are all subject to change. please let me know what you think and if you have any suggestions.
Check out my DeviantArt for all my TeeWorlds art and ideas for Teeoworlds