Ok guys, here's the deal. It may take a bit for me to explain, but a lot for you to answer, so please have some patience because I have thought and thought and asked many people but no one can come up with a system for me. I'm having problems with a map, but I don't want to give away too much, so I'll list some important key details of the map to help you understand what you're dealing with.
Type of map
- Turn-Based Strategy
Layout
- There are [4x4] squares, each of which are connected together
- Each unit you have can take over 1 square, once every turn
- Each player has his own territory, which can contain multiple squares in width and/or height
- The territor(y/ies) you own are most likely NOT going to be perfectly square
- The territories cannot connect diagonally
- Each territory has a capital, a single building taking up a single square (This is where the problem starts)
Explaining the cause of the problem:
- Since an enemy of a player can take over his squares, it would be possible for a player's territory to be cut in half. Cutting in half a territory would leave one of the halfs without a capital.
Problem:
- Detecting when exactly the territory is cut in half, but remember that it's multiple squares wide and/or tall.
There are 182 open spaces, not including the ones filled with water, which can't be used. I will use any trigger system that will work, as long as it doesn't take hundreds of triggers to perform, because unfortunately the only system I could think of would take 728 triggers.
Thanks for your help in advance, guys.
Maybe if you made 4 locations big enough to determine whether or not the territory is 1/2 taken away. It would take 4 locations per territory (depending on if the territory can expand).
Hope this makes sense.
No, that wouldn't work because the territories aren't always square.
MMm so the teritories are shaped like a grid on a chessboard?
Ok i'm going to assume you have some kinda burrowed unit or unit indicator on each territory to determan who owns that territorty.
If thats not the case make it so.
So here is what i'm thinking, The locations are 4x4 so you will need a location to cover 9 territorys (every territory that can connect it)
What were going to do is make the location move around to all territorys and hop to each one adjacent to changing its zergling marker to another player.
So the first step is to detect where the Capital is and start there (since that is the one you want)
Imagine this as your territorys. (with x being yoru capital and the space being the gap.
**** **
**x* **
**** *
So what we will do first is center a 12x12 and a 4x4 location on the capital. Then were going to give the zergling marker at the 4x4 location to (player red) Now our territorys will look like this (grayed out showing what teritorys are covered by the 12x12. And red to indicate the player was changed.
****
**x*
****
Ok now what we will do is we will center the 12x12 on a terriotry you own within that location and give the unit to our 'red' player.
****
**X*
****
it will then continue though my example like this.
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
Now as you can tell there is still one left unchanged witch is good a(cause it will happen alot espcially with none rectangular paterns). Because if this we have step 2.
What were going to do is move our 12x12 location to each red one, and check to see if there is a unchanged territory there. (if there is we change it starting up are red step 1 again). If there isn't were going to change it to orange and keep moving. Once again we will do this one at a time and it will look like this.
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
At this point you would of detected the other location. So we will change it to red.
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
****
**x*
****
So our triggers would keep running as long as there are any red territorys. Until all its adjacents are detected and there are no more reds.
Now what we have is
**** **
**x* **
**** *
and you can remove all the white ones or whatever you intend on doing to it.
Now writing the triggers is almost another whole challenge itself, I'll help you on a one-2-one basis if you want to try this method.This is going to help me a considerable amount!! Thank you so much for taking the time. That leaves a few other questions with me now, now that I know it's possible. If you get on Battle.Net I could talk to you and you could help me. I'm on right now.
Just took my shower, and i thought of a more effecent easyer way (well i'm talking to you on aim anyways lol)
Well anyways talking to you now I determaned that you are going to place a new capital on the non capital part and you don't want diainal boundrys to count.
I thought of a more effecent easyer way to do it. and solve the diaginal problem.
Ok since were only counting horizontal and vertical connections we will need two locations for that a 12x4 and a 4x12.
When you need to detect a change in terriotry (possable split) ie you lose one.
First center both those locations on your capital.
Then instead of just centering the location and giving one adjacent part away give them all away at once to the red player. Give the capital to orange and repeate the same step as long as you have red territorys.
And here is another diagram
*
*
****
*X*
***
*
*
****
*X*
***
*
*
****
*X*
***
*
*
****
*X*
***
*
*
****
*X*
***
*
*
****
*X*
***
*
*
****
*X*
***
*
*
****
*X*
***
*
*
****
*X*
***
*
*
****
*X*
***
*
*
****
*X*
***
*
*
****
*X*
***
*
*
****
*X*
***
The key on this one is it is faster cause it moves 4 directions at once instead of only one. Also its easyer to trigger.I remember solving a problem like this in my minesweeper map a long time ago, but it looks like bolt aready got it worked out for you. I could post the unlocked map if it would help, though.