Continuous beam weapons

Post ideas & suggestions you have pertaining to the game here.
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

giantcabbage wrote:
Wed Aug 16, 2017 6:36 pm
Or have different ranges for different types (personally I think it would be good to get more combat occurring onscreen rather than at the edge of the LRS) e.g.
Beams: short range (< screen)
Bullets: medium (~screen)
Missiles: long range (> screen)
If anything, I like to be able to zoom the SRS screen out and see more long-range combat. Other games I play (Endless Sky one of them) seem to have a fetish for short-range combat, which gets annoying at times. Overuse of short-range combat feels more like hack-and-slash instead of a shooting game. Fortunately, Transcendence avoids excessive short-range combat.

Nothing wrong with the suggestion of attack forms dictating range, though.
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!

Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
JohnBWatson
Fleet Officer
Fleet Officer
Posts: 1452
Joined: Tue Aug 19, 2014 10:17 pm

I definitely like that idea. Restricting fast, accurate weapons like lasers to short range, letting bullets be more difficult to use but longer ranged, and (most importantly) making the highest ranged weapons ammo - based or in possession of other significant drawbacks is a good balancing strategy. Lancers were OP in early versions because they had high damage, accuracy, and range. Howitzers, with their high(and more upgradeable than any other lategame weapon) damage, high accuracy, high range, and WMD take this role now. Missiles, on the other hand, seem to get the worst of all worlds, being expensive to use, shorter ranged, and roughly as lethal as moderately upgraded howitzers.
giantcabbage
Militia Lieutenant
Militia Lieutenant
Posts: 104
Joined: Thu Apr 07, 2011 9:05 pm

PM wrote:
Wed Sep 20, 2017 4:35 pm
If anything, I like to be able to zoom the SRS screen out and see more long-range combat. Other games I play (Endless Sky one of them) seem to have a fetish for short-range combat, which gets annoying at times. Overuse of short-range combat feels more like hack-and-slash instead of a shooting game. Fortunately, Transcendence avoids excessive short-range combat.
Being able to zoom the SRS screen so combat was on screen would indeed get the combat to occur onscreen.

Scale the screen to fit what is happening, or scale what is happening to fit the (average) screen...
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

Screen scaling is an advantage Endless Sky has over Transcendence, and since Endless Sky recently implemented their version of autopilot (3x instead of 5x) in 0.9.7, I zoom the screen out more because the time shift offsets slowdown from whatever reason and/or give me more time to react to incoming hostiles while fighting at faster-than-normal speed.
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!

Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
JohnBWatson
Fleet Officer
Fleet Officer
Posts: 1452
Joined: Tue Aug 19, 2014 10:17 pm

PM wrote:
Sat Sep 30, 2017 1:26 pm
Screen scaling is an advantage Endless Sky has over Transcendence, and since Endless Sky recently implemented their version of autopilot (3x instead of 5x) in 0.9.7, I zoom the screen out more because the time shift offsets slowdown from whatever reason and/or give me more time to react to incoming hostiles while fighting at faster-than-normal speed.
I think they use vector images. Much easier to scale those and not look terrible.

Not saying it wouldn't be cool, but it may not be viable.
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

Their images are .png sprites, generally rendered in Blender.
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!

Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

Some games have continuous beams that are not hitscan, but they are always continuous in that if the source rotates, so does the entire beam. I have recreated that effect with a quick small mod. The entire mod is in the code block below. It overwrites the dual laser cannon so that all the player needs to do to play is select the Wolfen. I have not tried to balance the so-called guided laser.

Perhaps something like this could be a way to have continuous beams without them being at relativistic speeds. It also has the side-effect of distance affecting DPS.

Code: Select all

<?xml version="1.0" ?>
<!DOCTYPE TranscendenceExtension>

<TranscendenceExtension UNID="0xd912fff0"
	name=		"(DEMO) Guided Laser (Overwrites Dual Laser Cannon)"
	apiVersion=	"35"
	credits=	"PM"
	extends=	"0x00100000"
	>

	<Library unid="&unidHumanSpaceLibrary;"/>

	; This modified weapon may not be balanced.  This is merely proof-of-concept.
	<ItemType UNID="&itDualLaserCannon;"
			name=				"guided laser cannon"
			attributes=			"commonwealth, EI, energyWeapon, majorItem"
			level=				"2"
			frequency=			"uncommon"
			value=				"1200"
			mass=				"2000"
			description=		"Twin laser cannons manufactured by Earth Industries... until this mod overrode it to fire a single guided beam that rotates in mid-flight with the source."
			>

		<Image imageID="&rsItemsEI1;" imageX="0" imageY="96" imageWidth="96" imageHeight="96"/>

		; MissileSpeed is 100 so that AI can aim the beam properly.
		<Weapon
			type=		"continuousBeam"
			repeating=	"29"
			damage=		"laser:1d4"
			fireRate=	"80"
			missileSpeed=	"100"
			lifetime=	"1"
			powerUse=	"30"
			sound=		"&snLaserCannon;"
			>
			<Effect>
				<Ray	style="smooth"  shape="straight"  blendMode="screen"  width="8"  intensity="45"  primaryColor="#ff0000"  secondaryColor="#800000" />
			</Effect>
		</Weapon>

		<Events>
			<OnFireWeapon>
				(block	Nil
					; Fire the weapon here.
					; Range starts at 2 at the first frame, then increases by 2 per frame until the maximum of 40 for the remainder of the burst.
					(objIncVel
						(sysCreateWeaponFire gItem gSource aFirePos aFireAngle (min (* (typGetProperty aWeaponType "speed") (+ aFireRepeat 1)) 2000) aTargetObj Nil aWeaponBonus)
						(objGetVel gSource)
					)

					; Always override default attack because we fired our beam already.
					True
				)
			</OnFireWeapon>
		</Events>
	</ItemType>

</TranscendenceExtension>
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!

Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
JohnBWatson
Fleet Officer
Fleet Officer
Posts: 1452
Joined: Tue Aug 19, 2014 10:17 pm

I like it - it definitely feels more unique than the current implementation of lancers. The sfx would need a rework, but other than that, it'd be a huge step towards more real options for combat.
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

After more tweaking, I discovered some... issues with guided beams.

For the example mod I posted, I overlooked that missileSpeed of 100 and lifetime of 1 means AI will only shoot at targets up to range 2, meaning it will almost never shoot at all! That can be fixed by putting range into missileSpeed and adjusting the OnFireWeapon event to account for that. AI will still aim badly (if no further corrective code is added) because it assumes relativistic shot, but at least it will shoot.

Aside from the above...

If guided beam has same missile speed as normal beams, then for it to have decent range, it needs to fire the beam for many frames, and for such a weapon to balanced, it needs a long fireRate. Swapping to a weapon that fires much slower than once every two seconds is painful to use as a primary weapon because as soon as the player switches to the weapon, he needs to wait as long as the reload delay before he can fire. It is less problematic as a launcher (and I may add a few mod ammoless launchers that shoot guided beams.)

Also, omnidirectional beam that fires for many frames should update aim so that much of the beam does not miss a moving target. Updating aim during a burst requires custom code.

Finally, if player wants such a weapon to fire continuously as long as the fire button is held, then when the weapon was last fired needs to be tracked somehow. (For that, I probably would use charges to store (unvGetTick), and that makes things a bit more messy.)
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!

Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
PM
Fleet Admiral
Fleet Admiral
Posts: 2570
Joined: Wed Sep 01, 2010 12:54 am

Here is take two on guided (or non-relativistic continuous) beams. This should be usable on playerships and NPC ships (and stations) alike. The only limitation is the item relies on charges. The mini-mod code below replaces laser cannon and the dual and Omni variants. Just select either EI500 or Wolfen to play with them. If you want to see them used against you, pick a fight with Corsairs or Hornets.

Code: Select all

<?xml version="1.0" ?>
<!DOCTYPE TranscendenceExtension>

<TranscendenceExtension UNID="0xd912fff0"
	name=		"(DEMO) Guided Laser v2 (Overwrites Laser Cannons)"
	apiVersion=	"35"
	credits=	"PM (a.k.a. Megas)"
	extends=	"0x00100000"
	>

	<Library unid="&unidHumanSpaceLibrary;"/>

	<!-- Laser Cannon -->

	<ItemType UNID="&itLaserCannon;"
			name=				"guided laser cannon"
			attributes=			"commonwealth, EI, energyWeapon, majorItem"
			level=				"1"
			frequency=			"common"
			value=				"380"
			mass=				"1000"
			description=		"A popular weapon for light freighters and fast gunships. This weapon is manufactured by the Earth Industries Conglomerate."
			>

		<Image imageID="&rsItemsEI1;" imageX="96" imageY="0" imageWidth="96" imageHeight="96"/>

		<Weapon
			type=		"continuousBeam"
			repeating=	"3"
			damage=		"laser:1d3"
			fireRate=	"8"
			missileSpeed=	"2000"
			lifetime=	"1"
			powerUse=	"10"
			sound=		"&snLaserCannon;"
			>
			<Effect>
				<Ray	style="smooth"  shape="straight"  blendMode="screen"  width="8"  intensity="45"  primaryColor="#ff0000"  secondaryColor="#800000" />
			</Effect>
		</Weapon>

		<Events>
			<OnFireWeapon>
				; Max value of charges is 2147483647.  Game ticks after one real-time day passes is 2592000.
				; 31 bits divided by day's worth of ticks is 828.5, or more than two and a quarter years.
				; But not after dividing our shift value.  With 32 or 5-bit shift, player only has 25 days before
				; charges rollover and weapon may do weird things.  Also, maximum range of the beam is capped at 62.
				;
				; But since we do not need time precisely down to a single tick, we can divide our time by 2 or 4 and
				; store that to multiply the maximum time we have before it rolls over.  With only effective 4-bit shift total,
				; we have 51 days, which should be plenty of time to win a game.  With 3-bit shift, we have 103 days!
				;
				; If we divide our time, we need to keep track of shots in case the weapon has a multishot configuration.
				;- - - - - - - - - -
				(block	(	(lightSpeed	100)
						(multiShift	32)
						(theTime	(int (/ (unvGetTick) 4)))

						(beamsPerShot	(count (itmGetProperty gitem 'configuration)) )
						(shotCount	(if (objGetData gSource "d912_Count")
							(modulo (objGetData gSource "d912_Count") beamsPerShot)
							0
						))

						(theData	(objGetItemProperty gSource gItem 'charges))
						(lastRange	(modulo theData multiShift))
						(lastTime	(divide theData multiShift))

						; Allow attacker add to beam length if beam attack was only broken for a brief moment.  Controls don't need to be too unforgiving.
						; If we did not divide our time, five more ticks would be good.  But after dividing time by four, add one to divided time for
						; a window of four to seven additional ticks.  Maybe a bit sloppy, but a good compromise between precision and number packing.
						; For AI that shoots slower than the player, we extend the time window so they can use the weapon effectively.
						;- - - - - - - - - -
						(maxRate	(if (objIsShip gSource) 100 1000))
						(fireRate	(switch
							(eq gSource gPlayerShip)
								100
							(objGetProperty gSource 'fireRateAdj)
								(min (max (objGetProperty gSource 'fireRateAdj) 1) maxRate)
							100
						))
						(graceTime	(max (int (ceil (/ maxRate fireRate))) 1) )
						(resetTime	(add lastTime graceTime))

						(speedRange	(switch
							; First check in case we shoot multiple beams.
							(neq shotCount 0)
								(max lastRange 1)
							(gr theTime resetTime)
								1
							(min (add lastRange 1) (subtract multiShift 1))
						))
						(fireRange	(min (* lightSpeed speedRange) (typGetProperty aWeaponType "speed")) )
					)
					; In case weapon has multishot configuration, count shots.
					(if (gr beamsPerShot 1)
						(objSetData gSource "d912_Count" (modulo (add shotCount 1) beamsPerShot))
					)

					; Update charges with time and beam length.
					; We need to store two pieces of info into charges.
					; One piece is the time, and the other piece is length of the beam.
					;- - - - - - - - - -
					(setq gItem (objSetItemProperty gSource gItem 'charges (int (+ (* theTime multiShift) speedRange)) ) )

					; Fire the weapon here.
					(objIncVel
						(sysCreateWeaponFire gItem gSource aFirePos aFireAngle fireRange aTargetObj Nil aWeaponBonus)
						(objGetVel gSource)
					)

					; Always override default attack because we fired our beam already.
					True
				)
			</OnFireWeapon>

			<OnInstall>
				; If we reset charges on uninstall, it seems like a good idea to do it here too even though I see no reason to.
				(setq gItem (objSetItemProperty gSource gItem 'charges 0))
			</OnInstall>

			<OnUninstall>
				; Reset charges so that items stack.
				(setq gItem (objSetItemProperty gSource gItem 'charges 0))
			</OnUninstall>
		</Events>
	</ItemType>

	<ItemType UNID="&itDualLaserCannon;"
			name=				"dual guided laser"
			attributes=			"commonwealth, EI, energyWeapon, majorItem"
			inherit=			"&itLaserCannon;"
			level=				"2"
			frequency=			"uncommon"
			value=				"1200"
			mass=				"2000"
			description=		"Twin laser cannons manufactured by Earth Industries."
			>

		<Image imageID="&rsItemsEI1;" imageX="0" imageY="96" imageWidth="96" imageHeight="96"/>

		<Weapon
			type=		"continuousBeam"
			configuration=	"dual"
			repeating=	"3"
			damage=		"laser:1d3"
			fireRate=	"8"
			missileSpeed=	"2000"
			lifetime=	"1"
			powerUse=	"30"
			sound=		"&snLaserCannon;"
			>
			<Effect>
				<Ray	style="smooth"  shape="straight"  blendMode="screen"  width="8"  intensity="45"  primaryColor="#ff0000"  secondaryColor="#800000" />
			</Effect>
		</Weapon>
	</ItemType>

	<ItemType UNID="&itOmniLaserCannon;"
			name=				"omnidirectional guided laser"
			attributes=			"commonwealth, EI, energyWeapon, majorItem"
			inherit=			"&itLaserCannon;"
			level=				"2"
			frequency=			"rare"
			value=				"1200"
			mass=				"1000"
			description=		"A single laser cannon with an automated targeting system."
			>

		<Image imageID="&rsItemsEI1;" imageX="0" imageY="192" imageWidth="96" imageHeight="96"/>

		<Weapon
			type=		"continuousBeam"
			omnidirectional="true"
			repeating=	"1"
			damage=		"laser:1d3"
			fireRate=	"4"
			missileSpeed=	"2000"
			lifetime=	"1"
			powerUse=	"30"
			sound=		"&snLaserCannon;"
			>
			<Effect>
				<Ray	style="smooth"  shape="straight"  blendMode="screen"  width="8"  intensity="45"  primaryColor="#ff0000"  secondaryColor="#800000" />
			</Effect>
		</Weapon>
	</ItemType>

</TranscendenceExtension>
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!

Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
Post Reply