Join us at the Oolite Anniversary Party -- London, 7th July 2024, 1pm
More details in this thread.

RFC: Fancy classics

General discussion for players of Oolite.

Moderators: winston, another_commander

User avatar
Griff
Oolite 2 Art Director
Oolite 2 Art Director
Posts: 2479
Joined: Fri Jul 14, 2006 12:29 pm
Location: Probably hugging his Air Fryer

Post by Griff »

Here's the recoiling turret shader

This is a Vertex Shader.

Code: Select all

varying vec3         v_normal;      // Surface normal
varying vec3         v_pos;      // Vertex/fragment position in eye space
uniform float  laser_heat_level;
float recoil_offset = laser_heat_level * 28.0; // tweak the 28.0  
float vertex_Z_pos = gl_Vertex.z; 
  
void main()
{
   v_normal = normalize(gl_NormalMatrix * gl_Normal);
   v_pos = vec3(gl_ModelViewMatrix * gl_Vertex);

// make a copy of current vertex's positon data but subtract the 'recoil_offset' from the Z component
   vec4 recoil_deform_effect = vec4(gl_Vertex.x, gl_Vertex.y, gl_Vertex.z - recoil_offset, gl_Vertex.w);
   
   gl_TexCoord[0] = gl_TextureMatrix[0] * gl_MultiTexCoord0;
   
// check the current vertex's Z position, if it's greater than 50 use the modified position from 2 lines above, else use the unmodified position data   
if (vertex_Z_pos>50.0) // check the vert Z co-ords of your model in Wings and modify the 50.0 as required
       gl_Position = gl_ModelViewProjectionMatrix * recoil_deform_effect;
   else
   {
       gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
   } 
   
}
in shipdata.plist the only uniform used is this

Code: Select all

laser_heat_level = { binding = "laserHeatLevel"; bindToSubentity = YES; };
which binds the Oolite laserHeatLevel to the shaders "laser_heat_level".

The important lines to tweak are, Line 4:

float recoil_offset = laser_heat_level * 28.0;

the 28.0 controls how much of a recoil there is going to be, laser_heat_level is in the range 0.0-1.0 so at it's maximum it can only subtract 1 'unit' from a vertex's Z position, at Oolite ship scales this isn't very far at all so the 28.0 multiplier will mean that at it's maximum effect the barrel recoils 28 'units'.

the next important line is line 16:

if (vertex_Z_pos>50.0)

you'll need to modify the 50.0 to whatever the Z axis cutoff point for deformation is in your model. In the boa turret, the ball section stops at about Z.pos

= 49.9 and the barrel base starts at Z.pos =50.1. having this 'if.. else..' check on the vertex's Z position and then only applying the deform if the Z

position is greater than 50.0 means that only the barrel section of the turret model will recoil and not the 'ball' section, the turret basically moves back into and through the ball section.

Here's a screen shot of the ball turret object, notice the flattened side of the ball and the tiny gap between the ball and the tube, this acts as the cutoff point for the deform effect

Image
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Simon B wrote:
... It is also not possible to have any laser weapon type other than thargoid_laser?
Well, Oolite knows five laser types: WEAPON_PULSE_LASER, WEAPON_BEAM_LASER, WEAPON_MILITARY_LASER, WEAPON_MINING_LASER, and WEAPON_THARGOID_LASER. You can chose any of them, but the former four will fire only straightforward. Only the last follows its target (= is turreted). According to the information from Eric and Thargoid it fires from the centre of the entity it is defined for.

By the way: It doesn't have a 360° firing range. Have a look in the thargoid entry of Oolite's shipdata.plist. You will see that actually front laser and rear laser are defined as thargoid lasers. So technically the thargoid laser is an ordinary laser which only fires in one direction, except that it has a wide angle.

What you cannot do--if this is actually your question--is define other (new) laser types different from the five pre-existing ones. You also cannot change any characteristics of the said five types, except their colour, and--within limits--their weapon_energy (limits: works only for front laser, only up to a value of 50 (so you can't soup up a mining laser, it has already a default of 50), and only for NPCs).
By the way: So far also my efforts to place a Thargoid laser on a subentity haven't brought satisfactory results. I tried to give the Thargoid Carrier three turreted lasers instead of one, but either the subentity lasers didn't fire at all, or in random directions independent of the main laser.
How does that work? Surely the main laser is a subentity? I'm going to have to go look...
No, it's a property of any entity. Usually the main entity. And there are four main lasers (player; all directions) or two (NPC; forward and aft). And it seems as far as working thargoid lasers on subentities are concerned I am not the authority to trust:
Eric Walch wrote:
The thargon threat cruiser and battleship have thargoid lasers on their subentities. And those subents are define as frangible, so you can shoot them off. I always liked that on those cruisers. Because you can shoot off the lasers they become less strong after some time of battle. (aim at the top part)
Thargoid wrote:
In Aquatics I've given the Leviathan platforms quite a number of them, and they certainly don't all shoot from the same point. You get quite a light show in fact, only slightly hindered by the fact that they all have the same target. It would look much nicer if they could have independent targets, as I said earlier.
Seems I should study those and revisit the Thargoid Carrier... :wink:
BUT: nobody knows if the firing frequency of lasers can be customized?
No, it can't. T'is hardcoded like all laser specs.
Lets think outside the box here....

Speculating: I can slow down a military laser by designating a pulse laser but setting weapon_energy=50; ??
Well, first of all, the weapon_energy of a military laser is 23, not 50. (As always the rule should be: Please consult the >WIKI< first.) Second, the laser types do not only differ in frequency and energy, but also--and most important--in firing range. If you are able to browse the code, you'll find the values in ShipEntity.m. And they will tell you that the pulse laser has a range of 12500 meters, while the military laser fires up to 30000 meters. Therefore even a souped up pulse laser will never become a military laser. If your NPC with a energy-50 pulse laser attacks me, I smile and blast him to pieces from the distance. :twisted: OTOH the souped up pulse laser also won't overheat like a military laser, so in close combat it could have its advantages. But only in close combat, see above.
If I mix laser types, I mix firing frequencies??
You can't "mix". The five laser types are distinct. If you put (in different sub-entities; works only for NPCs) more than one forward pointing laser on a ship, each of them fires independently of the others. So if you put one pulse laser next to one military laser, you will have one pulse laser and one military laser, and each of them will fire according to its characteristics.
I was also speculating that it may be possible to set a ship so that it will not fire unless another ship has already fires - in a script? Then, if I set that ship as a subentity... will that ships script still control it enough for the fire-control rules to be kept?
Sounds at least very complicated to me. Usually ships fire when attacked, or when attacking; and that is decided in their AI. The case of an entity attacking (= firing) when another entity is attacking would be that of an escort. Subentities, however, become a part of their main entity (mother).
Technically, I can have lasers cycle-fire by specifying a seperate model for the whole ship for each laser. As each one fires, the ship gets replaced with one that has a different fire position. (I'd rather not do that...)
I doubt it. I guess in the end it wouldn't work. And by the way, as in 1.72.2 (and since 1.69 or so), also in 1.73 the weapon_position_foos won't work. As a result all lasers fire from dead center, regardless which position you have given it in shipdata.
Lastly - can I specify in a requires.plist that another oxp be installed or not present?
No, not in requires.plist.

You can, however, check in your script for the presence of other scripts (code snippets around here a couple of times). So if the OXP you want to check for contains a script, you can do it. If it doesn't, you can't. At least to my knowledge; don't know whether there were changes in Oolite which would permit what you want since February, but I doubt it.

*****

On a side note: in my understanding all of this belongs into the Expansion Pack section of the board, not in Discussion.

Simon, would you mind opening a thread over there for your next questions? I promise, I'll read them just as if they were posted here. :wink:
User avatar
Kaks
Quite Grand Sub-Admiral
Quite Grand Sub-Admiral
Posts: 3009
Joined: Mon Jan 21, 2008 11:41 pm
Location: The Big Smoke

Post by Kaks »

Very comprehensive answers, Commander!
However, this
And by the way, as in 1.72.2 (and since 1.69 or so), also in 1.73 the weapon_position_foos won't work. As a result all lasers fire from dead center, regardless which position you have given it in shipdata.
has been corrected in trunk, and laser positions can be set properly in the upcoming 1.73!
Cheers,

Kaks
Hey, free OXPs: farsun v1.05 & tty v0.5! :0)
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Post by Commander McLane »

Kaks wrote:
Very comprehensive answers, Commander!
However, this
And by the way, as in 1.72.2 (and since 1.69 or so), also in 1.73 the weapon_position_foos won't work. As a result all lasers fire from dead center, regardless which position you have given it in shipdata.
has been corrected in trunk, and laser positions can be set properly in the upcoming 1.73!
Now that's what I call good news!

Cheerio, Kaks! :D :D :D
User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

Post by Simon B »

Discussion about laser and turret issues with the megaships has been moved to a more appropriate forum.

It seems that if I want laser turrets, I must give a thargoid laser ta a subent and remember not to initialise it as a ballturret.

I have got the megaships uberlaser going, set up a combat, and just watched one chew through a std thargoid.

I didn't think that it would be able to get all six lasers an the same target because they are mounted in triples, either side of the dock (wider than a ship - I have been able to fly between the beams of a iguana in a gecko for eg.) But it seems that it can.

It probably should not be possible to take out a ship the size of a thargoid in one shot...
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

..

Post by Lestradae »

Simon B wrote:
It probably should not be possible to take out a ship the size of a thargoid in one shot...
Well, now you'll have to pep up the thargoids a bit, too. :P

As of now, thargoid carriers for example are sitting ducks. They should be turret-infested citadels in my opinion, busy churning out their warships which, in turn, should throw out an army of thargons.

They should be a fearsome invasion fleet imo, not something tuned to be merely hard for a single Cobra Mk III pilot ...

8)

L
User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

Post by Simon B »

I think there is something to be said for having an enemy that the player cannot defeat. (But may assist defeating).

I've been envisioning thargoid carriers as citadels. You'd notice when one was about to show up because of the sudden hesitation in your rendering ;) Which happens with the megaships btw: there are around 8000 polys in 30-odd objects in there.

After all that effort, I may end up putting the turret bases in the normalmap.

There is a curious effect though - the roll rate of the megaship is the same as the spin rate of it's rings. So, when it rolls, it looks like one of the rings stops and the other doubles its speed. It's neat: I'll keep it.

Anyway, regular thargoids are no problem - perhaps they need a rescript to run away from behemoths in these situations?
Image

OT: I know some of you rely on MS products - here's a laugh: MS have been ordered to stop selling Word in the USA.
http://www.groklaw.net/article.php?stor ... 2144154814
... look for the pemanent injunction. So until MS buys its way out of this, it is illegal to use custom XML in MS Office products in the USA.
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
User avatar
Commander McLane
---- E L I T E ----
---- E L I T E ----
Posts: 9520
Joined: Thu Dec 14, 2006 9:08 am
Location: a Hacker Outpost in a moderately remote area
Contact:

Re: ..

Post by Commander McLane »

Lestradae wrote:
Simon B wrote:
It probably should not be possible to take out a ship the size of a thargoid in one shot...
Well, now you'll have to pep up the thargoids a bit, too. :P

As of now, thargoid carriers for example are sitting ducks. They should be turret-infested citadels in my opinion, busy churning out their warships which, in turn, should throw out an army of thargons.

They should be a fearsome invasion fleet imo, not something tuned to be merely hard for a single Cobra Mk III pilot ...
Working on it, working on it, and for quite some while.

Be patient, Rome wasn't built in one day either. :wink:
ovvldc
---- E L I T E ----
---- E L I T E ----
Posts: 344
Joined: Sat Apr 02, 2005 9:32 am
Location: Netherlands

Post by ovvldc »

Simon B wrote:
Anyway, regular thargoids are no problem - perhaps they need a rescript to run away from behemoths in these situations?
I thought thargoids had their fear glands surgically removed...

best wishes,
Oscar
User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

Post by Simon B »

ovvldc wrote:
Simon B wrote:
Anyway, regular thargoids are no problem - perhaps they need a rescript to run away from behemoths in these situations?
I thought thargoids had their fear glands surgically removed...
Oscar
Then they may be brave enough to run away ;)

The general who advances without coveting fame and retreats without fearing disgrace, whose only thought is to protect his country and do good service for his sovereign, is the jewel of the kingdom.

Or maybe the thargoid is a heaven-born captain?

Military tactics are like unto water; for water in its natural course runs away from high places and hastens downwards. So in war, the way is to avoid what is strong and to strike at what is weak.
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
User avatar
ClymAngus
---- E L I T E ----
---- E L I T E ----
Posts: 2508
Joined: Tue Jul 08, 2008 12:31 am
Location: London England
Contact:

Post by ClymAngus »

"their fearless, not suicidal."
User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

Post by Simon B »

Progress report: I have all three megaship types and the navy frigates working. I am at the stage of tweaking the frigate normalmap... started to make dumb mistakes again so it's time for bed.

An early look: caution - not final.
Image

I'm fiddling the scripts so everything behemoth refers to megaship - I am insisting on the renaming here mainly because the megaships are so so different to the behemoths that some people will prefer the original.
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
User avatar
pagroove
---- E L I T E ----
---- E L I T E ----
Posts: 3035
Joined: Wed Feb 21, 2007 11:52 pm
Location: On a famous planet

Post by pagroove »

Simon B wrote:
Progress report: I have all three megaship types and the navy frigates working. I am at the stage of tweaking the frigate normalmap... started to make dumb mistakes again so it's time for bed.

An early look: caution - not final.
Image

I'm fiddling the scripts so everything behemoth refers to megaship - I am insisting on the renaming here mainly because the megaships are so so different to the behemoths that some people will prefer the original.
This looks fantastic! 8)
For P.A. Groove's music check
https://soundcloud.com/p-a-groove
Famous Planets v 2.7. (for Povray)
Image
https://bb.oolite.space/viewtopic.php?f=4&t=13709
User avatar
Simon B
---- E L I T E ----
---- E L I T E ----
Posts: 836
Joined: Thu Oct 23, 2008 5:54 am
Location: Red Beach NZ
Contact:

Post by Simon B »

Image

I figured a bit of color would help. This attempts to look like the megaship hull colour. Bit I'm trying others.

Image
... linkt to a full screenshot of a navy frigate with the coriolis in the background. Moody.

You'll note that this is a player frigate... um... flying the thing is interesting - turns like a hog but opponents don't last long. Managed to dispatch a group of three pirates without actually pressing "a". So the lasers may actually not be routinely needed.

Image
... forward weaponry - three military lasers and the forward arcs of the turrets are not bad.

Image
... I hear a commander in distress!

Image
... there are two colors here. Top and right is the navy frigate; bottom and left in the rogue frigate.

Thing is, the rogue frigate looks more navy to me.
I love the normalmap effect across the nose - but the overhead view looks a bit busy. I fixed that on the anaconda by decreasing the depth of the map. That may work here.

Curiously, I have the cross-0 problem on the bottom of the hull but not on the top. It's not prominent though so maybe I'll leave it.

The lower hull on the navy texture needs some more variation. The grey/blue pattern on the rogue is actually the coriolis flat-metal texture with all the white sent to transparent. So there is gold and red in there. I need to account for this in the effectsmap.
Simon Bridge
[re2dux] [neolite]
"Everything is perfect down to every last flaw..."
HBT: The Book of Verse - Principia Discordia
User avatar
Lestradae
---- E L I T E ----
---- E L I T E ----
Posts: 3095
Joined: Tue Apr 17, 2007 10:30 pm
Location: Vienna, Austria

Post by Lestradae »

Simon B wrote:
You'll note that this is a player frigate
:D

8) and pretty :shock:

Say, this new frigate has less turrets than the "old" version, am I correct in that assumption?

Keep up the good work (you'll do anyways :wink: )

L
Post Reply