Messing around with unit intel and whats possible

Here is a unit with a series of entities that are attached / offset from the parent unit. Each entity has its own intel range that displays for the player at a roughly 45 degree angle from the point of origin. Stopping at what is exactly the units max weapon range.

11b89425-62cd-4bb3-9bc7-7e3cc9a49b37-image.png

As the unit moves so do the attached entities. Effectively i can apply this to any intel type that's needed. Creating a cone of intel rather than a circle. (Which is more realistic)

Script snippet (or it didn't happen)

CreateIntelEntity = function(self, bone, intel, radius)
    if not self.IntelEntity then
        self.IntelEntity = {}
    end
    if not self:BeenDestroyed() and radius > 0 then
        local counter = 1
        while counter <= radius do
            local angle = math.ceil(counter / 3.14)
            if counter + angle < radius then
                ent = import('/lua/sim/Entity.lua').Entity({Owner = self,})
                table.insert(self.IntelEntity, ent)
                self.Trash:Add(ent)					
                ent:AttachBoneTo( -1, self, bone or 0 )
                local pos = self:CalculateWorldPositionFromRelative({0, 0, counter})
                ent:SetParentOffset(Vector(0,0, counter))
                ent:SetVizToFocusPlayer('Always')
                ent:SetVizToAllies('Always')
                ent:SetVizToNeutrals('Never')
                ent:SetVizToEnemies('Never')
                ent:InitIntel(self.MyArmy, intel, angle)
                ent:EnableIntel(intel)
            end
            counter = counter + 1
        end	
    end
end,	

Currently I'm calling this from the units OnCreate to facilitate easier testing.

OnStopBeingBuilt = function(self,builder,layer)
    TAirUnit.OnStopBeingBuilt(self,builder,layer)

    --Start advanced radar
    self:ForkThread(self.CreateIntelEntity,'MuzzleFront', 'Vision', 45)
end,

This could be applied to every "radar" unit in the game including units that have rotating radar antenna.s Thus allowing the intel entities to sweep an area just like a real radar! Eventually, once i unravel the mystery that is the FAF intel system, I will make a mod using this ability as well as something similar for sonar as well.

Enjoy!

Resin

Made a bit more progress getting the intel cone to rotate around a moving aircraft.
Video: https://youtu.be/xKb76OkqCnU

Unfortunately I've been unable to attack one intel entity to another, as apparently a real unit has to be involved at some point for it to work.

Updated script...

	CreateIntelCone = function(self, bone, intel, radius, spin)
		--Creates a 45 degree cone of intel, originating out from the parent units chosen bone
		if not self.IntelEntity then
			self.IntelEntity = {}
		end
		if not self:BeenDestroyed() and radius > 0 then
			local counter = 1
			while counter <= radius do
				local angle = math.ceil(counter / 3.14)
				if counter + angle < radius then
					-- Create the entity and attach it to parent
					local ent = import('/lua/sim/Entity.lua').Entity({Owner = self,})
					ent:AttachBoneTo( -1, self, bone or 0 )					
					table.insert(self.IntelEntity, ent)
					self.Trash:Add(ent)					
					ent:SetParentOffset(Vector(0,0, counter))
					--	Short wait to ensure the entity is in play
					WaitTicks(1)
					if ent and not self:BeenDestroyed() then
						-- Set who can view the entities intel
						ent:SetVizToFocusPlayer('Always')
						ent:SetVizToAllies('Always')
						ent:SetVizToNeutrals('Never')
						ent:SetVizToEnemies('Never')					
						--	Initialize and enable intel
			            ent:InitIntel(self.MyArmy, intel, angle)
			            ent:EnableIntel(intel)				
		            end
	            end
				counter = counter + 1	            
            end
            if bone and spin then
            	self.Trash:Add(CreateRotator(self, bone, 'y', nil, 0, 36, 36))
            end		
		end
	end,

Really good Work. Next to of using it as an new Radar System it could be used for to give Land Units an Spotlight Mechanic. Unfortunately the Game doesn't has an automatic Day and Night Cycle System on its Maps but I See some Potential on Night Maps. Imagine an Toggle Button to Turn On or Off the Spotlights which Increase thier Visible Range with these Characteristics. Looking forward for future Updates.

If you find something to alter sonar so that sonar emits a pulse, that would be really cool.

@cdrmv Yeah, that would be cool if not for the micro involved. AI would really have a difficult time with dsrkness features like this, making AI kinda handicapped.

Would like to make an overall mod to replace both radar and sonar with directional systems instead of the circular intel. This would make intel less reliable, enabling stealth based play to be somewhat viable.

I've been also kicking around the idea of emissions control. This means that if your radar / sonar is active, you're broadcasting your location to the entire map. Would force players to manage their use of intel to limit unit detection.

@evildrew already have.. I can use dummy projectiles with a sonar intel that gets bigger the further away it travels from the emitting unit / sub.

Subs would only ping every so often, allowing them to see what they were facing at the time the ping (dummy proj) was created. If the projectile impacts land, it stops / is destroyed. (Sonar can not see past a land obstacle) Otherwise, the projectile would travel a fixed distance and then disappear on its own. After a short cooldown, the sub would again ping, repeating the process on its current heading.

Structures would be able to ping in multiple directions at once, but as they've not mobile, poor placement would limit its view. (Placed too close to land)

@resin_smoker said in Messing around with unit intel and whats possible:

@evildrew already have.. I can use dummy projectiles with a sonar intel that gets bigger the further away it travels from the emitting unit / sub.

Subs would only ping every so often, allowing them to see what they were facing at the time the ping (dummy proj) was created. If the projectile impacts land, it stops / is destroyed. (Sonar can not see past a land obstacle) Otherwise, the projectile would travel a fixed distance and then disappear on its own. After a short cooldown, the sub would again ping, repeating the process on its current heading.

Structures would be able to ping in multiple directions at once, but as they've not mobile, poor placement would limit its view. (Placed too close to land)

Is there a youtube video of this or where can I see this?

@evildrew I made the initial scripts for this 10 years ago, but never finished it. Now, I'm attempting to recreate it with a few new tricks I've learned ad I'm figuring out how FAF handles intel. If you didn't know, FAF rewrote a fair bit of the intel script. Though I've still yet to pull it apart to know just how I can hook-on my changes.

Anyways... The concept is very simple. Just adding an intel type to a custom projectile. Then, making it so the projectile wouldn't hit anything but land. The parent unit of the projectile, and it's army (team) own the viewing rights to the intel discovered.

@resin_smoker So you would fire say 360 projectiles out in all directions with a sonar radius of say 5-10 to do this?
So if the water is very deep, the sonar radius would have to be wide enough (at least vertically) like a 0 to detect ACUs on the seabed which I believe you have demonstrated is possible.
I really like that you are thinking about projectiles not going through land, that way maps with many smaller islands or channels make subs less easily visible to T3 sonar adding depth to the game.

@evildrew don't need that many projects as each projectile would have a piece of the intel pie.

So for 360 coverage, the cheap and easy way would be to 8 projectiles, each taking a 45 degree swath. (8×45=360) Keep in mind that as the projectiles travel away from the parent unit, you'd see large gaps within the sonar coverage if the intel radius was not being increased as the projectile traveled outwards.

I've been using the following formula to spread out the radar entities, to make the nice cone...

local angle = math.ceil(counter / 3.14)

But for the sonar, it would be more like this...

local intRadius = math.ceil(distanceTraveled/ 3.14)

The intRadius would then be used to change th projectiles sonar radius. The whole thing would update every couple of game ticks, by first checking the distance traveled from the point of origin, then doing the simple formula above, before updating the sonar range.

Easy as 3.14

Resin