Showing saved ingame player coordinates in minimap image at website. Problems with scaling/origin.
So we have over 100 M rows of hit damage information on ns2stats database and finally started to try and make something out of it.
I made simple command to upload map based data from lua to ns2stats.org database so it (should be) simple to scale and offset coordinates for every map's minimap correctly.
This data contains:
Using this above data and some convert functions, data will be quite accurately shown for ns2_summit: (data contains one round rifle hits and skulk bites)
http://dev.ns2stats.org/round/round/63264
Convert functions are following:
So like seen on image; values which are uploaded for summit work with those convert functions. Problem comes with all other maps, they have wrong scaling or offset even when using every map's own uploaded values. So basically convert function values just happened to work for ns2_summit I guess and coordinates should be converted in different way.
So does anyone have any ideas what data is needed to convert those coordinates into website minimap image and how to do it?
Other examples:
Mineshaft: (wrong scaling+offset?)
http://dev.ns2stats.org/round/round/63262
Tram: http://dev.ns2stats.org/round/round/63271
Docking: http://dev.ns2stats.org/round/round/63281
Image which i am using on website is same image than ingame, only converted to png from tga.
I made simple command to upload map based data from lua to ns2stats.org database so it (should be) simple to scale and offset coordinates for every map's minimap correctly.
This data contains:
//File GUIminimap.lua local plottedX = (posX + self.plotToMapConstX) * self.plotToMapLinX local plottedY = (posZ + self.plotToMapConstY) * self.plotToMapLinY local values = { plotted_x = plottedX, plotted_y = plottedY, plotToMapConst_x = self.plotToMapConstX, plotToMapConst_y = self.plotToMapConstY, plotToMapLin_X = self.plotToMapLinX, plotToMapLin_Y = self.plotToMapLinY, backgroundWidth = GUIMinimap.kBackgroundWidth, backgroundHeight = GUIMinimap.kBackgroundHeight, scaleX =Client.minimapExtentScale.x, scaleY =Client.minimapExtentScale.y, scaleZ =Client.minimapExtentScale.z, originX =Client.minimapExtentOrigin.x, originY =Client.minimapExtentOrigin.y, originZ =Client.minimapExtentOrigin.z, } uploadToNs2stats(values,mapname)
Using this above data and some convert functions, data will be quite accurately shown for ns2_summit: (data contains one round rifle hits and skulk bites)
http://dev.ns2stats.org/round/round/63264
Convert functions are following:
this.convXtoCvsX = function (x) { x = x/(this.data['scaleX']/2) * this.cvs.width; //canvas width/minimap image width x -=this.data['originX']; x+=-this.data['backgroundWidth']; x+=512; //set origin to center in canvas image/minimap image return x; } this.convZtoCvsY = function (y) { y = y*-1; //mirror z/y axis y = y/(this.data['scaleZ']/2) * this.cvs.height; y -=this.data['originZ']; y +=this.data['backgroundHeight']; y +=512 return y; }
So like seen on image; values which are uploaded for summit work with those convert functions. Problem comes with all other maps, they have wrong scaling or offset even when using every map's own uploaded values. So basically convert function values just happened to work for ns2_summit I guess and coordinates should be converted in different way.
So does anyone have any ideas what data is needed to convert those coordinates into website minimap image and how to do it?
Other examples:
Mineshaft: (wrong scaling+offset?)
http://dev.ns2stats.org/round/round/63262
Tram: http://dev.ns2stats.org/round/round/63271
Docking: http://dev.ns2stats.org/round/round/63281
Image which i am using on website is same image than ingame, only converted to png from tga.
Comments
Client.lua: Line 237-244:
GUIMinimap.lua: Line 890-918:
Line 110-119:
That Client.minimapExtentScale and Origin comes from that Client.lua file minimap_extents part actually. And my previous lua code posting is in that PlotToMap function. That setScale function might contain some useful data idd:
But gonna look into it more later, off to bed now.
so the extents will be saved on every match (or for every map so you don't have to do this manually)
just something like
and then save the kMinimap thing
That plottedX+plottedY formula is copied from lua.
Problem is that after using those values, coordinates are still not correct. And their position varies based on maps. Sometimes x&y needs to be more, sometimes less.
Examples with map's values from lua.
Same problem is on y axis, but i guess it will get solved when x axis gets solved. So any ideas? I might be missing something simple really.
And now to to start working on heatmaps and making round minimaps better...