Posted: Wed Dec 18, 2013 11:21 am Post subject:
TS/RA2 grid not exact
It's not a big deal, but the TS/RA2 grids aren't 100% accurate.
-the grid should show the inner border of a tile (currently it's neither the outer border nor the inner but sometimes here sometimes there)
-the grid basically has to be 2 lines big (not only one) to show the inner border of each cell
attached is a SHP which could help you to get the TS grid exact. (don't have a RA2 example)
The SHP Builder grid should match exactly the one in the shp.
To make the SHP Builder grid preview only in the south is ok. I just copied mine over the whole image as this was easier to create.
suggestion: an option to highlight a certain foundation size might be nice.
It should be like testgrid2 with the doubled lines, as only this is showing the exact tile borders (except you invent a pixel in between 2 pixel and you can show a line just between the tiles borders)
If you have only a single line, you can't tell exactly, if it's the inner or outer border of the current cell. (your single line example is also wrong, as you missed adding empty lines in between each tile. You have only the border of one tile and 2 tiles next to each other don't overlap with their border, but they are next to each other. see attached example gif)
The grid should be also not shown over the entire frame, but only from the center going down to the south (like it's currently).
It's simply because the base of a building never goes northwards of the center cell, but all foundations expand to the southwest and southeast only.
grid.gif
Description:
-a single tile is the bright red border with the darker red area -tiles are placed next to each other, thus no overlapping part and each tile in the grid needs its own inner border visible
here's the code i wrote for TMP Shop to show the borders there.
it also includes heighlevel which is a tmp thing only.
In this one it draws on a per frame basis (each cell in a tmp is a single frame), so this code only draws a border to a single cell, but it is repeated for every cell in the tmp.
for you interesting is basically the polygon only as this is a single cell and then you only have to place this polygon next to each other without having them overlap
the tile dimension is as follows
tmpfile.header.cx = 48 for TS and 60 for RA2
tmpfile.header.cy = 24 for TS and 30 for RA2
framex and framey are the offset/location of the tile in the tmp
Code:
int framex = Math.Abs(r.X) + tmpfile.frames[frame].imageheader.x;
int framey = Math.Abs(r.Y) + tmpfile.frames[frame].imageheader.y - tmpfile.frames[frame].imageheader.heightlevel * tmpfile.header.cy / 2;
// Draw the specified section of the source bitmap to the new one
if (tmpfile.frames[frame].image != null)
{
Point[] tileborder = new Point[6];
tileborder[0] = new Point(framex + tmpfile.header.cx / 2 - 1
, framey + 0);
tileborder[1] = new Point(framex + 0
, framey + tmpfile.header.cy / 2 - 1);
tileborder[2] = new Point(framex + tmpfile.header.cx / 2 - 1
, framey + tmpfile.header.cy - 2);
tileborder[3] = new Point(framex + tmpfile.header.cx / 2
, framey + tmpfile.header.cy - 2);
tileborder[4] = new Point(framex + tmpfile.header.cx - 1
, framey + tmpfile.header.cy / 2 - 1);
tileborder[5] = new Point(framex + tmpfile.header.cx / 2
, framey + 0);
Pen p = new Pen(Color.FromArgb(175, 0, 255, 0));
g.DrawPolygon(p, tileborder);
}
Okay, I gave the grids a shot, tell me if something is wrong.
EDIT: I checked with your .shp and mine is off by one pixel, but I'm not sure if it's mine or yours that's right Anyway, just tell me, this is an easy fix if it's mine that's wrong.
yours is off.
Canvas.Height / 2 is the point on which the inner border starts of the top most cell. Yours is Canvas.Height / 2 + 1 (yours is off, because the outer most 1-pixel-line of your 2 pixel wide grid is already the inner border of the cells next to your grid)
Another small suggestion:
your grid is only shown on transparent background. Could you show it also above every other color?
When you have a building, you want the grid to be shown on top of it, so you can check the building border against the grid. If the grid is only drawn on the background behind the building, you can't really see by how many pixel the building is off.
When creating warfactories, you also need the grid to show in front of the building, so you can check if the door is on the right position.
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