Friday Facts #198 - Rail segment visualisation
-
- Burner Inserter
- Posts: 6
- Joined: Fri Feb 03, 2017 4:00 am
- Contact:
Re: Friday Facts #198 - Rail segment visualisation
No reason to over complicate it. Just show indications at intersections where a signal would be relevant. At those intersections have a color coded overlay on which track has priority or if it has none at all. Simple, easy, expandable.
If you got problems, I got solutions; free of charge.
If you got problems, I got solutions; free of charge.
-
- Inserter
- Posts: 20
- Joined: Tue Jul 12, 2016 10:56 pm
- Contact:
Re: Friday Facts #198 - Rail segment visualisation
I think the block colors is a great idea to help people understand. However, one thing that helped me a lot in Simutrans was a command to show which blocks are reserved by trains as the trains are moving.
In this screenshot, the red shows which parts of the track are reserved by trains as they move around.
from: http://forum.simutrans.com/index.php?topic=17060.0
Factorio might have this as a debug feature (not sure), but maybe it could be made a first class feature you can use in a normal game.
In this screenshot, the red shows which parts of the track are reserved by trains as they move around.
from: http://forum.simutrans.com/index.php?topic=17060.0
Factorio might have this as a debug feature (not sure), but maybe it could be made a first class feature you can use in a normal game.
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Friday Facts #198 - Rail segment visualisation
If you hadn't said that was Simutrans, I would have thought it was OpenTTD with a graphics pack installed.Kevin Ar18 wrote:I think the block colors is a great idea to help people understand. However, one thing that helped me a lot in Simutrans was a command to show which blocks are reserved by trains as the trains are moving.
In this screenshot, the red shows which parts of the track are reserved by trains as they move around.
from: http://forum.simutrans.com/index.php?topic=17060.0
Factorio might have this as a debug feature (not sure), but maybe it could be made a first class feature you can use in a normal game.
Re: Friday Facts #198 - Rail segment visualisation
No debug needed. just place the mouse over the train.Kevin Ar18 wrote:I think the block colors is a great idea to help people understand. However, one thing that helped me a lot in Simutrans was a command to show which blocks are reserved by trains as the trains are moving.
In this screenshot, the red shows which parts of the track are reserved by trains as they move around.
from: http://forum.simutrans.com/index.php?topic=17060.0
Factorio might have this as a debug feature (not sure), but maybe it could be made a first class feature you can use in a normal game.
-
- Filter Inserter
- Posts: 952
- Joined: Sat May 23, 2015 12:10 pm
- Contact:
Re: Friday Facts #198 - Rail segment visualisation
Because you want the ItemStack class to be fixed size so they can be stored by value in inventories otherwise you have to use a pointer anyway.widders wrote:So I had an idea earlier and it solved some problem, I can remember the idea, but I can't remember the problem, anyway.
Why not integrate the item stack into the item class? An item after all is a stack of 1. Possibly it's too late in development to implement such a change but 99% of items in a game are non-dynamic so there's no need to track them (who cares which iron plate from the 5000 you've made gets used?) and the dynamic items I can't think of any which stack above 1. Things like ammo and science which have a usage bar get combined when you combine two stacks anyway so that should be simple to track as only the "top" item has a damage attribute associated with it.
Still can't remember what the problem that solved was but from what I can see you've got a memory object for each item in a stack plus the stack, this way would mean only one (if slightly larger) memory object per stack regardless of the number of items.
Possibly this could even combine with the belt optimizations as that one object stores how many items there are which in turn represents a length on the belt.
Currently the field to store all the items in it for inventories is something like
Code: Select all
std::vector<ItemStack> inventory;
Code: Select all
std::vector<std::shared_ptr<Item>> inventory; //or unique_ptr depending on surrounding code.
My suggestion of adding a union as a small value optimization will also help when the amount of state to keep is small:
Code: Select all
struct ItemStack
{
ItemCountType count;
ItemID id;
union{
float damage; // for progress bars like ammo, armor, damaged buildings, ...
Item* item; // dynamically allocated classed based on the item type
}
};
-
- Inserter
- Posts: 20
- Joined: Tue Jul 12, 2016 10:56 pm
- Contact:
Re: Friday Facts #198 - Rail segment visualisation
Oh good catch; except it is very hard to follow the train so you can watch the signalling on a large scale. Maybe add a button in the trains menu that you can toggle on/off ... so you can see reserved blocks for all trains simultaneously?mrvn wrote:No debug needed. just place the mouse over the train.
If you like TTDX, then try Simutrans (Regular+pak128 or Experimental+pakBritain). I gather that it has more complex signaling options and more complex passenger and freight.bobingabout wrote:If you hadn't said that was Simutrans, I would have thought it was OpenTTD with a graphics pack installed.
Re: Friday Facts #198 - Rail segment visualisation
Perhaps color the rail sprites instead of drawing a line on top of them. Drawing it with a shifted hue should suffice.
Re: Friday Facts #198 - Rail segment visualisation
Rails have multi-layer textures and the topmost one is a top rail bar surface. Maybe it is a good idea to use tint color on that one to visualize segment colors.
The only problem here is to visualize block margins if you will opt to use signal colors on rails (red,yellow,green) as I wrote above opposed to multicolor current debug style.
The only problem here is to visualize block margins if you will opt to use signal colors on rails (red,yellow,green) as I wrote above opposed to multicolor current debug style.
Re: Friday Facts #198 - Rail segment visualisation
The arrows that are already present can be added at the beginning and ending of each block, facing the direction(s) traffic needs to go, in a color that separates them from the other rail blocks.
You might also just align the debug whisker plot looking lines to the signals themselves, parallel to the rails, rather than on top of them, to so traffic blocks for each direction of traffic can go on either side.
You might also just align the debug whisker plot looking lines to the signals themselves, parallel to the rails, rather than on top of them, to so traffic blocks for each direction of traffic can go on either side.
-
- Fast Inserter
- Posts: 153
- Joined: Fri Jan 06, 2017 1:54 am
- Contact:
Re: Friday Facts #198 - Rail segment visualisation
You cat just use a continious frame around each block of rails instead of colors.
It can be only shown if a user hovers mouse over any signal. Also section used to activate red signal can be highlighted this way - see attachment (of course its not final design proposial )
It can be only shown if a user hovers mouse over any signal. Also section used to activate red signal can be highlighted this way - see attachment (of course its not final design proposial )
- Attachments
-
- Visualisation.png (813.33 KiB) Viewed 8734 times
-
- Inserter
- Posts: 22
- Joined: Fri Mar 17, 2017 11:27 pm
- Contact:
Re: Friday Facts #198 - Rail segment visualisation
I second that, that is quite efficient. Probably even better because Item probably uses a bunch of virtual methods to get that information, so that's probably two indirections saved (one for the object pointer, one for the vtable lookup) in the vast majority of cases.ratchetfreak wrote:Code: Select all
struct ItemStack { ItemCountType count; ItemID id; union{ float damage; // for progress bars like ammo, armor, damaged buildings, ... Item* item; // dynamically allocated classed based on the item type } };
-
- Burner Inserter
- Posts: 8
- Joined: Fri Jan 15, 2016 6:45 am
- Contact:
Re: Friday Facts #198 - Rail segment visualisation
So, I seem to be missing something, since I can't understand what the rail visualization is showing.
What rail tutorial is being discussed in the FFF? I just went and updated factorio from stable to experimental to try to find it, and I can't seem to do so. I've never understood rails in factorio, so I've always avoided doing anything interesting with them.
What rail tutorial is being discussed in the FFF? I just went and updated factorio from stable to experimental to try to find it, and I can't seem to do so. I've never understood rails in factorio, so I've always avoided doing anything interesting with them.
Re: Friday Facts #198 - Rail segment visualisation
Start or load a game, and click on the 'university hat' icon in the top right corner, it's part of a row of six buttonsesotericist wrote:So, I seem to be missing something, since I can't understand what the rail visualization is showing.
What rail tutorial is being discussed in the FFF? I just went and updated factorio from stable to experimental to try to find it, and I can't seem to do so. I've never understood rails in factorio, so I've always avoided doing anything interesting with them.
Re: Friday Facts #198 - Rail segment visualisation
Definitely, this looks awesome!IronCartographer wrote:Here's an idea: "Less is more" AKA "What do current signals/rail see, and why?"
-
- Burner Inserter
- Posts: 12
- Joined: Thu Jul 06, 2017 9:48 pm
- Contact:
Re: Friday Facts #198 - Rail segment visualisation
Will color indicators be sufficient to describe all the information? I have never quite understand how rails work in this game, and I don't know if visualization helps in any way. I'd assume it helps if you have some understanding to the underlying system.
Re: Friday Facts #198 - Rail segment visualisation
It`s a good idea but I´m more interested in the new HD Landscape. ( For me the landscape is the biggest problem in this game) It`s not nice at all. It`s only a big plane surface. No hills, no space problem etc etc
Re: Friday Facts #198 - Rail segment visualisation
I've been thinking about this for a bit and maybe this Is one of those places for Alt-mode to be a factor but I've also got a few other thoughts
First off Combine the positions of cars and the arrow directions, there's no need for both the yellow arrows and multiple train cars to both be shown why not make the front train car a triangle indicating an engine and direction rather than just another space
Make Rail signals part of the track rather than snapping to the sides, I'm kind of thinking of this the same way red and green wires become part of chests and poles and inserters and belts when they're used, they have no independent use to them by making them a part of the track there's no ambiguity about where they can be placed and no need for the snap grid, with the line and bar method of displaying blocks new signals can only be placed on lines not between bars (excluding making a signal bidirectional)
Someone did mention the four colorability of planar graphs (basically what an all above ground train network would be) in this thread and working this out could be it's own thread independent of the normal tick process as it's not crucial to play so those colours could be worked out in the background while a player isn't working on parts of the rail network. While the player is working however, this colouring could be preserved for any unaltered blocks with new blocks getting their colours assigned from a predefined list that as best as possible are distinct and are hopefully only being used once on the map at a time, this lets the player see what they're working on and what is unaffected. It would also be a superficial way of saying the section of track is now integrated with the wider train network because when the user isn't looking the work in progress colours could all be removed and the standard 4 colours of the train network reshuffled to work, I say superficially because it was always part of the network as far as the trains are concerned but the colours homogenising would I think be satisfying. If the colours chosen for the 4 colour mode are say red, green, blue and black you also end up leaving white available as a highlight colour for blocks you're directly working with, the block ahead of the signal you're adding or removing getting a white line and bar while the the block behind being filled up with the train symbol which is already in white.
Finally the alt mode could let people see this more detailed view or the classic view (and they could choose which is which with options)
Yes I'll work on a few pictures to show what I mean but I'm not at the right computer for such things right now
First off Combine the positions of cars and the arrow directions, there's no need for both the yellow arrows and multiple train cars to both be shown why not make the front train car a triangle indicating an engine and direction rather than just another space
Make Rail signals part of the track rather than snapping to the sides, I'm kind of thinking of this the same way red and green wires become part of chests and poles and inserters and belts when they're used, they have no independent use to them by making them a part of the track there's no ambiguity about where they can be placed and no need for the snap grid, with the line and bar method of displaying blocks new signals can only be placed on lines not between bars (excluding making a signal bidirectional)
Someone did mention the four colorability of planar graphs (basically what an all above ground train network would be) in this thread and working this out could be it's own thread independent of the normal tick process as it's not crucial to play so those colours could be worked out in the background while a player isn't working on parts of the rail network. While the player is working however, this colouring could be preserved for any unaltered blocks with new blocks getting their colours assigned from a predefined list that as best as possible are distinct and are hopefully only being used once on the map at a time, this lets the player see what they're working on and what is unaffected. It would also be a superficial way of saying the section of track is now integrated with the wider train network because when the user isn't looking the work in progress colours could all be removed and the standard 4 colours of the train network reshuffled to work, I say superficially because it was always part of the network as far as the trains are concerned but the colours homogenising would I think be satisfying. If the colours chosen for the 4 colour mode are say red, green, blue and black you also end up leaving white available as a highlight colour for blocks you're directly working with, the block ahead of the signal you're adding or removing getting a white line and bar while the the block behind being filled up with the train symbol which is already in white.
Finally the alt mode could let people see this more detailed view or the classic view (and they could choose which is which with options)
Yes I'll work on a few pictures to show what I mean but I'm not at the right computer for such things right now
My Mod ideas - https://forums.factorio.com/forum/vie ... 49#p107558