Sign in to follow this  
Viking

draw debug lines

Recommended Posts

Hey,

I am not sure if this is a Client or Server thing, but since it's a visual thing the Client subforum might be right.

 

I would like to draw a line from point A to point B.

However, in stock Cod4 this works on Client only, not on a server but I heard that with cod4x it is possible to do that on the server too.

 

Since i can not run my mod without cod4x i would like to get the lines shown, but i think i am doing sth wrong.

Either there are no lines visible, or the server is lagging so heavy that i am not able to check their connections.

 

I am starting the server & client with developer 1 and developer_script 1.

The code with the lines is a simple loop with a wait of 0.05

 

 

Would be great if you could help me here.

If the debug lines don't work with cod4x, do you have an other idea?

Share this post


Link to post
Share on other sites

Hello, developer 1 on both server & client is already a good start. For how long are you showing the debuglines?

Don't do that just for 1 frame.

Share this post


Link to post
Share on other sites

I have it in a loop and sometimes it works and sometimes it does not.

When it works this happens:

 

Example Video (link to my dropbox)

 

My code:

drawDebugPath(path, color)
{
	if(!isDefined(color))
		color = (1,0,0);

	level notify("debug_navmesh_path" + color);
	level endon("debug_navmesh_path" + color);

	if(!isDefined(path))
	{
		iPrintLnBold("path undefined - nothing to draw");
		return;
	}
		
	iPrintLnBold("path size: " + path.size);
		
	while(path.size > 1)
	{
		for(i=0;i<path.size-1;i++)
		{
			line(path[i], path[i] + (0,0, 50), (0,1,0));
			line(path[i], path[i+1], color);
			
			if(i == path.size - 2)
				line(path[i+1], path[i+1] + (0,0, 50), (0,1,0));
		}

		wait .05;
	}
	
	while(path.size == 1)
	{
		line(path[0], path[0] + (0,0, 50), (0,1,0));

		wait .05;
	}

 

I get the screenprint of the path size only once, so the function is not executed multiple times.

This means that it is not killing itself (due to the notify)

 

There is no lag visible in the server console, but after some time the client is kicked with the timeout message and the server crashs.

image.png.a69acd8744366ec469bf0002036e045b.png

Edited by Viking
added more details
  • Like 1

Share this post


Link to post
Share on other sites

I think you are sending too much draw commands. It is like you are redrawing every server frame. You can not do that on a network like you tried. Draw the lines for long time and redraw only rarely. Also there is a line limit. I think it is 128.

  • Like 1

Share this post


Link to post
Share on other sites

How can I draw lines for a longer time?

I thought they are visible for a frame.

Or did that change with cod4x?

 

Thanks for your help :)

Share this post


Link to post
Share on other sites

Can you provide me a working example?

No matter what duration it does not show up for me when the duration parameter is defined.

Share this post


Link to post
Share on other sites

I would also not reproduce any results with that documentation. The command in the Wiki is wrong and has to be as the following:

Line( <start>, <end>, <color (RGB)>, <alpha> ,<depthTest>, <duration> )

  • Thanks 1

Share this post


Link to post
Share on other sites
On 12/30/2020 at 4:43 PM, Fraggy said:

I would also not reproduce any results with that documentation. The command in the Wiki is wrong and has to be as the following:

Line( <start>, <end>, <color (RGB)>, <alpha> ,<depthTest>, <duration> )

 

this works, thanks.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this