Tracks and trains
Wednesday, March 11, 2020 - 07:26
How do I assemble all of those pngs found on those two links: https://opengameart.org/content/hex-tile-railway-tracks https://opengameart.org/content/railway-locomotive-and-wagons
Into actual working assets for my game?
other than the obvious "place the images next to each other", how could we possibly know how to get them to work for your game. You have not even told us what your game is. are you asking for hlep coding your game?
My game is a train simulation game with a bird's eye view called "All Aboard" that I intend to develop in Unity. It is however for educational purposes only and not for public use, as I am developing it for a college (UK definition) project.
That set consists of 72x72 pixel hexagons, so you could tell unity to slice up the atlas at every 72 pixels. Or you could slice them up into individual images with https://www.piskelapp.com/
Once you have individual sprites, you can place them next to each other as needed. However, because these are hexagons and not rectangles, every other row will need an offset. So the first row will have sprites placed at
(0, 0), (72, 0), (144, 0), (216, 0) ... and so on but the second row will be offset by x+36, y-18
instead of the typical (0, 72), it would start at (0+36, 72-18) and add x+72 as normal for the row after that:
(36, 54), (108, 54), (180, 54), (252, 54) ... and so on.
However, this set seems... incomplete. There are no tiles that allow turning back from an eastbound track to a westbound track. The tracks also seem to align poorly. Is that some of the trouble you're having? It would be easier if these hexagons were biaxially symmetrical so you could simply rotate them to get a new orientation.
You may consider using Xenodora's LPC mine Carts and Tracks instead. It is more of a 3/4 view instead of fully overhead view, but the track segments are designed with tighter tolerances.
--Medicine Storm
OK then I've chosen to use Xenodora's LPC mine Carts and Tracks instead. However I'm now encountering the new problem of how do I divide up the big image of tracks i.e. rails and sleepers combined? It won't let me do it in the Sprite Editor in Unity which is what my teacher suggested.
In fact getting all the bits of infrastructure split up so I can use them has proven impossible. Does anyone know a workaround?
It should be 32x32 sections for Xenodora's stuff. What size and shape are you looking for? Unity Sprite Edtior worked great for me (see screenshot)
Slicing these up in something like piskel works great as well. It may help to tell us why it won't let you do it. Error messages? Or does it allow it, but doesn't divide them like you expected?
What is it you're trying to "work around"?
Every game is different but it seems we're expected to already understand the exact requirements of a game you haven't described in detail.
--Medicine Storm
unity-editor.jpg 99.7 Kb [70 download(s)]
Thank you for your help.
This link shows the exact requirements to my game in a lot of detail: https://docs.google.com/document/d/1tEogskdrDJ8lYE-hF2WWAGsuHNeHAkbIDxgW...
TLDR? I need tracks that are suitable for a passenger train to run over, and are compatible with a signalling system (it doesn't need to be too complex, I just need two aspects i.e. green (proceed) and red (danger)), as well as compatible rolling stock that is fit for carrying passengers, preferably by modern standards but 19th century ones will do. :D
Thanks for the details. That's one question down. Now for the rest of them:
--Medicine Storm
I just noticed the specifications do not require diagonal tracks. If you're not married to the idea of having diagonal segments of track, I think you can drastically simplfy the coding work you'll need.
By using sprites that only connect North, East, South, and West tracks (and not diagonal northeast, southwest, southeast, and northwest tracks) then you can simplify the sprites down to 16 versions of 96x96 pixel sprites. No overlapping sprites, no pixel offsets for unusual shaped tiles. Heck, if that sounds like something useful, I can demonstrate exactly what I'm talking about. Let me know. :)
--Medicine Storm
Please do, I'd find that very helpful.
Sure. Here is a quick tileset of 96x96 pixel tiles. They're numbered with each direction corresponding to a bit position. You don't have to care about that, but i figured it may make it easier to track: North = 1, East = 2, so north+east = 1+2 = 3
N E S W
1 2 4 8
Here is a breakdown of each row of the tileset:
There are a few more combinations of splits and joins not in this tileset, but it gives the basic idea. If this looks like it may be something you'll use, let me know and I can easily fill in the missing combinations.
The second image is an example of the tiles in use. Can you get your train from point A to point B? There is only one valid path as far as I know.
--Medicine Storm
tracks_96x96.png 20.7 Kb [87 download(s)]
track_example.jpg 170.5 Kb [12 download(s)]