Trolleys a.k.a. tiny trains

This is the place to request new mods or give ideas about what could be done.
Post Reply
voddan
Fast Inserter
Fast Inserter
Posts: 124
Joined: Sat Jun 03, 2017 9:22 pm
Contact:

Trolleys a.k.a. tiny trains

Post by voddan »

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

User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2903
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: Trolleys a.k.a. tiny trains

Post by darkfrei »

voddan 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?
1 - no
2 - no
3 - how it mus works exactly?

See Running box: viewtopic.php?f=97&t=43293
Image

voddan
Fast Inserter
Fast Inserter
Posts: 124
Joined: Sat Jun 03, 2017 9:22 pm
Contact:

Re: Trolleys a.k.a. tiny trains

Post by voddan »

darkfrei wrote: 1 - no
2 - no
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 them

PS Thanks for the link BTW

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 7352
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Trolleys a.k.a. tiny trains

Post by bobingabout »

voddan wrote:
darkfrei wrote: 1 - no
2 - no
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 them

PS Thanks for the link BTW
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.

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.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.
I also have a Patreon.

voddan
Fast Inserter
Fast Inserter
Posts: 124
Joined: Sat Jun 03, 2017 9:22 pm
Contact:

Re: Trolleys a.k.a. tiny trains

Post by voddan »

bobingabout 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.
Please point me where I can read those rules and restrictions

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Trolleys a.k.a. tiny trains

Post by eradicator »

voddan wrote:
bobingabout 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.
Please point me where I can read those rules and restrictions
Put this into your data.lua and read the error message the game throws at you on startup.

Code: Select all

data:extend(
{
  {
    type = "rail-category",
    name = "fancy-new-rail"
  }
}
)
Aka. The data stage is not (edit: officially) 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?).
Last edited by eradicator on Wed May 02, 2018 8:26 am, edited 1 time in total.

voddan
Fast Inserter
Fast Inserter
Posts: 124
Joined: Sat Jun 03, 2017 9:22 pm
Contact:

Re: Trolleys a.k.a. tiny trains

Post by voddan »

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?).
Thanks, eradicator! Now it makes a bit more sense.

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.

Bilka
Factorio Staff
Factorio Staff
Posts: 3128
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Trolleys a.k.a. tiny trains

Post by Bilka »

eradicator wrote:The data stage is not documented.
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.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Trolleys a.k.a. tiny trains

Post by Deadlock989 »

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 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.

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.
Image

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Trolleys a.k.a. tiny trains

Post by eradicator »

Bilka wrote:
eradicator wrote:The data stage is not documented.
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.
I edited it to "officially docomented" :p.

@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.

voddan
Fast Inserter
Fast Inserter
Posts: 124
Joined: Sat Jun 03, 2017 9:22 pm
Contact:

Re: Trolleys a.k.a. tiny trains

Post by voddan »

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.
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.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Trolleys a.k.a. tiny trains

Post by Deadlock989 »

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.
Image

betrok
Fast Inserter
Fast Inserter
Posts: 101
Joined: Wed Feb 28, 2018 12:08 pm
Contact:

Re: Trolleys a.k.a. tiny trains

Post by betrok »

Deadlock989 wrote:No, not "pretty difficult" - literally impossible.
Well, not impossible. But it requires to implement everything on the lua side -> large codebase and poor performance.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Trolleys a.k.a. tiny trains

Post by Deadlock989 »

betrok wrote:Well, not impossible. But it requires to implement everything on the lua side -> large codebase and poor performance.
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*

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.
Image

voddan
Fast Inserter
Fast Inserter
Posts: 124
Joined: Sat Jun 03, 2017 9:22 pm
Contact:

Re: Trolleys a.k.a. tiny trains

Post by voddan »

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.
Because there is a problem, and admitting that is the first step.

User avatar
Deadlock989
Smart Inserter
Smart Inserter
Posts: 2528
Joined: Fri Nov 06, 2015 7:41 pm

Re: Trolleys a.k.a. tiny trains

Post by Deadlock989 »

voddan wrote:Because there is a problem, and admitting that is the first step.
Likesay - funny.
Image

User avatar
steinio
Smart Inserter
Smart Inserter
Posts: 2633
Joined: Sat Mar 12, 2016 4:19 pm
Contact:

Re: Trolleys a.k.a. tiny trains

Post by steinio »

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.
Image

Transport Belt Repair Man

View unread Posts

mrvn
Smart Inserter
Smart Inserter
Posts: 5703
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Trolleys a.k.a. tiny trains

Post by mrvn »

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.

Post Reply

Return to “Ideas and Requests For Mods”