• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How many regions is too many?

Im working on an RPG that already makes extensive use of regions, but in order to add a new zone feature I've realized Ill need to cover the entire map in them.

My question here are:
1. Are there any significant downside to make hundreds or or thousands of region in a very large map?
2. Will making this many regions cause the game to lag especially if theyre multiple events tracked?

Thank you in advance to anyone that can help
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,552
I'd argue that there's almost certainly another solution than covering the entire map in regions.

1) I've heard that too many Regions can cause problems, but it was mainly associated with the Event "A unit enters/leaves region". If you can keep that Event usage to a minimum you could potentially avoid this issue. [Crash] - Using "Unit enters in (Playable map area)" event breaks my map

2) Look at #1.

What are you trying to do that requires so many regions? Could you instead use Points and X/Y coordinates?
 
I'd argue that there's almost certainly another solution than covering the entire map in regions.

1) I've heard that too many Regions can cause problems, but it was mainly associated with the Event "A unit enters/leaves region". If you can keep that Event usage to a minimum you could potentially avoid this issue. [Crash] - Using "Unit enters in (Playable map area)" event breaks my map

2) Look at #1.

What are you trying to do that requires so many regions? Could you instead use Points and X/Y coordinates?
It would exactly be for unit Enters/Leaves a region types trigger. Actually, it would be for just Enters regions, as of now I have a system that detects what part of the map a unit is with both Enters and Leaves in use, but there are still decently portions of the map not covered by any region.

I want to add a teleport-style ability to my map that allows a unit to change where it is, but if it teleports to another unit that is in-between regions it may cause minor errors.

My goal is to cover the entire area that's path-able to exclusively Enter regions and have none of these regions overlap, thus I know exactly where a unit is at all times without having to add leave triggers (The Enters can just handle most of the leave logic).


Two example of the current region system. (Just the blue ones, i.e. the zone wide ones, are of interest here)

Current Region System.PNG


Current Region System2.PNG

Whenever a unit enters the blue one it lets the game know they have entered a new region, these means there's a little bit of a blue in between one region ends and another begins (since I'm only using Enter events), but it works pretty well for ground pathing units, or flying units that's are bounded by blockers.


Right now this ~75% coverage manages to capture >99% of movement between regions because of pathing restrictions. I.E. characters have to one from one zone to another and one can know where they are simply by the last one they entered. I'm expecting this to be occasionally thrown of when a character teleports to allied units in between the blue, and I don't want to have to add a "leaves" trigger to each blue zone, instead, I was thinking of making the blue accurately cover each zone thus accurately tracking where exactly a character is at all times.

As of now the game runs pretty smoothly.


EDIT: For context I would use just leave and enter triggers with the current system, BUT I've noticed it's not always consistent as to which of these will run. I.e say one unit leaves on region and enters another, I need to make sure that either the leave or enter will always execute first. As far as I have tested leaves and enters don't always execute in the same order. Sometimes the game triggers the leave first and sometimes it takes the enter first.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,552
I'm not entirely sure I understand what you're trying to avoid but would this work?

Link the entered Region to the Hero (character) using a Hashtable or Unit Indexing. But before doing so, check the hero's current linked Region and run any logic associated with it -> Trigger - Run Leave_Region[Region_Index] (ignoring conditions). This could be done using Region/Trigger array variables.

Now you don't need any "Leaves region" events.

Additionally, you can periodically check to see if the Hero is in their Linked region (if they have one). If they are no longer in their linked region but also haven't changed to a new linked region then you know they've entered one of these "inbetween region" areas. You can then run your Leaves region logic if you wish. This could be useful to avoid the need for many new triggers, especially if you make a system out of it that automates repetitious functions. I suppose it all depends on how your map works though.
 
Last edited:
I'm not entirely sure I understand what you're trying to avoid but would this work?

Link the entered Region to the Hero (character) using a Hashtable or Unit Indexing. But before doing so, check the hero's current linked Region and run any logic associated with it -> Trigger - Run Leave_Region[Region_Index] (ignoring conditions). This could be done using Region/Trigger array variables.

Now you don't need any "Leaves region" events.

Additionally, you can periodically check to see if the Hero is in their Linked region (if they have one). If they are no longer in their linked region but also haven't changed to a new linked region then you know they've entered one of these "inbetween region" areas. You can then run your Leaves region logic if you wish. This could be useful to avoid the need for many new triggers, especially if you make a system out of it that automates repetitious functions. I suppose it all depends on how your map works though.

Not a bad idea, but I think I'm going to try my original idea of just covering zones entirely in blue regions and just using ENTER logic to sufficiently check when a unit enters/leaves. After looking at the map with 75% already covered and it running fine, I think an increase won't matter much, but I'll report back here and let the hive know my findings when I do.
 
Level 2
Joined
Jan 16, 2024
Messages
1
There are no significant downsides to making hundreds or thousands of regions in a very large map, as long as you use them wisely and efficiently. Regions are just numbers that you can assign to any tile on the map, and they do not affect the performance or the size of the game. However, you should avoid using too many regions for the same purpose, such as collision detection, lighting, or weather effects, as that might make your game logic more complicated and harder to maintain. You should also use descriptive names for your regions, such as "Forest", "Cave", or "Waterfall", instead of random numbers, to make your map easier to understand and edit.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,552
Another thing that I think is important to note, Regions are basically all broken in GUI and don't work like you'd expect them to - at least when trying to use certain region related Conditions. You can see how to fix them here:
With this fix applied, Units will actually be considered "in a Region" in response to the Enters Region event and vice versa. This is how you'd expect them to work.
 
Top