Upvote Upvoted 162 Downvote Downvoted
1 2 3
Online demo playback at demos.tf
posted in Projects
61
#61
koth_bagel
0 Frags +

How is the alignment done? Is it trial and error or does knowing the overview scale and centering it on 0,0,0 make it easier?

(Also I'm not sure what data you can get from the demo but having HUD parts like timers and points would be cool if they were possible)

How is the alignment done? Is it trial and error or does knowing the overview scale and centering it on 0,0,0 make it easier?

(Also I'm not sure what data you can get from the demo but having HUD parts like timers and points would be cool if they were possible)
62
#62
4 Frags +
YrrHow is the alignment done? Is it trial and error or does knowing the overview scale and centering it on 0,0,0 make it easier?

Currently alignment is trial and error, using the minimum and maximum coordinates of players during a match to get an initial guess.
Then drawing all player positions on the map and tweaking the values until it aligns.

I can probably improve the workflow by taking things like overview level into account but I haven't really investigated that yet.

Yrr(Also I'm not sure what data you can get from the demo but having HUD parts like timers and points would be cool if they were possible)

I should be able to get pretty much every piece of data you can see ingame, it's all a matter of time and effort.

[quote=Yrr]How is the alignment done? Is it trial and error or does knowing the overview scale and centering it on 0,0,0 make it easier?[/quote]

Currently alignment is trial and error, using the minimum and maximum coordinates of players during a match to get an initial guess.
Then [url=https://i.imgur.com/wdFH17C.jpg]drawing all player positions on the map[/url] and tweaking the values until it aligns.

I can probably improve the workflow by taking things like overview level into account but I haven't really investigated that yet.

[quote=Yrr](Also I'm not sure what data you can get from the demo but having HUD parts like timers and points would be cool if they were possible)[/quote]

I should be able to get pretty much every piece of data you can see ingame, it's all a matter of time and effort.
63
#63
6 Frags +

Improved the visibility of low health players and added ubercharge levels.

https://i.imgur.com/OKpC7Ge.png

Improved the visibility of low health players and added ubercharge levels.

[img]https://i.imgur.com/OKpC7Ge.png[/img]
64
#64
6 Frags +

You are literally carrying TF2.

Slow mo and synced zooming would be wonderful, if easy to implement.

You are literally carrying TF2.

Slow mo and synced zooming would be wonderful, if easy to implement.
65
#65
-1 Frags +

Ohhhhh and then to get that live for an stv that would be gold

Why does it look like the tftv hud?

Ohhhhh and then to get that live for an stv that would be gold

Why does it look like the tftv hud?
66
#66
2 Frags +

pov demos are now a lot less likely to give an error and show work most of the time.

Due to the nature of pov demos it will however always show an incomplete state of the match which can lead to some confusing situations.

pov demos are now a lot less likely to give an error and show work most of the time.

Due to the nature of pov demos it will however always show an incomplete state of the match which can lead to some confusing situations.
67
#67
marketplace.tf
1 Frags +
IcewindYrrHow is the alignment done? Is it trial and error or does knowing the overview scale and centering it on 0,0,0 make it easier?
Currently alignment is trial and error, using the minimum and maximum coordinates of players during a match to get an initial guess.

I feel like this is something that almighty SOHCAHTOA can help you with here.

[quote=Icewind][quote=Yrr]How is the alignment done? Is it trial and error or does knowing the overview scale and centering it on 0,0,0 make it easier?[/quote]

Currently alignment is trial and error, using the minimum and maximum coordinates of players during a match to get an initial guess.[/quote]

I feel like this is something that almighty SOHCAHTOA can help you with here.
68
#68
4 Frags +

You can use the values for cl_leveloverview to determine how to transform world coordinates into screen coordinates.

Overview: scale 8.40, pos_x -7516, pos_y 4299

Here's some pseudocode for how I implemented it:

Point world = new Point(playerX, playerY);
int pos_X = -7516;
int pos_Y = 4299;
double scale = 8.4;

double height = 1024 * scale; // 1024 is a magic number straight from cl_leveloverview code
double originalWidth = height * (16.0 / 9.0); // aspect ratio of your screen when you took the screenshot
double width = height * (MapImage.RenderWidth / MapImage.RenderHeight);

var centerWorld = new Point(pos_X + (originalWidth / 2), pos_Y - (height / 2));
var topLeftWorld = new Point(centerWorld.X - (width / 2), centerWorld.Y + (height / 2));
var bottomRightWorld = new Point(topLeftWorld.X + width, topLeftWorld.Y - height);

return new Point(
	Rescale(0, MapImage.RenderWidth, topLeftWorld.X, bottomRightWorld.X, world.X),
	Rescale(0, MapImage.RenderHeight, topLeftWorld.Y, bottomRightWorld.Y, world.Y));

Bonus C#:

public static double Lerp(double param1, double param2, double x)
{
	return (param1 + (param2 - param1) * x);
}

// Interpolates linearly from a to b as t goes from x to y.
public static double Rescale(double a, double b, double x, double y, double t)
{
	return Lerp(a, b, (t - x) / (y - x));
}

If you're interested, here's the actual code that drives cl_leveloverview:

void CViewRender::SetUpOverView()
{
	static int oldCRC = 0;

	m_View.m_bOrtho = true;

	float aspect = (float)m_View.width/(float)m_View.height;

	int size_y = 1024.0f * cl_leveloverview.GetFloat(); // scale factor, 1024 = OVERVIEW_MAP_SIZE
	int	size_x = size_y * aspect;	// standard screen aspect 

	m_View.origin.x -= size_x / 2;
	m_View.origin.y += size_y / 2;

	m_View.m_OrthoLeft   = 0;
	m_View.m_OrthoTop    = -size_y;
	m_View.m_OrthoRight  = size_x;
	m_View.m_OrthoBottom = 0;

	m_View.angles = QAngle( 90, 90, 0 );

	// simple movement detector, show position if moved
	int newCRC = m_View.origin.x + m_View.origin.y + m_View.origin.z;
	if ( newCRC != oldCRC )
	{
		Msg( "Overview: scale %.2f, pos_x %.0f, pos_y %.0f\n", cl_leveloverview.GetFloat(),
			m_View.origin.x, m_View.origin.y );
		oldCRC = newCRC;
	}

	CMatRenderContextPtr pRenderContext( materials );
	pRenderContext->ClearColor4ub( 0, 255, 0, 255 );

	// render->DrawTopView( true );
}

EDIT: I really like how code tags don't work inside of spoiler tags

You can use the values for cl_leveloverview to determine how to transform world coordinates into screen coordinates.
[code]Overview: scale 8.40, pos_x -7516, pos_y 4299[/code]

Here's some pseudocode for how I implemented it:
[code]
Point world = new Point(playerX, playerY);
int pos_X = -7516;
int pos_Y = 4299;
double scale = 8.4;

double height = 1024 * scale; // 1024 is a magic number straight from cl_leveloverview code
double originalWidth = height * (16.0 / 9.0); // aspect ratio of your screen when you took the screenshot
double width = height * (MapImage.RenderWidth / MapImage.RenderHeight);

var centerWorld = new Point(pos_X + (originalWidth / 2), pos_Y - (height / 2));
var topLeftWorld = new Point(centerWorld.X - (width / 2), centerWorld.Y + (height / 2));
var bottomRightWorld = new Point(topLeftWorld.X + width, topLeftWorld.Y - height);

return new Point(
Rescale(0, MapImage.RenderWidth, topLeftWorld.X, bottomRightWorld.X, world.X),
Rescale(0, MapImage.RenderHeight, topLeftWorld.Y, bottomRightWorld.Y, world.Y));
[/code]

Bonus C#:
[code]
public static double Lerp(double param1, double param2, double x)
{
return (param1 + (param2 - param1) * x);
}

// Interpolates linearly from a to b as t goes from x to y.
public static double Rescale(double a, double b, double x, double y, double t)
{
return Lerp(a, b, (t - x) / (y - x));
}
[/code]

If you're interested, here's the actual code that drives cl_leveloverview:
[code]
void CViewRender::SetUpOverView()
{
static int oldCRC = 0;

m_View.m_bOrtho = true;

float aspect = (float)m_View.width/(float)m_View.height;

int size_y = 1024.0f * cl_leveloverview.GetFloat(); // scale factor, 1024 = OVERVIEW_MAP_SIZE
int size_x = size_y * aspect; // standard screen aspect

m_View.origin.x -= size_x / 2;
m_View.origin.y += size_y / 2;

m_View.m_OrthoLeft = 0;
m_View.m_OrthoTop = -size_y;
m_View.m_OrthoRight = size_x;
m_View.m_OrthoBottom = 0;

m_View.angles = QAngle( 90, 90, 0 );

// simple movement detector, show position if moved
int newCRC = m_View.origin.x + m_View.origin.y + m_View.origin.z;
if ( newCRC != oldCRC )
{
Msg( "Overview: scale %.2f, pos_x %.0f, pos_y %.0f\n", cl_leveloverview.GetFloat(),
m_View.origin.x, m_View.origin.y );
oldCRC = newCRC;
}

CMatRenderContextPtr pRenderContext( materials );
pRenderContext->ClearColor4ub( 0, 255, 0, 255 );

// render->DrawTopView( true );
}
[/code]

EDIT: I really like how code tags don't work inside of spoiler tags
69
#69
3 Frags +
pazerYou can use the values for cl_leveloverview to determine how to transform world coordinates into screen coordinates.
...

Very nice, will try that

[quote=pazer]You can use the values for cl_leveloverview to determine how to transform world coordinates into screen coordinates.
...[/quote]

Very nice, will try that
70
#70
3 Frags +

demos.tf isnt loading for me there is just a grey page. Is that an issue with my PC or is it down for anyone else?

Edit: Try ctrl+f4, worked for me

demos.tf isnt loading for me there is just a grey page. Is that an issue with my PC or is it down for anyone else?

Edit: Try ctrl+f4, worked for me
71
#71
2 Frags +

This is simply beautiful. It would be really great if something like this existed while I was still playing in teams.

Congratulations for your work, man!

This is simply beautiful. It would be really great if something like this existed while I was still playing in teams.

Congratulations for your work, man!
72
#72
12 Frags +

hey, thank you so much for this feature, its really useful
would it be possible to re-align the gullywash overview? its not aligned properly since we started using the refresh version which moved the map on the grid

https://i.imgur.com/QrXBhTy.png

hey, thank you so much for this feature, its really useful
would it be possible to re-align the gullywash overview? its not aligned properly since we started using the refresh version which moved the map on the grid [img]https://i.imgur.com/QrXBhTy.png[/img]
73
#73
9 Frags +

fixed

fixed
1 2 3
Please sign in through STEAM to post a comment.