Customizable placement of buildings

Customizable placement of buildings

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

Moderator: Moderators

User avatar
Rayden
Posts: 377
Joined: 01 May 2005, 13:15

Customizable placement of buildings

Post by Rayden »

In my last game my base was built up the way that i had to place my gantry pretty stupid to get my mechs out.

So what about beeing able to rotate buildings? Could this be done somehow in a comfortable way?

Maybe showing an arrow in placement box and being able to switch direction with some key.
User avatar
Drone_Fragger
Posts: 1341
Joined: 04 Dec 2005, 15:49

Post by Drone_Fragger »

MTR.
User avatar
Rayden
Posts: 377
Joined: 01 May 2005, 13:15

Post by Rayden »

Ok i give up searching .. what means MTR?
User avatar
NOiZE
Balanced Annihilation Developer
Posts: 3984
Joined: 28 Apr 2005, 19:29

Post by NOiZE »

User avatar
Rayden
Posts: 377
Joined: 01 May 2005, 13:15

Post by Rayden »

<-- Own3d

EDIT: But anyway good to call it back into memory :-)
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

MTR is MTR, but why, by the gods of hell, is it so hard to implement? Just a button to rotate the yardmap and the model clockwise/counterclockwise 90 degrees.. haven't looked at that part of the code myself though, but shouldn't really be that hard..
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

That sounds like a perfect junior job then, if it's that easy. I'm awaiting your patch.
User avatar
FizWizz
Posts: 1998
Joined: 17 Aug 2005, 11:42

Post by FizWizz »

Sean Mirrsen <-- Own3d.

I've been looking forward to rotatable footprints for units and buildings, but as has been said before, it's apparently much harder than it sounds.
User avatar
aGorm
Posts: 2928
Joined: 12 Jan 2005, 10:25

Post by aGorm »

IF i recall corectly it messes with teh pathing engin or somthing.

aGorm
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

Tobi wrote:That sounds like a perfect junior job then, if it's that easy. I'm awaiting your patch.
If I didn't have so much trouble reading your code, I may have attempted to do it. So far I understood that unit yardmap, if present, is loaded at the start of the game, and once the building is placed, it is counted as a SolidObject, and its yardmap is applied to the map via AddGroundBlockingObject. I can't pinpoint the sequence of events from building being selected for construction to starting building construction though. Presuming you can help me with that in any way(and presuming you can get me the 1.33.1 boost libs for VC71 so I can compile the thing), I'll gladly help you out. :)

There could be a problem with one yardmap being used for all buildings of one type though, so an alternative means would be to load four versions of the yardmap (have yardmapN, yardmapE, yardmapS and yardmapW variables instead of just yardmap), and have each instance of a building bear a tag, N, E, S or W, according to where the building was oriented when placed. I think the Num_Enter is disused at the moment, so it can work as a switch button. For ALL built buildings, so you don't have to re-rotate them for each instance placed.
User avatar
Argh
Posts: 10920
Joined: 21 Feb 2005, 03:38

Post by Argh »

That sounds more than acceptable. True freeform rotation would be nice, but probably impractical, given the grid that underlies almost everything in Spring.
User avatar
AF
AI Developer
Posts: 20687
Joined: 14 Sep 2004, 11:32

Post by AF »

SJ said rotating buildings could be done but only in 90* rotations, otherwise the pathing would be wierd.....
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

Sean Mirrsen:

I think you're on the right track. If the yardmap is stored in the UnitDef (which I'm pretty sure it is), you'd probably want 4 yardmaps in different rotations, plus the var which remembers for every building which orientation it has.

Also, AddGroundBlockingObject (or whatever it was called) must be modified to put the right map on the blockingmap.

As for the exact equence of events from building selection to building, I'm no expert in that part of the code so I don't know it out of my head. I may see if I understand it later.

As for boost, I don't use MSVC and hence I don't have boost libs for MSVC and can't give them to you... Either ask a dev who does use MSVC, compile boost yourself, change the project file to use 1.33 instead, or any other workaround.
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

Ok, I've set up the generation of the four yardmaps, and the individual facing tag in the code, but I can't find the moment where the info from UnitDef is applied to the map (through CSolidObject or otherwise). Unless I can find that, I won't know where to go next.. help....
Tobi
Spring Developer
Posts: 4598
Joined: 01 Jun 2005, 11:36

Post by Tobi »

doesn't AddGroundBlockingObject do that? Or do you mean what calls that function (in which case I suggest a search through the source files, often works pretty well to figure out where certain things happen :wink: )
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

You won't believe it, but I found the spot. Now I need a way to visually rotate the "ghost" "for-building" model in UnitDrawer. And the unit model itself, too.
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

Hm. What would be the best class to stick a global "buildFacing" variable into? Game, or maybe Player? I just need an educated guess, or a solid opinion.
User avatar
SinbadEV
Posts: 6475
Joined: 02 May 2005, 03:56

Post by SinbadEV »

Awh... no wild guesses? I would put it wherever the mouse position is... because I don't know what I'm doing of course... otherwise in the player somewhere... any idea how we will be rotating buildings?
User avatar
Comp1337
Posts: 2434
Joined: 12 Oct 2005, 17:32

Post by Comp1337 »

omg. Youve actually done it? fixed rotatable buildings in 90 degree increments?

/bow
Sean Mirrsen
Posts: 578
Joined: 19 Aug 2004, 17:38

Post by Sean Mirrsen »

Well, not exactly, no. (so you can, like, "unbow", if you wish :P) Since I've done so many random changes trying to find what exactly I needed to do, I made Spring crash the moment any units appear in-game, even in debug mode it crashes without doing anything else. So I currently reverted back to the original code, and will now employ step-by-step "add and check" tactics to see what could have caused the crash. At least I know what to do now. Except one thing - I still don't know how to rotate the building model, both after completion, and when it's selected for building.

P.S. To be honest, I've never finished any project that I have started myself. Ever. :( So chances are good that this one will suffer the same fate. Don't get your hopes up.
Post Reply

Return to “Engine”