Skip to main content

User login

What is OpenID?
  • Log in using OpenID
  • Cancel OpenID login
  • Create new account
  • Request new password
Register
  • Home
  • Browse
    • 2D Art
    • 3D Art
    • Concept Art
    • Textures
    • Music
    • Sound Effects
    • Documents
    • Featured Tutorials
  • Submit Art
  • Collect
    • My Collections
    • Art Collections
  • Forums
  • FAQ
  • Leaderboards
    • All Time
      • Total Points
      • Comments
      • Favorites (All)
      • Favorites (2D)
      • Favorites (3D)
      • Favorites (Concept Art)
      • Favorites (Music)
      • Favorites (Sound)
      • Favorites (Textures)
    • Weekly
      • Total Points
      • Comments
      • Favorites (All)
      • Favorites (2D)
      • Favorites (3D)
      • Favorites (Concept Art)
      • Favorites (Music)
      • Favorites (Sound)
      • Favorites (Textures)
  • ❤ Donate
FLARE

Question on Flare code

npaulo
Thursday, March 24, 2022 - 08:13

Hi,

 

I would like to understand the rationally behind the calculatePriosIso() and calculatePriosOrtho() methods in MapRenderer.cpp

 

I do get the general idea of calculate a priority number to sort the objects, but the math here doesn't make sense for me , how this guarantee the correct order?

From where those numbers used on the shift operation come from? 37 ? this doesn't make sense for me.

 

Regards,

  • Log in or register to post comments
dorkster
joined 9 years 10 months ago
Friday, March 25, 2022 - 11:29
dorkster's picture

Stefan Beller, the original author of that code, wrote an explanation at one point. But it seems to have gotten lost for some reason (probably due to the Github organization migration). Luckily, I saved the email, so here's what he wrote: https://gist.githubusercontent.com/dorkster/ddd19a0c91400ffd1c31c8ba18df...

I'll also attach the graphic he made, since I think it does an even better job of showing how the information is laid out. Granted, the description is a bit out of date since we don't have the 256x256 map size restriction anymore. Which is why the shift amounts are different in the current version.

The TL;DR explanation is that there are 4 critera for sorting. In descending order of importance:

  • Which tile the object is on (red)
  • Which row is the object on (green)
  • The object's position within the tile (blue)
  • Any additional priority information, such as when handling dead/alive or speical effects (yellow)

 

Attachments: 
Preview
f7e9b0ac-633c-11e3-8f98-8f79101823b6.png f7e9b0ac-633c-11e3-8f98-8f79101823b6.png 14.4 Kb [1 download(s)]
  • Log in or register to post comments