Posted: Thu Jun 12, 2014 5:55 pm Post subject:
TS & RA2 Tunnel Drawer
Born of frustration, here's a little Flash based tool I wrote that TS mappers such as myself should find useful. It allows you to draw tunnels (three pairs of them, to be precise) between two tunnel entrances and as an output you get the lines of code for the tunnels that you can then copy and paste into your map file. I've made several tunnels with this and so far they've all worked very solid! So in case you're struggling with curved or other more complex tunnels, this program is for you.
Quote:
INSTRUCTIONS
With this program you can easily generate tunnel codes for Tiberian Sun and Red Alert 2 maps. The program's interface is divided into three sections: The options section at the top, the grid section at the middle and the output section at the bottom.
OPTIONS SECTION
First 4 input fields: X and Y coordinates of the red and orange tunnel entrances' middle cells. Press ENTER to apply changes. Values can be between 1-1024. Notice that the coordinates given by the Final Sun and Final Alert map editors are in reversed order, here they are not!
Orientation buttons: Click to change the orientation of the tunnel entrances.
Mirror X/Y button: Changes the entered X values to Y values and vice versa.
Index input field: The index value of the first generated tunnel. Press ENTER to apply changes. Values can be between 0-121.
GRID SECTION
This is where you create your tunnels. Click on one of the tunnel entrances to begin drawing a tunnel. You can draw 3 tunnels, each starting from a different cell of the entrance. Click the grid to add tunnel nodes. Each tunnel must end at a different cell at the other entrance.
Red cells: The first tunnel entrance. This color will also indicate cells that exceed the tunnel max length of 99.
Orange cells: The second tunnel entrance.
Green cells: These show the tunnel's shape. The middle tunnel is drawn in slightly darker color.
Esc: Remove the current tunnel and stop drawing.
Backspace: Remove last entered node.
Arrow keys: Move the view 1 cell to the desired direction.
Shift + arrow keys: Move the view 5 cells to the desired direction.
Spacebar: Center the view between the entrances.
Q & E: Center the view at the entrances.
C: Clear all tunnels.
F: Force the tunnel to end. This will only generate the tunnel in one direction, and without ending coordinates.
T: Toggle the distance text mode/visibility.
OUTPUT SECTION
The codes for your finished tunnels will be generated at this section. Copy and paste them somewhere in your map file using a text editor.
If you find any bugs or have improvements in mind, please let me know and I'll see what I can do about it. Just bare in mind that I intend on keeping the program simple, partly because I'm still quite new to programming.
Fell free to share this on other modding sites as well. PPM's the only modding related site I visit, so this is the only place where I'll post this.
Thank you for the great response. I also posted this at the Tiberian Sun mapping tools topic, I hope people will notice it from there. _________________
Twisted Insurrection's Lead Campaign Developer QUICK_EDIT
I'm not very familiar with tunnels in RA2, but as far as I know their syntax under [Tubes] is exactly the same as in TS. So yes, this should work with RA2 too. _________________
Twisted Insurrection's Lead Campaign Developer QUICK_EDIT
Nice tool
- good that you have truncated the unneeded -1s from the entries, will save some bytes of the map size.
- it allows crossover, I have not tested whether they work.
- could have been an option to make forward and backward entries take different paths, anyhow that can be done
by charting 2 paths and combining them manually now. They work in TS.
- could have been an option to make forward and backward entries take different paths, anyhow that can be done
by charting 2 paths and combining them manually now. They work in TS.
That did cross my mind, but I ended up coding it the way it is now so that you can draw the tunnels faster. And like you said, if you want the forward and backwards tunnels to be different, you can just draw and copy their lines separately.
At first I planned to code it so that you only need to draw the middle tunnel and it would generate the other ones automatically around it, but that turned out to be a bit too challenging for me and would've limited the programs functionality a lot.
Crossovers should work just fine, as well as crazy shit like in the attachment.
wut.png
Description:
Filesize:
21.95 KB
Viewed:
677586 Time(s)
_________________
Twisted Insurrection's Lead Campaign Developer QUICK_EDIT
No problems on different path for to and fro. It is already a helpful tool.
Crossovers and convergence to a single cell also works, tested. Game just queues up. Had fun with it. QUICK_EDIT
I updated the program a little bit, the first post has the latest version.
v1.01:
- Changed the name to TS & RA2 Tunnel drawer, because there's no reason why this should be limited to TS only.
- Increased the orange orient button's hitbox size.
- Changed the min and max limits of the tunnel entrance coordinates to 1 and 399, which are the min and max coordinates in a 200x200 map.
- Because the tunnels can be max 99 cells long, the entrances can now be max 99 cells from each other in both directions. If you try to place the entrances more than 99 cells from each other, the larger coordinate is changed so it's 99 plus the smaller coordinate.
- Made some small changes to the instructions. _________________
Twisted Insurrection's Lead Campaign Developer QUICK_EDIT
min and max on DTAs Africatorial map are 1 and 509 since it's a 430x80 map. I think best would be to set max on 1024 or don't set a max at all, since you could theoretically also create a 511x1 map and maybe in future an exe pro finds a way to raise the map limit to 1024x1024.
Q45 wrote:
- Because the tunnels can be max 99 cells long, the entrances can now be max 99 cells from each other in both directions. If you try to place the entrances more than 99 cells from each other, the larger coordinate is changed so it's 99 plus the smaller coordinate.
not a good change imo, because
-units can only move 99 cells in a tube, but tubes can still be longer
-if the start/exit are farther apart than the number of "move direction numbers", then the unit is simply teleporting to the exit when it reached the last "move direction number"
-DTAs map Africatorial is one practical example of a map with a tunnel from 500,78 to 78,500 (and several other tunnels that make this map a "ring")
DTA used this excessively in the past to have teleporter tunnels. No "move direction numbers" just the start and exit coords, so units simply teleported between the tunnel points.
The only problem are infantry, as they leave the tunnel when the last "move direction number" is reached and they don't teleport to the exit. They just appear where they are, which can be also impassable terrain.
Suggestion:
-no limits
-when a tube has more than 99 "move directions numbers" (mdn), show the first 99 mdn in green and then draw a simple blue arrow from the last mdn to the exit, to show that this distance is being teleported by the tunneled unit (except infantry who just leave the tunnel on the last mdn and become visible regardless what kind of terrain they find there) _________________ SHP Artist of Twisted Insurrection: Nod buildings
Ah, I wasn't aware of the teleporting. Well, I was but didn't pay attention to it before. You got a good point there, the program should also support these longer tunnels with "teleportable" bits. In addition to what you suggested, there could also be a keyboard shortcut that whenever pressed would end the tunnel drawing progress and create a teleportable bit from the last entered node to the other entrance. So just like pressing esc but instead of removing the tunnel you'd get the teleport at the end. This way you could also create teleporter tunnels without any "move direction numbers".
I could raise the max limit to 1024 or something larger, but then the way the grid is drawn should be redesigned. Otherwise the grid gets way too small to be usable when large coordinates are entered. Maybe the grid's size should be capped so it won't go too small, but then the tunnel entrances could go outside of the borders. There could be two arrows floating near the borders that point to the entrances so you can navigate to them using the arrow keys. I don't know... _________________
Twisted Insurrection's Lead Campaign Developer QUICK_EDIT
how about limiting the visible grid size to the one you get when you set 1,1 and 50,50. This would be smallest visible grid size.
And when you draw a tunnel, the focus automatically centers around the last clicked tunnel point. This way you can still draw long tunnels as the focus is following the tunnel.
Arrows at the screenborder showing the direction to the start/exit that are outside the view, sounds good. _________________ SHP Artist of Twisted Insurrection: Nod buildings
v1.02:
-Entrance coordinates are now limited to values 1-1024.
-Limited the cell's size to min 10 pixels.
-When a tunnel entrance is off screen, an arrow will appear and point to its direction.
-Removed the 99 limit from the entrance coordinates, they can now be placed as far from each other as you like.
-Improved keyboard shortcuts:
-You can now move the entrances faster by holding down the arrow keys.
-Holding shift while pressing the arrow keys will move the entrances 5 cells instead of 1.
-Space bar centers the view between the entrances.
-Q and E center the view at the entrances.
-C clears all tunnels.
-F forces the tunnel to end at the latest node.
-Tunnel cells that exceed the 99 limit are now shown in red.
-Rewrote the instructions, not a wall of text anymore.
-Fixed a couple small bugs.
About LKO's teleport suggestion: I was going to add the "blue teleport lines", but realized that since the tunnels are created in pairs there's no good way of generating the backwards tunnel if the other pair ends with a teleport. The problem could be solved if you had to draw all 6 tunnels separately, but I don't think that's a good idea. I would've had to rewrite a large part of the program, the interface would've become more messy and more difficult and slower to use. Also, it can be argued whether or not the teleport tunnels which don't work with infantry are a good thing or not, personally I'm not a big fan of them. So I left this functionality out. I did however make navigating a bit more user-friendly by adding the shift+arrow key functionality. I also made it possible to force end the tunnel at the latest entered node by pressing F, but this only generates the tunnel in one direction and doesn't show its ending coordinates. Maybe someone finds this useful. _________________
Twisted Insurrection's Lead Campaign Developer QUICK_EDIT
Just made a little update to this. I noticed that copying the tunnel code with ctrl+C was buggy, so I added a copy to clipboard button next to the code to make things a bit easier. _________________
Twisted Insurrection's Lead Campaign Developer QUICK_EDIT
When you enter the coordinates how you see them in FS and then notice they are in the wrong order, you have to enter them all again.
A button [Mirror Values] in the tool to simply switch the coordinates would be useful, so you don't have to enter them again. (just switch X to Y and Y to X on start and end)
Mirroring the direction of the start/end could be done in this step too.
Another tiny improvement would be to fix the Tab order.
When you are in the first value textbox and press Tab, you get the Instructions highlighted, not the second value textbox. _________________ SHP Artist of Twisted Insurrection: Nod buildings
Thanks for the feedback LKO. I updated the program, the tab order is now correct and there's a mirror X/Y button in the toolbar.
I also added a textbox next to the selected cell that shows its distance from the previous tunnel node/entrance. Press T to toggle the mode between off/absolute/relative coordinates. Very useful when counting cells, especially when making long and curved tunnels. _________________
Twisted Insurrection's Lead Campaign Developer QUICK_EDIT
Excellent.
Thanks for the update.
Also very nice idea about the useful distance info.
I think the relative distance info should be default, since that is imo more useful than the absolute position info.
Maybe you could enhance the distance info and include a counter of the "move direction numbers".
A tunnel can be max 99 move direction numbers long and a counter for the current total tunnel length could be useful.
e.g. format like
x,y (t)
with
x,y length to last tunnel point (like now)
t total move direction numbers of current tunnel _________________ SHP Artist of Twisted Insurrection: Nod buildings
You can still run this via Internet Explorer (apparently) or some other Flash environment.
I managed to get IrfanView to open the SWF via RMB > Open With.
But apparently this is not possible on others' machines. Last edited by TAK02 on Sat Jan 30, 2021 9:28 pm; edited 1 time in total QUICK_EDIT
Grab it before it goes away or ask the Supreme Banshee to host it on PPM and link to it here. _________________ One and only developer of the Command & Conquer Dune "C&C D" mod.
m7 wrote:
I tend to release things I create so that assets are never lost to hard drive problems, accidental deletion, or me having to pretend to care about rippers taking things from my project when it is done.
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