InterWave Forums: Heatmaps - InterWave Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Heatmaps some suggestions

#1 User is offline   _KaszpiR_ 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 16
  • Joined: 21-August 09
  • LocationWarsaw, Poland

Posted 25 August 2009 - 12:05 PM

Okay, Bonzo, looks like we can't get it on irc ;D

Here are my suggestions, regarding to all heatmaps, not only hl1 engine

1. Change of the recieving data
by finding max and min values in kill positions in (x,y), we can thus define the area that is used (read, where people die)
Area has its AreaHeight and AreaWidth

Posted Image

2. This leads us to find the coordinates of the center of that area (cx,cy)
CenterX = Min(X)+(Max(X)-Min(X))/2
CenterY = Min(Y)+(Max(Y)-Min(Y))/2

so that we got now a vector by which we must move the area to have it centered in the OX,OY
vector end point is CenterX, CenterY, so we must negate its values

In the effect we got area centered in OX,OY


3. With that data we can now scale the data, quite simple, cause we know the output area (for example 1280x1024)
scaleFactorX = AreaWidth / OutputWidth
ScaleFactorY = AreaHeight / OutputHeight
ScaleFactor = MAX(scaleFactorX,scaleFactorY) (or max, i don't rember ;))
we can increase ScaleFactor by 0.1 to fit image better (to avoid entering to the edges)

Posted Image

4. Now we can flip the data, usually we are interested in flipping it by Y

5. Now we can rotate the data, usually we just need to rotate by 90 deg, which in fact is just changing x->y and y->x coords
rotation by the bigger angle like 180 is in fact flipping by X and Y

Posted Image

6. Finally, move the output by the default offset vector that is related to the overview resolution (1280/2;1024/2)

Posted Image

Sum up:
We need those functions
move_by_vector(array,coord_x;coord_y,coord_z)

rotate(array,a); where a is int:
0 = no rotation
1 = 90 CW
2 = 180 CW
3 = 270

flip(array,axis)
where axis:
0 = X
1 = Y
z = Z


I believe the whole can be done by the single function with quite many parameters, producing mysql query with the data used to draw directly the heatmap.
We can grab whole 10K records to memory, it may take time and resources to iterate by that amount of data, so running sql query with parameters would be desireable, mysql would calc it for us on the fly.



Red maps - reported issue with the whole maps completely red
Below text is a rough idea, maybe not so birlliant due to the number of data it would output ;D

well, it is by th fact that we use absolute number of kills in the area (AFAIR) which leads to the saturation of the places
thats why the data should be changed to relative, in percentage

but then we would have to change the area to the smaller areas - for example cut the whole area to 100 rows and 100 columns and find the block with the most kills
that would lead us to KillScale = Kills/TotalKills
and then we would apply that scale to every block

in the effect we would get heatmaps with less colour but i think with much less red areas


Such converted data we could store back in sql, just adding kills to the given area block.
So instead of milions of kill records with coordinates we could store just data with the bloks and the number of kills that occured in the block

Add Z axis and we are movind to the 3D and it would be number of kills in small cubicle.
Map would be then split to the 294912000 (yay) cubicles in total - 1280x1280x1280, not every one of them would contain number of kills actually, so they could be removed

of course 1px cubicle resolution would be overkill, i think 4 or even 8px would be enough, so we would end up with:
32768000 4px
or
4096000 8px
cubicles, but not all of them would be used.


Then, this data could be exported as xml and used in for example flash or amxx plugins for showing heatmaps in game!

yes, I'm insane.
Posted Image
0

#2 User is offline   BoNzO 

  • HLstatsX:CE Developer
  • PipPipPipPip
  • Group: HLstatsX:CE Developers
  • Posts: 200
  • Joined: 14-August 09

Posted 25 August 2009 - 12:15 PM

But the "screenshot" of the map is't always centered, so how can we know how to align it if our offset numbers is wrong (eg for HL1)
0

#3 User is offline   _KaszpiR_ 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 16
  • Joined: 21-August 09
  • LocationWarsaw, Poland

Posted 25 August 2009 - 12:34 PM

yeah I know, but we are able to get close to the center of the image, the rest would have to be readjusted manually, i think in rage about 30 pixels.

unless I'll be eager to dig in full sdk of hl1 and see what's going in in overview code.
Posted Image
0

#4 User is offline   _KaszpiR_ 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 16
  • Joined: 21-August 09
  • LocationWarsaw, Poland

Posted 30 August 2009 - 10:24 AM

afer discussions on irc and looking at psychostats code, i think we don't need those changes
moreover even psychostas does not use rotation of the data, tehy got maunally adjusted map overviews

i'm currently writing openoffice calc document with some macros to make the whole operaition easier
just need to know some openoffice Basic functions and spare time.

i guess i gonna finish it in this week
Posted Image
0

#5 User is offline   BoNzO 

  • HLstatsX:CE Developer
  • PipPipPipPip
  • Group: HLstatsX:CE Developers
  • Posts: 200
  • Joined: 14-August 09

Posted 30 August 2009 - 11:55 AM

View Post_KaszpiR_, on 30 August 2009 - 10:24 AM, said:

afer discussions on irc and looking at psychostats code, i think we don't need those changes
moreover even psychostas does not use rotation of the data, tehy got maunally adjusted map overviews

i'm currently writing openoffice calc document with some macros to make the whole operaition easier
just need to know some openoffice Basic functions and spare time.

i guess i gonna finish it in this week


sounds good. keep it up!!
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users