• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Road System

Status
Not open for further replies.
Level 6
Joined
Nov 3, 2005
Messages
103
I was wondering if anyone has created a tutorial or a map which shows how to accomplish a road system like the one in the first Warcraft. If not, would something like this even be possible?
 
Last edited:
Level 6
Joined
Nov 3, 2005
Messages
103
You have to precisely explain what you want and what problems you face/see.

In Warcraft 1 you were only able to construct buildings directly next to roads you created from the Town Hall. The game wouldn't allow you to place them anywhere on the grass. The same was for the roads, wherever you placed them they needed to be connected.

From my experience with the editor the only possible solution I can think of would be to use dummy units that tell the game where the buildings can be built, but I was wondering if someone else figured it out already.
 
Make a system to create the roads. Basically a system that you click on a piece of terrain and it changes that terrain to something resembling a road.

Then when creating building check if they are next to the road. There is a system that checks the square area of a building. That would be your best bet. ( I'm not sure what the system is called.)
If you want to do it a little less accurate then check if the building is close to the road. ( But this could result in building being built on the road or a little bit away from it.)
 
Level 9
Joined
Jul 3, 2008
Messages
495
I think it can be done in the following way:

When a unit is ordered to build, then get the x/y location, and check if there is a road around.

You can store every buildings width and lenght, so you know the offeset x/y.

Example:
Barrack = 128x128
Town Hall = 256x256
Road = 64x64

If you place a barrack, the offest may be 128/2 + 64/2 of the builded location.

If there is no road arround, then cancel the build order.
 
I think it can be done in the following way:

When a unit is ordered to build, then get the x/y location, and check if there is a road around.

You can store every buildings width and lenght, so you know the offeset x/y.

Example:
Barrack = 128x128
Town Hall = 256x256
Road = 64x64

If you place a barrack, the offest may be 128/2 + 64/2 of the builded location.

If there is no road arround, then cancel the build order.

This is the less accurate way as I mentioned above.
The building could be built over the road using this method.
 
Level 9
Joined
Jul 3, 2008
Messages
495
This is the less accurate way as I mentioned above.
The building could be built over the road using this method.

I dont think you are right.
If the road is just a building, with locust, you cant build a building on it because of the pathing.

Im not sure if you can set the collision size of the road to zero and still make units able to walk on it, and still keep its pathing.
 
Locust is not the point here. That does make a unit unselectable. But if you make the roads units with a model you are looking at a ton of units which would cause lag.

If you change the terrain it is much more efficient and no chance at lag since terrain is always loaded.

You could place building on the road and units can walk on it this way.
To counter the building being placed on the road you need to detect the roads around the building trying to be built. You then need to check to see if the building and the road intersect.
Using the simple method you suggested above.
If you place a barrack, the offest may be 128/2 + 64/2 of the builded location.
Will not work as that detects circular areas not square areas like terrain / buildings.
 
Level 9
Joined
Jul 3, 2008
Messages
495
Locust is not the point here. That does make a unit unselectable. But if you make the roads units with a model you are looking at a ton of units which would cause lag.

If you change the terrain it is much more efficient and no chance at lag since terrain is always loaded.

You could place building on the road and units can walk on it this way.
To counter the building being placed on the road you need to detect the roads around the building trying to be built. You then need to check to see if the building and the road intersect.
Using the simple method you suggested above.
Will not work as that detects circular areas not square areas like terrain / buildings.

Depending on his map I dont think the lag would be a problem. Once the road is builded, it could also be replaced by at destructables. I think this is how its done in the wc1 mod on wc3c.net.

What I understand of your method, you need to reserve one terrain tile for this. And if this should work i MP, you can build near the enemys road sinze you cant detect which player the road belongs. With units you can, and destructable if you fx set the hp point to the player number.

And you dont need to make a circular offset check. You just need to check every 32point arround the building. And this can easly be done with some math.

An extra bonus if you use units, is that you cant delete the road again, and you can use a different road for each race.
 
Level 9
Joined
Jul 3, 2008
Messages
495
With the method above you could store into a hashtable the position of the terrain tile. And with what player owns that road.

You can easily delete the road as all you need to do is make an ability that selects a point. Then check if a road is there. Check if it is owned by the player activating the ability. Then remove it.

Sorry, but I dont really see why making so big system and work arounds, for such a small problem. You may need a really big hashtable, 9 data entry for each peace of road per player.

You also to need at big loop system to check if the pointed location is a road owned by a player.

And you still forcing to reserve a terrain tile for this, and now also forcing the builder unit to have an extra ability to remove the road.


Some dummy units or destructables that act like a road wont cause any lag.
 
9 data entries is a little excessive.
You only need 1 data entry.
  • Hashtable - Save (Player Number) as (Integer(X)) of (Integer(Y)) in HashTable
X and Y values will need a little math to be taken down to distance between tile and tile. This way loading and saving would be a lot safer.

You can also have 12 or 16 terrains which is plenty of terrains. Most maps use about 8 of them.
 
Level 9
Joined
Jul 3, 2008
Messages
495
It is still a disadvantage that you need to reserve a terrain tile for this.

Another one is, that you can only place terrain tiles with an offset of 128point, and with buildings that is 64point (See attached image). If blight is used in the map, this can also affect the road system.

If you look at The Dawn of Chaos mod, you can see they also use buildings/destructables to create their road. Because the building mark turns red that place the roads are, when they want to place a structure.
https://www.youtube.com/watch?v=1p7zP-uRx04



But there is advantage and disadvantage for both methods, and it is up to mattdraw, what system that would fit his map best.
 

Attachments

  • Udklip.PNG
    Udklip.PNG
    818.9 KB · Views: 163
Status
Not open for further replies.
Top