Line

BlitzPlus Forums/BlitzPlus Beginners Area/Line

Buggy(Posted 2006) [#1]
I've been told over and over again not to have the line command in the main game loop, but if I'm making a game similar to WireHang, can it be avoided?


Beaker(Posted 2006) [#2]
There is nothing wrong with using the Line command in the main game loop. Many games do. The alternative is to use a line of writepixelfasts, but this will not be faster.


WolRon(Posted 2006) [#3]
I've been told over and over again not to have the line command in the main game loop,
Who told you that? and why?


Grey Alien(Posted 2006) [#4]
If you are doing straight vertical or horizontal lines use rect instead, it's quicker.


Buggy(Posted 2006) [#5]
Everyone says, "To improve game speed, don't use Print, Text, Line, Write, etc. in the game loop."


Beaker(Posted 2006) [#6]
For 2D games there is nothing wrong with any of those. Altho I would avoid Print (cos its crap). "Everyone" are probably refering to 3D games, where you should avoid mixing 2D commands with 3D cos its slows things down.

On the whole tho there are many games where speed isn't much of an issue.


WolRon(Posted 2006) [#7]
The Rect command (which is useful for orthogonal lines) is 70% faster than the Line command. Other than that, theres no problem using the Line command. As stated, just don't mix 2D (Line) with 3D as many graphics cards can't handle it well.


Grey Alien(Posted 2006) [#8]
"orthogonal" now there's a good word.


Buggy(Posted 2006) [#9]
I should have used it on my English midterm today!

Thanks, guys.


D2006(Posted 2006) [#10]
Hint: LockBuffer does speed up also the line command many times!
Of course you must then proof that the coordinates aren't out of range.

regards
D2006


Grey Alien(Posted 2006) [#11]
or face an access violation, not good. But bounds checking is pretty damn easy.


Buggy(Posted 2006) [#12]
sounds good