:: Home :: Get Hosted :: PPM FAQ :: Forum FAQ :: Privacy Policy :: Search :: Memberlist :: Usergroups :: Register :: Profile :: Log in to check your private messages :: Log in ::

Do you want to advertise at Project Perfect Mod. Find out how to do it HERE.

The time now is Sat May 08, 2021 11:30 pm
All times are UTC + 0
 Forum index » Featured Tools » Community Tools
How to draw buildings [TS/RA2]
Moderators: Community Tools Developpers
Post new topic   Reply to topic Page 1 of 1 [6 Posts] View previous topic :: View next topic
Author Message
RP
Commander


Joined: 12 Jul 2012
Location: Mapping God Heaven

PostPosted: Tue Feb 02, 2021 8:35 am    Post subject:  How to draw buildings [TS/RA2] Reply with quote

I would like to know how a building is draw offset wise.

Generally the drawing offset of a coordinate is at the topleft corner if one were to draw a square around a tile. For single tile objects like infantry, it's relatively easy to get draw them on the correct position. Like this, the top left corner of the gray square is the 'starting point' when drawing in all my cases.


For buildings, this is a bit more complex. In the screenshot below, I simply have the base image without animation stuff.
The offset calculations I took are:
- offset starts at topleft corner of the square of a tile
- x and y of the SHP frame are added to the offset
- half width and half height of the frame are subtracted from the offset

As you can see, nothing is positioned correctly on the red tile.
Anyone around who can help me move forward?


Screenshot_20210202_093124.png
 Description:
 Filesize:  402.72 KB
 Viewed:  295 Time(s)

Screenshot_20210202_093124.png



_________________


Mental Omega 3.0 Mission creator - Creator of FinalOmega: APYR 3.0 Map Editor

/ppm/'s stupidity

Back to top
View user's profile Send private message
Mig Eater
Defense Minister


Joined: 13 Nov 2003
Location: Eindhoven

PostPosted: Tue Feb 02, 2021 2:41 pm    Post subject: Reply with quote

The center of the shp file is used as the 0.0 coordinate, which is then aligned to the top of the building's foundation.


cell_align.jpg
 Description:
1x1 building with 30x60 shp
 Filesize:  38.47 KB
 Viewed:  270 Time(s)

cell_align.jpg



_________________



Back to top
View user's profile Send private message Visit poster's website ModDB Profile ID YouTube User URL Facebook Profile URL Twitter Channel URL
zzattack
Soldier


Joined: 29 May 2007

PostPosted: Thu Feb 11, 2021 12:21 pm    Post subject: Reply with quote

Quite a bit of stuff is involved with this, e.g. bibs, upgrade slots, turrets, active animations, 'damaged' fires, probably more. Maps renderer makes a good attempt at covering it all, in https://github.com/zzattack/ccmaps-net/blob/master/CNCMaps.Engine/Drawables/BuildingDrawable.cs

Back to top
View user's profile Send private message Send e-mail
G-E
General


Joined: 09 Feb 2015

PostPosted: Thu Feb 11, 2021 4:04 pm    Post subject: Reply with quote

Are you guys playing the same game as me?


griddy.jpg
 Description:
 Filesize:  31.65 KB
 Viewed:  217 Time(s)

griddy.jpg



_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
RP
Commander


Joined: 12 Jul 2012
Location: Mapping God Heaven

PostPosted: Sun Feb 21, 2021 8:38 pm    Post subject: Reply with quote

In the end I used the x and y of the SHP frame and the half-width and half-height of the SHP file. That works fine, even for the building animations, so that was a quick win.

Thanks all, it got me thinking again about my numbers!
_________________


Mental Omega 3.0 Mission creator - Creator of FinalOmega: APYR 3.0 Map Editor

/ppm/'s stupidity

Back to top
View user's profile Send private message
G-E
General


Joined: 09 Feb 2015

PostPosted: Mon Feb 22, 2021 3:40 am    Post subject: Reply with quote

The exceptions to the middle pixel being the top corner of the foundation is when the middle pixel is the center of the cell for TerrainTypes, and any AlphaImage applied to one inherits the center of cell alignment.

SmudgeTypes follows building foundation alignment, as they can have multi-cell foundations.
_________________
http://www.moddb.com/mods/scorched-earth-ra2-mod-with-smart-ai

Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [6 Posts] View previous topic :: View next topic
 Forum index » Featured Tools » Community Tools
Jump to:  
Share on TwitterShare on FacebookShare on Google+Share on DiggShare on RedditShare on PInterestShare on Del.icio.usShare on Stumble Upon
Quick Reply
Username:


If you are visually impaired or cannot otherwise answer the challenges below please contact the Administrator for help.


Write only two of the following words separated by a sharp: Brotherhood, unity, peace! 

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © phpBB Group

[ Time: 0.2030s ][ Queries: 15 (0.0111s) ][ Debug on ]