Bridge Commander Central

BC Forums => BC Scripting => Topic started by: Nighthawk on June 15, 2008, 03:24:21 AM

Title: multiplayer torpedo types
Post by: Nighthawk on June 15, 2008, 03:24:21 AM
this might sound n00bish, but, is it really necessary to define

Code: [Select]
Multiplayer.SpeciesToTorp.PHOTON
in a torpedo file, no matter the torpedo?

I mean, is it used for something vital like processing shield impacts or such?
if not, can I comment those lines out and still use them in multiplayer?
Title: Re: multiplayer torpedo types
Post by: Picard_1 on June 15, 2008, 03:49:19 AM
I think that's there to define the projectile just like the speciestoship uses the species
number to define the ship in multiplayer. The only way to know for sure is to play multi
with a partner ensuring both parties have the same scripts.
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 15, 2008, 04:00:48 AM
that's almost the main reason why I'm asking that.
I'll be packing a set of scripts for a multiplayer mod, and plan to include everything necessary to put on top of a 1.1 install, so I ask to decide if I pack those scripts or not.

also, the less scripts the engine loads when starting (or in battle), the faster it will go.


(also, offtopic for this, but don't want to make another thread: what's the script you use to have allies and enemies facing each other? the original one had the player facing both allies and enemies...)
Title: Re: multiplayer torpedo types
Post by: MLeo on June 15, 2008, 07:01:20 AM
When you fire a projectile in multiplayer (any projectile) it will send over the NetType (or species in case of ships or icon number in case of an icon, etc, etc) and then, all the other players will know what to fire on their sides. So, if you leave it as a Photon, then all the other ships in MP will fire a Photon Torpedo.
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 15, 2008, 07:17:28 AM
When you fire a projectile in multiplayer (any projectile) it will send over the NetType (or species in case of ships or icon number in case of an icon, etc, etc) and then, all the other players will know what to fire on their sides. So, if you leave it as a Photon, then all the other ships in MP will fire a Photon Torpedo.
you mean, everyone on their end will "see" me fire a photon
Title: Re: multiplayer torpedo types
Post by: MLeo on June 15, 2008, 07:23:26 AM
Yeah, and to them (the clients in this case, so BC) you will have fired a torpedo.
Title: Re: multiplayer torpedo types
Post by: FekLeyr Targ on June 15, 2008, 11:59:54 AM
Aha.
So in short: If you put the line
Code: [Select]
Multiplayer.SpeciesToTorp.PHOTON into (for example) a quantum torpedo script, you fire a quantum torped in mp but all others reconise a photon one instead.
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 15, 2008, 12:15:19 PM
Yeah, and to them (the clients in this case, so BC) you will have fired a torpedo.
Aha.
So in short: If you put the line
Code: [Select]
Multiplayer.SpeciesToTorp.PHOTON into (for example) a quantum torpedo script, you fire a quantum torped in mp but all others reconise a photon one instead.
yeah, but, what do they take damage of?
Title: Re: multiplayer torpedo types
Post by: MLeo on June 15, 2008, 01:37:05 PM
Now, Nighthawk has said it.

That's the entire reason for requiring the same scripts across all players in an MP game.
For the ship firing it will fire a quantum, and will do according damage when it hits.
But for the client, it's a photon, and will do according damage when it hits.

And now, say, for example (remember, this is all if scripts didn't need to match), that the ship hit would have been destroyed when hit by a quantum, but not with a photon.

Big, big Problem. Mostlikely resulting in kicking everyone off the game, at best.
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 16, 2008, 09:06:12 PM
well, with all said, sux to be the one in charge of the scripts....  :(

now, something I still can't figure:
when I put several "phaser" ships like 10 galaxys battling, there's not much lag besides the normal loading time. neither in battle, even with most of them firing photons to each other.
now, when I add several "disruptor" ships (defiants, or BOPs) there is a major drop when they start firing on each other.
even setting the pulses to fire a torpedo instead of a disruptor.
I commented the multiplayer stuff out of the scripts since they're custom-made, thus don't have specific definition

it has to be a scripting issue because the polycount of the ships is not enough to cause a slowdown to the engine (under 10000 polies counting all the ships together, plus torpedoes and phasers)
I made a custom install with only the necessary stuff over a 1.1 game. no extra mods, and no extra plugins, yet the lag still exists >.<
it's driving me nuts....

is there an event that fires when a disruptor-type projectile hits the shields? (it's the only thing I can think about  :?)
Title: Re: multiplayer torpedo types
Post by: MLeo on June 17, 2008, 02:07:04 PM
It's the projectiles (regardless if they are pulse weapons or torpedoes, since both are the same thing, or rather, they both shoot the same thing) themselves.

Limit the lifetime and you should get better results.

This was actually a problem with various StarWars mods, where a single volley from a Star Destroyer (or was that a Super Star Destroyer?) brought down BC to it's knees for some time (on an somewhat older computer).

And that was in QB.
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 17, 2008, 05:11:13 PM
indeed, I started doing that.
it worked fine for torpedo ships and even more in large battles. but for disruptor ships, it's still the same.
it's more heavy when a shoot hits a ship, rather than when its fired. that's why I thought of the shield thing.
Title: Re: multiplayer torpedo types
Post by: MLeo on June 17, 2008, 05:23:39 PM
Well, theoreticly, a disruptor is "heavier", as in, it has more polygons than a torpedo.

I don't know how many a pulse has, but a torpedo has 2 for the core, 2 for the glow, and 2 for each flare. In other words, not a lot.
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 17, 2008, 05:25:48 PM
Well, theoreticly, a disruptor is "heavier", as in, it has more polygons than a torpedo.

I don't know how many a pulse has, but a torpedo has 2 for the core, 2 for the glow, and 2 for each flare. In other words, not a lot.

I changed all to torpedoes. and removed most of the flares, except when needed. although, I think I can resume all in a single plane and get rid of flares and glows too.
just a quick texture work.
Title: Re: multiplayer torpedo types
Post by: MLeo on June 17, 2008, 05:26:46 PM
That's a bit heavy optimization, isn't it?
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 17, 2008, 06:52:28 PM
That's a bit heavy optimization, isn't it?
not quite, there's just 10 torpedo/pulse types for about 35 ships :D
most of them call a single B/W texture, and the color is done by code.

also, in the middle of a fight, who's gonna stay looking at the shot you just fired to see if it's a torpedo or a disruptor? from the player's POV, they're all sphere-ish.
having just 4 races to mod, it's not that hard anyways

EDIT: well, I'm surprised it worked.
cutting the hell out of them except a single texture for each torpedo. that's up to 4 textures to create some 15 torpedoes and bolts for all the races.
in the test field, with the same amount of ships and battle frenzy, there's noticeably less lag. so, I think I'm done :D

another Q: I get the "No module named PhotonTorpedo" error at the console.
that's ok, because I actually removed PhotonTorpedo.py from the folder. the problem comes when I try to change

Code: [Select]
kSpeciesTuple = ---
---
(PHOTON, "PhotonTorpedo"),

to

Code: [Select]
kSpeciesTuple = ---
---
(PHOTON, "whatevertorpedo"),

being it my modded torpedo.
it just freezes QB at start
Title: Re: still the multiplayer stuff
Post by: Nighthawk on June 19, 2008, 08:36:47 PM
alright, trial and error gave me the answer to the last question.
anyways, that seems to have lead me to another one ?.?

the sentence

Code: [Select]
..., App.SPECIES_GALAXY, ...
that is in several scripts, does it specify an integer?
because, in the KM script SpeciesToShip and ShipIcons, every new ship specifies an integer instead of SPECIES_ANYTHING, except the stock ships, that do call App.SPECIES_ship

this far, I could make my own ships work in multiplayer, however icons and TGL names are messed up. but they load the ship they're supposed to load :P
Title: Re: multiplayer torpedo types
Post by: MLeo on June 20, 2008, 05:03:50 AM
Well, considering everything else in KMs speciesTo defines it as an integer, then, yes, they define an integer. ;)


(And yes, they really do that, based on experiments, like printing out the value and the type of the value)
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 20, 2008, 01:45:24 PM
Well, considering everything else in KMs speciesTo defines it as an integer, then, yes, they define an integer. ;)
(And yes, they really do that, based on experiments, like printing out the value and the type of the value)
indeed, I just found out.
I'll have to make a new species table for each race. but, I got to prove my point. putting 100 in the first ShipIconDef instead of App.SPECIES_GALAXY and also 100 in the first SpeciesToShip entry, it actually loaded its icon and ship
now, do I really need TGLs or is there a way to print the ship name in the button by just calling its LongName from the ship file?
Title: Re: multiplayer torpedo types
Post by: MLeo on June 20, 2008, 01:49:10 PM
If you mean the plugin, then you will need to actually load the plugin.


As for races, what exactly are you trying to do? You can just append extra information in the tuple.


For the TGLs, not without surgery to the UI code, it's possible though.
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 20, 2008, 02:03:27 PM
If you mean the plugin, then you will need to actually load the plugin.
I think I can use __import__ and the same name I use to define the icon.

As for races, what exactly are you trying to do? You can just append extra information in the tuple.
I mean, remaking the definitions to use new integers instead of "App.SPECIES_"
I'm attaching the first working, non-finished, screenies

although, it still loads the old Akira icon in the interface, and the new one in the menu, and the ship was not even a SPECIES_AKIRA. it was a SPECIES_FREIGHTER :S

Title: Re: multiplayer torpedo types
Post by: MLeo on June 20, 2008, 02:33:49 PM
It's the speciesToShips that defines the icon.
Title: Re: multiplayer torpedo types
Post by: Kirk on June 20, 2008, 02:37:26 PM
(Sorry I don't intend to thread hijack!)
MLeo, is it possible that this could be the problem that I am having with my install? (http://bc-central.net/forums/index.php?topic=3299.0)
Title: Re: multiplayer torpedo types
Post by: MLeo on June 20, 2008, 02:40:35 PM
Potentially, but I really can't think of anything (there) that could cause it.


But MP doesn't work through that system.
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 20, 2008, 02:45:40 PM
It's the speciesToShips that defines the icon.
that's why I'm lost. I first defined it as SPECIES_FREIGHTER, never as SPECIES_AKIRA.
at most, outside the freighter, it was a SPECIES_AMBASSADOR.
but I can assure you, never an Akira.
Title: Re: multiplayer torpedo types
Post by: MLeo on June 20, 2008, 02:53:47 PM
Code: [Select]
kSpeciesTuple = (
(None, 0, "Neutral", 0),
("Akira", App.SPECIES_AKIRA, "Federation", 1),
("Ambassador", App.SPECIES_AMBASSADOR, "Federation", 1),
The first part defines the ship file (scripts/Ships), the second the icon number, the third the "race", the fourth the "class" of ship (I think, judging from the scripts, it's for things like "Ok, this ship is size 1, the next is size 2, size 2 is bigger/heavier than size 1, think Fighter and Destroyer classes).

Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 20, 2008, 03:00:23 PM
working on it, but still, keeps loading the akira. even with these settings.

Code: [Select]
kSpeciesTuple = (
(None, 0, "Neutral", 0),
("------Curry", 100, "Federation", 1),
("------Prometheus", App.SPECIES_AKIRA, "Federation", 1),
("------Galaxy", App.SPECIES_GALAXY, "Federation", 1),

Code: [Select]
def LoadShipIcons(ShipIcons = None):
if ShipIcons is None:
ShipIcons = App.g_kIconManager.CreateIconGroup("ShipIcons")
App.g_kIconManager.AddIconGroup(ShipIcons)

TextureHandle = ShipIcons.LoadIconTexture('Data/Icons/Bridge/Background/ScreenBlock.tga')
ShipIcons.SetIconLocation(App.SPECIES_UNKNOWN, TextureHandle, 0, 0, 8, 8)

ShipIconDef('------Curry', { 'species': 100 } )
ShipIconDef('------Prometheus', { 'species': 102 } )
ShipIconDef('------Galaxy', { 'species': 103 } )

the Custom\ships\plugin read App.SPECIES_AMBASSADOR. changed it to "100", but still nothing
Title: Re: multiplayer torpedo types
Post by: MLeo on June 20, 2008, 04:59:03 PM
The ShipIconDef will attempt to load a texture called data/Icons/Ships/------Curry.tga


That won't work, I think.


Just make sure the numbers in the kSpeciesTuple match the numbers you use with LoadShipIcons.
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 20, 2008, 07:13:16 PM
The ShipIconDef will attempt to load a texture called data/Icons/Ships/------Curry.tga
That won't work, I think.
Just make sure the numbers in the kSpeciesTuple match the numbers you use with LoadShipIcons.
forget that, it's just a mod-cover thing.
both names point to the same file actually.

it's funny that that file loads an Akira, and the Galaxy one loads the FedStarbase icon. now, the curry pointer calls the sabre's icon file.
meh....
the ships load and work in the game, it's just this thing what doesn't
and also QB freezes and I can't open the console.

EDIT: just solved it. console tracker roxx! :D
Title: Re: multiplayer torpedo types
Post by: MLeo on June 21, 2008, 06:42:22 AM
So what was it?
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 21, 2008, 07:42:34 AM
it was calling Multiplayer.SpeciesToShip.Galaxy, and I removed it from the SpeciesToShip replacing it with my galaxy.
strange thing is, it was calling it from c:\utopia\current\build\
Title: Re: multiplayer torpedo types
Post by: MLeo on June 21, 2008, 07:52:03 AM
it was calling Multiplayer.SpeciesToShip.Galaxy, and I removed it from the SpeciesToShip replacing it with my galaxy.
strange thing is, it was calling it from c:\utopia\current\build\
That's either from one of the original pyc files, or from inside the engine.
Title: Re: multiplayer torpedo types
Post by: Nighthawk on June 21, 2008, 09:30:17 AM
something I just found out and couldn't figure:
all those torpedoes I was talking about, I actually either re-named or removed them. I changed some definitions in SpeciesToTorp so they point to my modded torpedoes, but also commented out the species line in some scripts, to test what might happen.
the point is, in multiplayer, commented out or not, pointed to the right file or not, they still load the torpedo they're supposed to load. and before that, it crashed when it couldn't find PhotonTorpedo.py.

I just don't get it...
Title: Re: multiplayer torpedo types
Post by: MLeo on June 21, 2008, 11:27:59 AM
Well, if a projectile launcher (be it a torpedo launcher or a pulse weapon) can't find the projectile script (doesn't matter if it's QB, SP or MP), BC will crash.
Title: Re: multiplayer torpedo types
Post by: Hunter83 on February 07, 2009, 09:41:49 AM
gOT n LIITLE question here. The Torpedotypes, in Originaly it was this

# Multiplayer specific stuff.  Please, if you create a new torp
   # type. modify the SpeciesToTorp.py file to add the new type.
   import Multiplayer.SpeciesToTorp
   pTorp.SetNetType (Multiplayer.SpeciesToTorp.PHOTON)

The Changed THing is This

# Multiplayer specific stuff.  Please, if you create a new torp
   # type. modify the SpeciesToTorp.py file to add the new type.
   import Multiplayer.SpeciesToTorp
   pTorp.SetNetType (Multiplayer.SpeciesToTorp.AURORATORPEDO)

Is this right so?
Title: Re: multiplayer torpedo types
Post by: MLeo on February 07, 2009, 09:45:08 AM
Assuming that AURORATORPEDO is the constant you wish to identify that particular torpedo with, then yes.
Also assuming that AURORATORPEDO is an unique constant in SpeciesToTorp.py

Please note that this constant has the same implications as with ships, so it needs to correspond to the index in the kSpeciesTuple of SpeciesToTorp.py
Title: Re: multiplayer torpedo types
Post by: Hunter83 on February 07, 2009, 11:49:03 AM
Ok i guess, there are no more Probs with this, but i will move now to an special new Topic, about my Mods and upcoming ships, and the MP-Probs i currently have see in MP-Ships-Problems

Thnx in Anyway

;)