patch: improved build order for all kinds of area build

patch: improved build order for all kinds of area build

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
semi
Posts: 69
Joined: 30 Mar 2007, 20:42

patch: improved build order for all kinds of area build

Post by semi »

This is my first contribution to spring. Any feedback and comments are welcome.

- Area build now builds every second row in the opposite direction.
- Perimeter build now builds in counterclockwise or clockwise order.
- Circle build now builds in counterclockwise or clockwise order.
- Using non-square buildings for circling something now works.
- Basically totally rewrote GetBuildPos to do this, the new code is shorter and cleaner.

Before, the build order was horribly inefficient and required lots of walking around. Also, if you wanted to circle any building with non-square buildings, they would block each other and not form a full ring.

fitch.tky.hut.fi/~semi/GetBuildPos_semi.diff

There's one small glitch. If you try to circle a radar tower with vehicle labs (I don't know why anyone would, but still), only the top and bottom ones are queued instead of all the 4 that are required. Any square building works, and if circling a perimeter camera or a defender or any other size of buildings with vehicle labs there are no problems. And even the radar tower will get correctly circled by vehicle labs if the buildfacing is flipped 90 degrees.

I think I've tested everything heavily, and this should not have any other issues. The small glitch is basically much smaller than the bug I did fix with the same stuff. However if anyone can easily see what I missed, tell me.

Since I totally rewrote one function, it's probably easier to look at my code by looking at this snippet:
fitch.tky.hut.fi/~semi/GetBuildPos_semi.cpp
which contains just the reimplemented function and the helper functions I needed to make.

So, umm, what am I supposed to do now?
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

Submit your patch to Mantis, then wait for someone to commit it. ;)
User avatar
LordMatt
Posts: 3393
Joined: 15 May 2005, 04:26

Post by LordMatt »

Sounds nice!
espylaub
Posts: 205
Joined: 01 May 2006, 11:35

Post by espylaub »

Sounds good, especially reversing the direction for every second row. Neat. Thanks!
User avatar
Peet
Malcontent
Posts: 4384
Joined: 27 Feb 2006, 22:04

Post by Peet »

Win in a box! I was gearing up to whine about these very issues :)
el_matarife
Posts: 933
Joined: 27 Feb 2006, 02:04

Post by el_matarife »

Yeah this has been sorely needed. Thank you!
kuqa
Posts: 77
Joined: 16 Mar 2007, 23:27

Post by kuqa »

Its fun to read about these weird glitches like radar tower not being circled by factories and not even a coder knows whats going on there and has no idea of how to find out. It seems spring has developed a conciousness of itself, and is now growing in resistance.. first sync errors, then crash errors and now this thing that makes no sense... :d
User avatar
Zydox
Lobby Developer
Posts: 453
Joined: 23 May 2006, 13:54

Post by Zydox »

Sounds like a great patch... I hate having to draw lines of buildings up and down just to will a complete area without units walking more than they have to... :-)
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

Very cool, am looking forward to testing this :-)
semi
Posts: 69
Joined: 30 Mar 2007, 20:42

Post by semi »

I found and fixed the bug about being inable to queue a radar tower and vehicle labs circling it.

It turned out that it's much easier to reproduce that bug. Just need to queue a single radar tower, flip buildfacing once, and try to queue a vehicle lab right next to the tower on the left or right. This will actually result in cancelling of both.

Another way would be just queueing a flipped fusion and trying to circle it with DT. Not all DT would appear.

The issue was just that when checking if queueing a building order would cancel another, flipped buildfacing was not considered at all.

Now I can submit both of my patches to mantis.
Post Reply

Return to “Engine”