[epiar-devel] Weapons Design

Maoserr maoserr at gmail.com
Mon Dec 7 07:09:05 PST 2009


It might be worthwhile to have an 'ShipOutfit' class and derive the  
'Weapon' and 'Ammo' from it.  Also I think a single weapon slot should be  
able to fire multiple types of ammo (I.E. a missile launcher can fire both  
Official missiles and Black market missiles).

Also in EV, all 'ShipOutfit' had mass, and this might be one of the  
constraints in addition to the number of slots, we should really put this  
in a Wiki page and flush all the requirements out (perhaps not important  
until we have more code though).

Another thing to think about is if we want a FighterBay to be a weapon or  
a separate type of Outfit (it would fire Fighters).  But perhaps thinking  
that far ahead would complicate things.

The type of of design I'm actually thinking about is this:
1) Player presses a key to fire some sort of weapon
2) The 'Weapon' class has a Lua callback function for the action 'Fire',  
and then the Lua code takes care of decrementing the ammo count/reducing  
energy/send the player back due to the recoil, etc etc.  The 'Fire'  
callback could even accept arguments (IE different firing mode: spread  
fire vs. concentrated fire vs. multifire vs. ...) and decide how the  
weapon gets fired.
3) The Lua callback then launches whatever Ammo, beam, etc, and attaches a  
call back to the ammo with some default properties (i.e. the ship that  
fired it, the target of the ammo, the initial velocity)
4) The ammo callback then launches on update and checks for modification  
to its parameters (interference due to environment, enemy guidance  
scrambler, heck, the enemy could even have a "retargeting" outfit that  
redirects the missile back at its own ship for all that matters)

Might be too complicated to implement, but worth considering.

On Mon, 07 Dec 2009 09:28:55 -0500, moses <moses7 at mchsi.com> wrote:

> I think that's great.  What about automatic targetting weapons for close
> encounters at less damage?
>
> On Sun, 2009-12-06 at 20:55 -0800, Shawn Reynolds wrote:
>> The weapons system is an important part of the game and I want to make  
>> sure that it will be scalable to meet our needs in the future. So I  
>> wanted to let everyone know the design and get their opinion.
>>
>> So my design is the following I have a weapons class which contains a  
>> list of weapon classes. The weapons class holds the list of all the  
>> weapons available in the world. The weapons are parsed from xml file  
>> and contains the attributes specific the weapon.
>>
>> When the players ship is created he gets a list of weapons available to  
>> the ship. New weapons can be added to the ship simply by adding it to  
>> the ships weapons list. The weapons are copied from the master list to  
>> the ships.
>>
>> So here is where I have a question... Should the ammo be stored with  
>> the ships weapon list (ie every weapon has unique ammo) or should I  
>> track ammo separately so that we can have different weapons share ammo?
>>
>> Anyway back to talking about the design. So the ship class has a fire  
>> function that calls the selected weapons fireWeapon function. When the  
>> weapon is fired it checks the weaponType that was assigned to the  
>> weapon. If the weapon is of type projectile (iemissiles, photon  
>> torpedo's) then it will spawn a projectile sprite and add it to the  
>> world with the properties specified in the selected weapon. The  
>> projectile sprite is the missile at this point and  gets its  
>> coordinates and direction from the ship. I setup weapon types so that  
>> we could have other classes for different types (ie energy weapons)  
>> that way they can behave differently then projectiles.
>>
>> Also we are planning on adding lau code for the ai of the missile, that  
>> way we can do homing missiles.
>>
>>
>> Shawn
>>
>>
>>
>>
>> _______________________________________________
>> epiar-devel mailing list
>> epiar-devel at epiar.net
>> http://epiar.net/mailman/listinfo/epiar-devel
>
> _______________________________________________
> epiar-devel mailing list
> epiar-devel at epiar.net
> http://epiar.net/mailman/listinfo/epiar-devel




More information about the epiar-devel mailing list