Trolleys a.k.a. tiny trains
Trolleys a.k.a. tiny trains
Hi!
I would like to program a trolley mode, but I am kinda lost in the API documentation.
The mode would need
1) a new type of rails (smaller, without the curves, kinda like belts)
2) a new type of train for these rails (incompatible with normal trains, but still uses their pathing algorithm)
3) make the trolleys work with provider chests kinda like robots
Any suggestions where I should start? What classes do I need to hook up to?
P.S. I have extensive experience in enterprise systems with Java and C++, but game dev is totally new to me. You can assume I know I know Lua (it like ruby, isn't it), but the whole concept of copying classes and modifying them is new to me. Also the lack of IDE doesn't help
I would like to program a trolley mode, but I am kinda lost in the API documentation.
The mode would need
1) a new type of rails (smaller, without the curves, kinda like belts)
2) a new type of train for these rails (incompatible with normal trains, but still uses their pathing algorithm)
3) make the trolleys work with provider chests kinda like robots
Any suggestions where I should start? What classes do I need to hook up to?
P.S. I have extensive experience in enterprise systems with Java and C++, but game dev is totally new to me. You can assume I know I know Lua (it like ruby, isn't it), but the whole concept of copying classes and modifying them is new to me. Also the lack of IDE doesn't help
Re: Trolleys a.k.a. tiny trains
1 - novoddan wrote: 1) a new type of rails (smaller, without the curves, kinda like belts)
2) a new type of train for these rails (incompatible with normal trains, but still uses their pathing algorithm)
3) make the trolleys work with provider chests kinda like robots
Any suggestions where I should start? What classes do I need to hook up to?
2 - no
3 - how it mus works exactly?
See Running box: viewtopic.php?f=97&t=43293
Re: Trolleys a.k.a. tiny trains
What you mean? I know for a fact it is possible to create new item types in the game and hook up standard algorithms (like path finder) to themdarkfrei wrote: 1 - no
2 - no
PS Thanks for the link BTW
- bobingabout
- Smart Inserter
- Posts: 7352
- Joined: Fri May 09, 2014 1:01 pm
- Contact:
Re: Trolleys a.k.a. tiny trains
you are not allowed to create new types of railway track. Also even when you were, track's have a 2x2 grid that must be used.voddan wrote:What you mean? I know for a fact it is possible to create new item types in the game and hook up standard algorithms (like path finder) to themdarkfrei wrote: 1 - no
2 - no
PS Thanks for the link BTW
Yes you can make new types of items, but there are a lot of rules you have to follow when doing so, some of the most strict rules are applied to railway things.
Re: Trolleys a.k.a. tiny trains
Please point me where I can read those rules and restrictionsbobingabout wrote: Yes you can make new types of items, but there are a lot of rules you have to follow when doing so, some of the most strict rules are applied to railway things.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Trolleys a.k.a. tiny trains
Put this into your data.lua and read the error message the game throws at you on startup.voddan wrote:Please point me where I can read those rules and restrictionsbobingabout wrote: Yes you can make new types of items, but there are a lot of rules you have to follow when doing so, some of the most strict rules are applied to railway things.
Code: Select all
data:extend(
{
{
type = "rail-category",
name = "fancy-new-rail"
}
}
)
Last edited by eradicator on Wed May 02, 2018 8:26 am, edited 1 time in total.
Re: Trolleys a.k.a. tiny trains
Thanks, eradicator! Now it makes a bit more sense.eradicator wrote:Aka. The data stage is not documented. You can not look this up. Unless ofc you want to read all past changelogs, it's probably in there somewhere (i think the ability to create new rail-categories was removed in 15?).
Ok, so it I can't have custom rails, can I have something rail-like to mark where my trolleys can go? My guess is that it could be a custom type of bels with changed graphics. How would I go doing that?
Also any suggestion on how to use the path-finder algorithm without rails? Maybe fake rails without a hit-box and graphics? But that is not critical for a POC.
Re: Trolleys a.k.a. tiny trains
Hey man, dont call it not documented when we have https://wiki.factorio.com/Prototype_definitions. It obviously needs a lot of work, but it is still better than nothing.eradicator wrote:The data stage is not documented.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Trolleys a.k.a. tiny trains
You can change belt graphics but they are still belts. You can't change belt logic. They'll still have two lanes, still display queues of item entities etc.voddan wrote:Ok, so it I can't have custom rails, can I have something rail-like to mark where my trolleys can go? My guess is that it could be a custom type of bels with changed graphics. How would I go doing that?
Also any suggestion on how to use the path-finder algorithm without rails? Maybe fake rails without a hit-box and graphics? But that is not critical for a POC.
You can't use rail logic without rails.
If you are new to modding, I would recommend starting off with something less ambitious until you have a better feel for what is possible and what isn't. Factorio just doesn't provide the low-level engine access your ideas require. You can do unusual things with runtime on-tick scripting but if you're moving hundreds of entities about with that, it will kill performance stone dead.
- eradicator
- Smart Inserter
- Posts: 5206
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Trolleys a.k.a. tiny trains
I edited it to "officially docomented" :p.Bilka wrote:Hey man, dont call it not documented when we have https://wiki.factorio.com/Prototype_definitions. It obviously needs a lot of work, but it is still better than nothing.eradicator wrote:The data stage is not documented.
@OP: Like Deadlock already said, you can't repurpose any prototypes in the game. Everything always comes with the built in logic (rails are rails, assemblers are assemblers, inserters are inserters, etc) regardless of if they're invisible or not. Many people have had the idea to implement "something like trains but slightly different", i think the most popular (?) one was the overhead cable-car gondola style "medium range" transport idea? Or "something with cars with waypoints". But i'm not aware of any actual implementations.
Re: Trolleys a.k.a. tiny trains
All I want is a POC. I have this idea of solving the belt-vs-bots disbalance by providing a mean of transport for automatically carrying random items inside the base, aka "trolley". In its simplest form it requires marked paths (aka rails) to avoid path finding and small custom vehicles the size of a chest. The idea of trolleys is not new, but for some reason the developers have been ignoring it for a few year, judging by the old forum threads. To sum it up, ether I make a POC (which turned out pretty difficult), or someone here gets interested, or the Factorio devs do a POC (using the low level that is hidden from us), or it will never be done at all, which is a shame. I am prepared to describe the idea in details and explain why it will work and all other ideas woun't, but in the end of the day we'll need a POC to see how it really works.Deadlock989 wrote:If you are new to modding, I would recommend starting off with something less ambitious until you have a better feel for what is possible and what isn't. Factorio just doesn't provide the low-level engine access your ideas require. You can do unusual things with runtime on-tick scripting but if you're moving hundreds of entities about with that, it will kill performance stone dead.
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Trolleys a.k.a. tiny trains
No, not "pretty difficult" - literally impossible.
You're not just trying to run before you can walk, but trying to run in an imaginary direction.
Furthermore, the chances of them adding an entirely new logistic tranport method to the game at this very late stage of development are as close to zero as makes no odds.
You're not just trying to run before you can walk, but trying to run in an imaginary direction.
Furthermore, the chances of them adding an entirely new logistic tranport method to the game at this very late stage of development are as close to zero as makes no odds.
Re: Trolleys a.k.a. tiny trains
Well, not impossible. But it requires to implement everything on the lua side -> large codebase and poor performance.Deadlock989 wrote:No, not "pretty difficult" - literally impossible.
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Trolleys a.k.a. tiny trains
OK, I retract "impossible" and offer "cripplingly filled with total suck" instead. Getting the tiny trains to rotate on corners, to follow paths, to run any kind of pathfinding, to interact with invisible containers and parse through inventories ... all in Lua, in on-tick events ... *shudder*betrok wrote:Well, not impossible. But it requires to implement everything on the lua side -> large codebase and poor performance.
Might as well write your own turn-based factory game using ASCII art.
It's funny how people imagine there's a "problem" with bots and belts and trains, and keep suggesting the same kind of "solutions", that we make trains more like bots that run on belts.
Re: Trolleys a.k.a. tiny trains
Because there is a problem, and admitting that is the first step.Deadlock989 wrote:It's funny how people imagine there's a "problem" with bots and belts and trains, and keep suggesting the same kind of "solutions", that we make trains more like bots that run on belts.
- Deadlock989
- Smart Inserter
- Posts: 2528
- Joined: Fri Nov 06, 2015 7:41 pm
Re: Trolleys a.k.a. tiny trains
Likesay - funny.voddan wrote:Because there is a problem, and admitting that is the first step.
Re: Trolleys a.k.a. tiny trains
You can create new rail and train sprites like the cargo ship mod.
They will be usable unfortunately for all trains but that's more a problem at layer 8.
They will be usable unfortunately for all trains but that's more a problem at layer 8.
Re: Trolleys a.k.a. tiny trains
You could make every other item twice the size and add a 2x2 grid restriction to them. The zoom a bit out and you have everything on a 1x1 grid.
And hey, now you can (must) make belts with 4 lanes.
And hey, now you can (must) make belts with 4 lanes.