Jump to content

laser headache


Recommended Posts


the following little bit is about my not for profit star wars fan game "In Defence of the Empire". although its not really meant as rebellion2, i think it might still kinda fit in this forum



consider this.. (in my game)


a star destroyer has 60 turbolasers

a mon cal MC80 has 48 turbolasers

a nebulon b cruiser has 12 turbolasers


now lets say (in my simplified version of the sw universe)

that each ship fires one laser "shot" for each gun, and fires each shot one at a time. After it fires a number of shots equal to the number of turbolasers it has, it waits four seconds (to simulate the recharging of its guns) and then starts the process over again. lets also assume that the power of a turbolaser shot from a star destroyer is the same as the power of a shot coming from any other ship.


sound's fine right? thats what I thought when i wrote the firing code in my game engine. it does a nice job of keeping the screen from getting congested with hundreds of laser bolts, while doing a solid job of depicting ship to ship combat.


I found out that I had a problem when i threw in a little bit of code to actually count how many total shots each ship was taking. the results were as follows:


in one minute:

nebulon b: 120 shots

MC80: 180 shots

Star Destroyer: 183 shots


in 3 minutes:

nebulon b: 292 shots

MC80: 438 shots

Star Destroyer: 450 shots


for a ship with only 12 turbolasers, the nebulon b is doing really well (no wonder they were so popular in rebellion!)


the problem is that 12 shots takes significantly less time to fire then 60 shots. this is only slightly offset by the fact that ships that have less shots to fire spend more time recharging.


There are a couple things that ive been considering to deal with this problem

1. have more than one shot fired at once. the problem with this is that my game is for the most part a tactical fleet simulator, and the screen would get filled up with shots really quick. Not to mention firing 60 shots at once looks unbelievably ridiculous (imagine a green halo of shots launching from your sd)


2. have shots from different ships be different strengths. this is already actually coded, i just have to come up with values to assign, but its pretty hard to figure out how strong each individual shot should be


3. ask the swrebellion community for opinions--which is where you come in!


as always feel free to check out my website for some pictures and boring explanations


Link to comment
Share on other sites

sorry it took so long for me to reply, i was ambushed by final exams.


Thats an interesting idea, I'll have to give it a try.


The other thing I've been toying around with is increasing laser speeds. Currently my lasers are between Rebellion's super slow speed, and the super fast lasers in EvilleJedi's excellent Warlords mod.


I'm giving some serious thought to coding in the ability for a ship to target more than one enemy at a time, but I guess I'm not convinced that there would be any benifits.


Lets take the classic "Thrawn" scenario. An isd is attacked by 3 assault frigates (we'll make them Nebulon b frigates).

currently as the game is coded, the isd will detect all three targets, select the first one and attack it until it's disabled. It will then attack the next one and so on.


If the isd split its shots between two targets would that be seen as stupid or smart? It would certainly look cooler, but wheres the limit? if I allow ships to target multiple enemies, the ships firepower might become so diluted that it is practically ineffective.


it suddenly occurs to me that i need to have some sort of point based ranking system for ships so that the ai can decide when to concentrate its firepower.


perhaps this gives a little peak into the difficulties of even rudimentary ai programming :lol:

Link to comment
Share on other sites

In Rebellion the AI attacks the "most powerful" ship in your fleet. If you let this (your) ship "sit", the enemy ships have to run the gauntlet of your other ships to get to it. But at least the AI fires on these ships until it gets into weapons range. I don't necessary like this; I mean why force your way into the middle of an enemy fleet and be attacked on all sides? Theoretically, if I don't need full power to aft shields because I'm attacking the "leading edge" of the enemy fleet (they're all in front of me), that would mean extra power available to weapons! Plus the enemy wouldn't want his (relatively) weaker ships being attacked against a more powerful enemy ship and would be forced to bring up his more powerful ships to slug it out, or retreat. Definitely better ship combat tactics are needed, and somehow this would all have to tie into an Admiral's stats (assuming one is in command).


I like the idea of splitting ship fire over multiple targets, but only if it makes sense. If all systems on an enemy ship are down or just crucial ones, why keep firing until it's a hulk? This would be the time to start firing on another target while trying to disable the remaining active ship systems of the initial target.


... Guns cannot point everywhere, after all...

There are weapons on the forward/aft/starboard/port sides of ships, why not be able to attack a target in (let's say) two of the four directions (remember the weapons recharge rate is fixed, so it will take longer to "reload" between shots when there are more targets)? This could be optional at the discretion of the player/AI.



PS Yeehaw, I just made Admiral (again) :D

Link to comment
Share on other sites

Definitely better ship combat tactics are needed, and somehow this would all have to tie into an Admiral's stats (assuming one is in command).

There are weapons on the forward/aft/starboard/port sides of ships, why not be able to attack a target in (let's say) two of the four directions (remember the weapons recharge rate is fixed, so it will take longer to "reload" between shots when there are more targets)? This could be optional at the discretion of the player/AI.


Currently ships are organized into fleets. Each fleet has a designated leader that the rest of the ships will (theoretically) position themselves around. Although ships do tend to move towards ships they are attacking, when they are done attacking a target, they are supposed to move back into position with their fleet.


I've decided to change weapon reload times so that each laser has an individual reload time. I have the feeling that this will vastly change around the whole problem, if not completely eliminate it all together. this will mean that each laser will start recharging after it fires, not after every laser fires. In other words, a ship like the executor would have a virtually undistrupted stream of fire, because it has so many lasers that there will always be some recharged ones to fire.


I'll have to work on this over break, and then maybe get a video up. that would be pretty cool.

Link to comment
Share on other sites

alright I just threw together a little video of what firing looks like at the moment.


unfortunately its rather low resolution..

for a clearer picture i reccomend watching it at the origional size




oh yeah, hit testing was turned off for the video (in case you were wondering why the shots pass right through ships)

Link to comment
Share on other sites

  • 2 weeks later...

Hi, just few another random thoughts about your laser headache.


Consider different model. We place turbolasers on "mount points" on the hull of the ship. Each MP has it's arc and power. Arc is determined by MP's placement, power by the total number of turbolasers this MP is representing. Mount point fires on an enemy ship when it's in range and in arc, probably fires at one ship until it's down (makes no sense for a turret to spin left-right until the gunner gets all dizzy :D).


Now, a small example... Lets take an ISD Vivisectionist and place five MPs on it. Fore, fore-port, aft-port, fore-starboard, aft-starboard (or maybe even top/bottom, but it still can reduce the "halo" effect of lasers to reasonable levels) with appropriate arcs and powers 20/10/10/10/10. If this ISD meets an enemy corvette and approaches it from front, it can attack with all three fore MP's, with a total power of 40. If that corvette would attack our ISD from side, only that side's MP's could respond and the power devoted to the destruction of this little corvette would be only 20 (30 with fore). However if the ISD would be attacked by two corvettes from both sides, it wouldn't notice the difference, since both sides would be evenly tearing the corvettes to pieces.


Next, laser recharge rate (keeping separate recharge counters for each MP sounds like a good idea) would not depend on the number of turbolasers the ship has, but instead on it's reactor type (or class) and it's status (damaged, overheating, etc.)


This also brings new possibilities for a ships's commander. First, ships position would be important because of firing arcs, and second, commander would be able to issue orders to take power from aft turbolasers and use it to boost reactor, thus allowing fore lasers to fire for a longer time without recharging. And so on...


Well, just some ideas :)

I don't know how far are you with coding, but the video looks very promising. Keep it up and happy coding.

Link to comment
Share on other sites

  • 3 weeks later...

thats a pretty good way of going about it, but its quite a bit more complicated than Im ready to try right now.


as far as progress goes....

I completely rewrote the entire engine over winter break, and in doing so I incorporated an updated firing mechanism. Both ion cannons and turbolasers are now implemented. ioncannons do more damage to shields and turbolasers do more damage to the hull. shields recharge slowly, but recharge is stopped once the hull is brought down to 20% of its original hit points. The hull can only be damaged when the shield is at 0.


in a test that I just ran:

an ISD mark I took aproximately 2 minutes to destroy a MC80

In the process of which, the ISD fired 342 turbolaser shots and 342 ion cannon shots. the MC80 fired 282 turbolaser shots, and 120 ion cannon shots before being completely disabled.


Ships are capable of targeting multiple targets (although this will obviously dilute the amount of fire that they are able to pour on each)

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...