View topic - attackable ghosted buildings



All times are UTC + 1 hour


Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: 29 Nov 2011, 22:19 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
When you get los on a unit/building and then lose los, you get this transparent shape where you saw the building.
Now I would like these shapes to be attackable, like normal units.
(atm rightclick on the transparent shape results in a move order)

To be precise it is for mineable minerals: those can not be "always visible" because then you can see where enemy players are harvesting resources just by seeing the minerals lose health/shrink smaller.
If minerals obey normal los rules, it is annoying that you first have to get los on them before telling a miner to harvest.

So I want it to be basically like in starcraft where you could see minerals everywhere and when you got los on mined-out minerals, they would disappear.

Ideas:
1) each mineral gets a fake unit (one per ally team) linked with it, lua makes it visible for the players as needed.
2) transform move-commands given at mineral-ghosts into attack-commands with screentrace mouse coordinates bla and manually setting tooltip etc.

Both seems pretty meh and I also vaguely remember something similiar was already done?

fun fact:
iirc in sc you could tell if minerals where still there by telling peons to harvest them. They would drive there in both cases but with slightly different behaviour...


Top
 Offline Profile  
 
PostPosted: 30 Nov 2011, 10:20 
Moderator

Joined: 12 Oct 2007, 08:24
I thought a bit more about this and I think I have a robust and complete solution. It's basically a lot of 'fake' units without a real unit.

Each mineral 'unit' is implemented as a fake unit that is only visible and interactable with a single allyTeam. These are linked by a unit that only exists implicitly as a lua data structure.

The minerals basically exist like this:
Code:
minerals = {
  [mineralID] =  {
    units = {
      [allyTeam] = unitID,
      ...
      }
    health = number
  },
  ...
}
MineralID is just an internal thing, can be ordered 1 2 3 4 etc.
Each mineral knows it's real health and the unitIDs of units that represent it. You also need a table of fake minerals by unitID that points the fake unit back to it's mineralID and appropriate allyTeam.

Code:
fakeByID = {
  [unitID] = {
    mineralID = number,
    allyTeam = number
  },
  ...
}


When a fake unit is damaged it should update it's mineralID's health. ie
minerals[fakeByID[attackieeID].mineralID].health = attackiee health

Fake units undergo health change iff either of these things happen:
  • They enter the LOS of their associated allyTeam (and their health is not equal to mineralID health)
  • mineralID health changes and they are within the LOS of their associated allyTeam
Health change also covers unit destruction. Fake units are not destroyed until they enter LOS (this is where the initial idea of merely transferring the attack command fails).

One or more of these fuctions should provide all the visibility manipulation required to make this work. If an always visible unit messes up gadget:UnitEnteredLOS then another fake unit can be used. This unit could be visible to all allyTeams and exist solely to trigger gadget:UnitEnteredLOS.
Code:
Spring.SetUnitAlwaysVisible
Spring.SetUnitLosMask
Spring.SetUnitLosState


So I think I have covered everything. It looks fairly simple to implement although some testing is required to figure out how the relevant functions work. I'm pretty sure this method has no method of gaining information outside LOS.


Top
 Offline Profile  
 
PostPosted: 30 Nov 2011, 11:38 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
Quote:
MineralID is just an internal thing, can be ordered 1 2 3 4 etc.
I would rather make the mineral a real unit:
It would obey normal LOS-rules and be the unit that is visible to the player by having a real model.
So the fakeunits would be there just to provide a click-target and to be visible on minimap. Rest would work as you described.


Top
 Offline Profile  
 
PostPosted: 30 Nov 2011, 13:20 
User avatar

Joined: 07 Dec 2008, 02:35
It all depends on how the units are going to interact with the 'minerals'. Through reclaiming? Through attacking/damage? Completely through lua? I think fake units is a bad idea, and definitely avoidable.


Top
 Offline Profile  
 
PostPosted: 30 Nov 2011, 14:28 
Moderator

Joined: 12 Oct 2007, 08:24
knorke wrote:
Quote:
MineralID is just an internal thing, can be ordered 1 2 3 4 etc.
I would rather make the mineral a real unit:
It would obey normal LOS-rules and be the unit that is visible to the player by having a real model.
So the fakeunits would be there just to provide a click-target and to be visible on minimap. Rest would work as you described.

This has issues:
  • Engine Ghost shows all model pieces, you lose your 'at a glance' minerals remaining system.
  • If the minerals are actually dead the player could determine that the attack command is not on the minerals.

In short what are the limitations of my design? Yours has the clear model piece limitation that will make it hard for players to track the progress of their own patches when the miner is not providing LOS. I don't understand the thought process here as you haven't said how my design won't work and you prefer the one with limitations.

Niobium wrote:
It all depends on how the units are going to interact with the 'minerals'. Through reclaiming? Through attacking/damage? Completely through lua? I think fake units is a bad idea, and definitely avoidable.
The gathering mechanic is already implemented and works the same way as in CT. Miners damage minerals and nothing else can be done to minerals.


Top
 Offline Profile  
 
PostPosted: 30 Nov 2011, 14:46 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
Quote:
Through attacking/damage?
yup. (that part is done already)

Quote:
Engine Ghost shows all model pieces, you lose your 'at a glance' minerals remaining system.
Yes, but it saves on pieceount. Just one mineralunit with 8 pieces instead of (in a 4 ffa) 4*8=32 pieces.
Seeing the minerals as complete and transparent outside LOS would be "ok" I think.

Quote:
If the minerals are actually dead the player could determine that the attack command is not on the minerals.
attack commands would always be on the fakeunits.

Quote:
I don't understand the thought process here as you haven't said how my design won't work
It is mostly a feeling that fakeunits will bring unforeseen problems because it seems a bit hackish/dirty. I will try it out in the evening anyway but wanted to look/ask for other ideas.


Top
 Offline Profile  
 
PostPosted: 10 Dec 2011, 15:56 
Moderator

Joined: 12 Oct 2007, 08:24
Attached working system.


Attachments:
minerals.7z [7.72 KiB]
Downloaded 21 times
Top
 Offline Profile  
 
PostPosted: 10 Dec 2011, 16:21 
Moderator
User avatar

Joined: 22 Feb 2006, 01:02
Location: cheap kitchen
Image
Image


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.