Author Topic: Ship weapon GFX & multiple ship weapons  (Read 8517 times)

Offline swizzlewizzle

  • Newbie Mark III
  • *
  • Posts: 43
Ship weapon GFX & multiple ship weapons
« on: May 24, 2017, 02:51:08 am »
Just wanted to post this here since I didn't see it covered in any of the design documents.

I know that in AIW 1 most ships had a single weapon that fired from the center of the ship's sprite, though there were some modular ships, champions, etc... that had multiple "weapons", as well as things like the artillery golem that had 50x+ projectiles firing out (which I suppose is a kind of "multi" weapon?).

My question is - in AI war 2, will we be able to define origin points for weapon GFX on models imported into the game? I mean, instead of all weapon GFX popping out of the middle of the ship, being able to set points on the ship (likely at spinal gun mounts, turrets, etc..) for the GFX to come out of?

Doesn't have to have an effect on the simulation, but just being able to define where shot GFX come out of a ship model, as well as the % chance (or if % chance is too cpu heavy, maybe just be able to set a series array of some sort?) for different shot GFX to pop out of a certain shot-origin anchor.

Most ships out there that could be imported into the game in the form of a mod usually have some sort of turrets, spinal mounts, or "gun points", and it would look quite strange to see these ignored, instead having a stream of shot GFX coming out of the center of the ship.

Is it possible to get visual-only "gun mounting points" like this added before v1.0?

PS: Seems that some of the starships seem to have multiple gun points added to them, so perhaps this is something already in, or being planned? Again, I didn't see anything in the design documents so I hope i'm adding something useful here. ;)

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Ship weapon GFX & multiple ship weapons
« Reply #1 on: May 24, 2017, 11:12:15 am »
It is definitely something I'm considering!  I know Keith really would like that, and it shouldn't be too hard to do IF we can get some of the matrix math fast enough.  We already have it set up to where you can set offsets for shots to emit from, though, and so that bit at least shouldn't be a problem.  The main thing would be having multiple visible guns or similar in our own models.  But having multiple emission points is becoming easy with the changes that I'm currently having to make in order to support flatter unity hierarchies.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline swizzlewizzle

  • Newbie Mark III
  • *
  • Posts: 43
Re: Ship weapon GFX & multiple ship weapons
« Reply #2 on: June 13, 2017, 03:17:51 am »
Superb. ;)

Offline swizzlewizzle

  • Newbie Mark III
  • *
  • Posts: 43
Re: Ship weapon GFX & multiple ship weapons
« Reply #3 on: January 20, 2018, 08:26:22 pm »
Hey Chris.

So I got some updated answers to this from the Discord.

One thing that isn't clear still is how to set multiple fire points on a ship (gimbals? Turret locations?) so that it spreads it's "fire GFX" across the ship's surface instead of a single origin point (like the ship's transform you used in your single mesh import vid).

Along with this, it seems that per-weapon targeting is... technically in? It looks like there is a bit more code work required though to get different banks of weapons on a large ship firing on different things?

Basically, I want to avoid a massive ship firing all of it's weapons on a single tiny fighter squadron, when there might be lots of other targets.... in that case, want to have it look more "epic" by spreading the fire around, ala what you would see from a typical star trek/star wars battle. :)

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Ship weapon GFX & multiple ship weapons
« Reply #4 on: January 21, 2018, 06:52:06 am »
Basically, I want to avoid a massive ship firing all of it's weapons on a single tiny fighter squadron, when there might be lots of other targets....
Each weapon system does its own targeting. First it filters down to possible targets, and then sorts those to find the most desirable target(s), and in both cases the result can vary radically based on the weapon system type.

That said, if you've given orders to kill a specific thing, or orders to kill "threats to my shields" (the Defense targeting-policy), it's likely to focus-fire for the purpose of efficiency.

You could add a "Cinematic" targeting-policy to get stuff to spread out its fire gratuitously ;)
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline swizzlewizzle

  • Newbie Mark III
  • *
  • Posts: 43
Re: Ship weapon GFX & multiple ship weapons
« Reply #5 on: January 21, 2018, 11:58:22 pm »
Very cool.

Seems there is no support for setting multiple weapon-emitter points for a ship yet though? All the shots will come out of the center of the ship if I understand correctly?

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Ship weapon GFX & multiple ship weapons
« Reply #6 on: January 22, 2018, 07:11:03 am »
Seems there is no support for setting multiple weapon-emitter points for a ship yet though? All the shots will come out of the center of the ship if I understand correctly?
That's not part of the code I work in, generally, but I believe you're correct: there's only one emission point per model right now.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Ship weapon GFX & multiple ship weapons
« Reply #7 on: January 22, 2018, 11:19:45 am »
Seems there is no support for setting multiple weapon-emitter points for a ship yet though? All the shots will come out of the center of the ship if I understand correctly?
That's not part of the code I work in, generally, but I believe you're correct: there's only one emission point per model right now.

Yep, right now there's only one emission point, although it wouldn't add any inefficiency to the firing code to add more than one.  There are a couple of methods that could be used in order to add multiple firing points, largely based around whether these are vector offsets that get calculated at the time of firing, or if they're transforms that are present all the time.

Personally, since firing is a lot less common than a ship moving (by very definition, practically), that means that probably I just need to make these as vector offsets.  There would then need to be an interface for showing said offsets, and when firing it would just multiply by the transform.forward to do the global rotation to get the correct position in space at the time of shooting.  I think that would work, and I've done similar things in the past in other games.

If these firing offsets were tied to specific weapons, that would also be possible, although in most cases I think it would be overkill.  The trickiest part is that I don't know what we can make this easily moddable in xml -- I mean, we COULD, but in order to do that we'd have to have a sort of "ship designer" screen in the game itself that shows the ship and shows the little widgets for where offsets are, and so forth.

I suppose that one way to handle that would just be to have steps for loading the ship into the test chamber by itself, and then have some hotkeys for "reload just the visual bits that we'd want to modify in here," such as "places I get shot" and "places I shoot from" and all that.  Then you can load in a ship, see it, hit F8 or whatever, and have it reload just the bits in question without doing any form of major reload of EVERYTHING in the game, which would be disastrously overkill and break things during that game session.

Unlike most things that are game-data reloads, that one would probably need to be me setting that up, rather than Keith, because it's going to be super-small and surgical in nature, and intentionally not messing with much of the game state at all beyond things like this.  At the moment, probably JUST this.

This isn't super high on my priority list at the moment, but if there's someone who wants to start going in and actually USE this to make the ship firing look cooler... well, that would bump it up the priority chain quite a bit. ;)  I could definitely see the ship firing being a lot more exciting with things like the starships and guardians if they're emitting a bunch of shots from different guns, rather than from their center, so that the shot patterns from them are really different-looking compared to now.

I've just been thinking out loud in this post so far, mainly.  I can potentially give some of this work to Pepisolo and Goldenwolf, if they wind up having time, since the audio stuff I was going to toss their way is mostly not going to be tossed their way after all, I think.  We do have to be careful only to do this for ships that are already set up with the new painted models, though, because those are getting scaled differently and sometimes shaped differently.  I'm not sure where we are on that list at the moment, but I think it's in the ballpark of 80 remaining out of 140 total.  That was going faster, but then Blue got shifted to the far zoom icons for a while, and Pepisolo and Goldenwolf have been doing final preparations for the Starward expansion.  They're just volunteering their time for AI War 2, so I'm grateful for anything they toss my way, and not about to criticize there. :)

Anyway... big brain dump, but those are the things that come to mind.  Cheers!
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Ship weapon GFX & multiple ship weapons
« Reply #8 on: January 22, 2018, 11:28:41 am »
If these firing offsets were tied to specific weapons, that would also be possible, although in most cases I think it would be overkill.  The trickiest part is that I don't know what we can make this easily moddable in xml -- I mean, we COULD, but in order to do that we'd have to have a sort of "ship designer" screen in the game itself that shows the ship and shows the little widgets for where offsets are, and so forth.
How about, for each system node on a ship definition, there's an optional comma-delimited-list of emission-point-indices, and if that's defined it constrains the random pick for shots from that system to those indicies.

If it's not defined it just picks randomly from all.

If an index is >= the number of emission points it just ignores that index or modulo's it, or whatever.

So it would take some trial and error for a modder if they didn't know which index was which, but I think it would be adequate support.

A partial-reload hotkey that only redoes those comma-delimited-lists (doesn't pick up on removed systems or added systems, or anything else) would be easy enough to do.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Ship weapon GFX & multiple ship weapons
« Reply #9 on: January 22, 2018, 11:42:00 am »
That's true, that would make things easier in terms of doing the initial definitions.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Ship weapon GFX & multiple ship weapons
« Reply #10 on: January 22, 2018, 12:36:44 pm »
Or are you talking about the difficulty of the modder specifying the points themselves?

Can the points be created at runtime (when the GameEntityTypeData table is being read in during app-init, specifically, before any user input or gameplay)? If they can be expressed as, say, 6 floating point number (x,y,z offset, angle rotation around x axis, then same for y and z), then those could be read from the xml.

But I don't know if unity will let those be added in the way that is needed, or if the modder would need to set them up in the unity editor.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline x4000

  • Chris McElligott Park, Arcen Founder and Lead Dev
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 31,651
Re: Ship weapon GFX & multiple ship weapons
« Reply #11 on: January 22, 2018, 01:03:15 pm »
An XYZ offset should be all that is needed, and I can then have it multiply by transform.forward to get it into the correct space based on the orientation of the ship at the time of firing.  Having that in xml would be great, but we'd need:

1. A way to sit there and look at the ship (presumably the test chamber).
2. And have it draw some temporary widges (little balls or whatever -- I can do this easily) to show the emission points
3. And then to have it so that we can reload JUST these super-only-cosmetric pieces of info from xml, and not destroy everything else, for this and future xml-definied pieces of info like this.
4. And then I have some small, simple math to do to make them actually emit from those points, but that's easy.

Incidentally, if we got 1-3 in place, I think that actually that would be a better way for defining the formations (my formations -- the intra-squad ones) compared to what I've so far been doing.  This would let people without the unity editor make formations, and would probably make for more reliable formations in general since people would be typing numbers and looking at real ships rather than looking at abstract boxes.

Actually, this would massively cut down on the time that iterations would take on defining the radius of the squad, too, if we could put that in.  That one's not cosmetic-only, but it would fall under the category of "things that need to be quicker-edited than they are now, and that would fit under this workflow."

I don't know if there's currently a one-button way to reload "here's what's in the test chamber" or not, but that would also be useful, as we used to do that with Valley 2 and it was so helpful for doing particle effects and many other things.

Those things will be coming up increasingly in the coming weeks for Pepisolo and Goldenwolf.
Have ideas or bug reports for one of our games?  Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Ship weapon GFX & multiple ship weapons
« Reply #12 on: January 22, 2018, 02:45:02 pm »
An XYZ offset should be all that is needed, and I can then have it multiply by transform.forward to get it into the correct space based on the orientation of the ship at the time of firing.
Bear in mind that ships are not necessarily facing their targets, and that being able to have "broadside" guns is desirable, hence the rotation. Probably just the one type of rotation (horizontal) is sufficient for most purposes.

Quote
1. A way to sit there and look at the ship (presumably the test chamber).
That would presumably be the way, yes, and we could add xml support for the modder to mark a specific entity-spawning-command as "zoom the camera in on this specific unit when the chamber is done generating"

Quote
2. And have it draw some temporary widges (little balls or whatever -- I can do this easily) to show the emission points
If you can handle the actual doing of it, I can handle adding xml support for the modder to tell you which unit(s) to draw those for.

Quote
3. And then to have it so that we can reload JUST these super-only-cosmetric pieces of info from xml, and not destroy everything else, for this and future xml-definied pieces of info like this.
Adding other parts in the future would be case-by-case, but sure, this would be pretty straightforward.

Quote
4. And then I have some small, simple math to do to make them actually emit from those points, but that's easy.
If you say so ;)

Quote
I don't know if there's currently a one-button way to reload "here's what's in the test chamber" or not, but that would also be useful, as we used to do that with Valley 2 and it was so helpful for doing particle effects and many other things.
The same key-combo that starts the test chamber also completely discards it and regenerates it.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!

Offline swizzlewizzle

  • Newbie Mark III
  • *
  • Posts: 43
Re: Ship weapon GFX & multiple ship weapons
« Reply #13 on: January 23, 2018, 06:46:22 am »
Sounds good guys.

On my side I just need it to make my larger ships look correct. Especially for long ships, having everything firing out the center is obviously a huge problem for any sort of good visual effects.

Other things on my wish list:

- Fighter dogfight tangles (as I posted a few months back where I think you guys were talking about possible solutions) -- basically, allowing fighters and other small ships to visually "look" like they are not just sitting in front of eachother blasting away as if they were capital ships. (evasion-based ships should evade, no?)
- Ships that can act as carriers and automatically shoot out smaller ships to attack things that then come back

That's pretty much it. ;)

Offline keith.lamothe

  • Arcen Games Staff
  • Arcen Staff
  • Zenith Council Member Mark III
  • *****
  • Posts: 19,505
Re: Ship weapon GFX & multiple ship weapons
« Reply #14 on: January 23, 2018, 07:38:57 am »
- Ships that can act as carriers and automatically shoot out smaller ships to attack things that then come back
The Carrier Starship actually produces drones internally and launches them when in combat. They then automatically charge out and attack. If combat ends they'll fly back to the carrier and disappear; other than that they just fight until death.
Have ideas or bug reports for one of our games? Mantis for Suggestions and Bug Reports. Thanks for helping to make our games better!