make more entity prototypes support rotation

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
war877
Burner Inserter
Burner Inserter
Posts: 7
Joined: Wed Jul 19, 2017 3:47 am
Contact:

make more entity prototypes support rotation

Post by war877 »

TL;DR
Allow storage containers and lamps and power poles to be rotated.
What ?
These types should be non-rotatable by default, but would enhance modding flexibility if they could be rotated.
Why ?
I currently have need of rotating non-square storage containers and lamps. Getting such objects to rotate without rotation is complicated and probably bad for UPS. EDIT: power poles as well.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: make more entity prototypes support rotation

Post by ssilk »

This makes no sense.

- not possible to make rectangular light sources, and I also don’t see a reason why, just add more lights together.
- there are already mods, which use rectangular containers, and that mods seem to have no problems to rotate
- power poles have pseudo-rotation (rotate into position after placing)
- I generally don’t understand why something needs to be rotated, when it looks equally from all directions :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Koub
Global Moderator
Global Moderator
Posts: 7938
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: make more entity prototypes support rotation

Post by Koub »

ssilk wrote: Wed Nov 17, 2021 6:04 am This makes no sense.

- not possible to make rectangular light sources, and I also don’t see a reason why, just add more lights together.
- there are already mods, which use rectangular containers, and that mods seem to have no problems to rotate
- power poles have pseudo-rotation (rotate into position after placing)
- I generally don’t understand why something needs to be rotated, when it looks equally from all directions :)
I don't agree with you Ssilk. I can't speak on the moddability of what can be rotated or not, and can't say if this would be doable or not code wise, but it totally makes sense for a modder to want to be able to mod rotatable lights or containers in for custom non square lights/containers.
One can argue that constant combinators don't "need" to be rotated, yet they can be out of the box.
Whatever placeable entity should be allowed to be rotatable, if the modder designs it so.
Koub - Please consider English is not my native language.
mrvn
Smart Inserter
Smart Inserter
Posts: 5969
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: make more entity prototypes support rotation

Post by mrvn »

ssilk wrote: Wed Nov 17, 2021 6:04 am - I generally don’t understand why something needs to be rotated, when it looks equally from all directions :)
Do power poles, lights, chests need to look equal from all directions? Do the circuit connection need to be in the same spot all the time?

Rectangular objects certainly don't look the same horizontal and vertical.

Please add the power switch to that list. Why can't I rotate that one? It clearly would look different when rotated.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: make more entity prototypes support rotation

Post by ssilk »

Koub wrote: Wed Nov 17, 2021 12:11 pm One can argue that constant combinators don't "need" to be rotated,
? But constant combinator can be rotated?
Whatever placeable entity should be allowed to be rotatable, if the modder designs it so.
I'm not longer in modding, so I dunno/not 100% sure: as far as I remember there is no reason, that any entity cannot be rotated. It just needs grafics and some configuration, but it might work out of the box.
Someone may correct me if I'm wrong, please. 8-)
mrvn wrote: Wed Nov 17, 2021 4:36 pm
ssilk wrote: Wed Nov 17, 2021 6:04 am - I generally don’t understand why something needs to be rotated, when it looks equally from all directions :)
Do power poles, lights, chests need to look equal from all directions? Do the circuit connection need to be in the same spot all the time?
Not the point here. If the entity has no grafics for rotation, the game cannot invent one. :) If a modder rotates an entity, that has only one graphics, it might not work. ;) Sounds stupid, but eventually part of the problem.
Please add the power switch to that list. Why can't I rotate that one? It clearly would look different when rotated.
Ah, yes, good point, now this suggestion becomes more flesh. Could it be, that a combinators are only rotatable in two directions.

But I fear we need more expert knowledge to discuss this, because as said above I think this is partly working. Or may be totally wrong.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Koub
Global Moderator
Global Moderator
Posts: 7938
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: make more entity prototypes support rotation

Post by Koub »

ssilk wrote: Wed Nov 17, 2021 10:58 pm ? But constant combinator can be rotated?
2021-11-18 00_03_26-Factorio 1.1.46.jpg
2021-11-18 00_03_26-Factorio 1.1.46.jpg (39.11 KiB) Viewed 4926 times
Koub - Please consider English is not my native language.
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: make more entity prototypes support rotation

Post by ssilk »

Hm. I should look better before I post. :roll:
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2768
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: make more entity prototypes support rotation

Post by FuryoftheStars »

ssilk wrote: Wed Nov 17, 2021 10:58 pmIf the entity has no grafics for rotation, the game cannot invent one. :) If a modder rotates an entity, that has only one graphics, it might not work. ;) Sounds stupid, but eventually part of the problem.
From what little I'm able to figure out looking through the entities file, I believe this is exactly it. Rotatability does seem to appear to depend on the graphics being created for it. I don't see anything for a general "can rotate" true/false flag anywhere.
My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
Bilka
Factorio Staff
Factorio Staff
Posts: 3310
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: make more entity prototypes support rotation

Post by Bilka »

Whether an entity can be rotated (sometimes conditionally, e.g. turrets or crafting machines) depends on the entity type. Neither containers, power switches or lamps can be rotated.

Moved to modding interface requests.
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
Lubricus
Filter Inserter
Filter Inserter
Posts: 298
Joined: Sun Jun 04, 2017 12:13 pm
Contact:

Rotatable chests

Post by Lubricus »

It would be nice to have moded rectangular chests and still be able to rotate blueprints 90 degrees.
It's a request to make mods work better without being an API request. Vanilla chests is quadrates so they don't need to be rotated but moded ones may need it. In particular I am planning to use the merge chest mod to save UPS in my Py factory but then I either have to make an vertical and horizontal version of all stations or merge the chests after the BP is built. It's also makes it harder to duplicate existing builds when needed.
FuryoftheStars
Smart Inserter
Smart Inserter
Posts: 2768
Joined: Tue Apr 25, 2017 2:01 pm
Contact:

Re: Rotatable chests

Post by FuryoftheStars »

My Mods: Classic Factorio Basic Oil Processing | Sulfur Production from Oils | Wood to Oil Processing | Infinite Resources - Normal Yield | Tree Saplings (Redux) | Alien Biomes Tweaked | Restrictions on Artificial Tiles | New Gear Girl & HR Graphics
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: make more entity prototypes support rotation

Post by ssilk »

merged with existing thread

Thanks to Fury, search would take me much longer without this hint to this board.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
Rseding91
Factorio Staff
Factorio Staff
Posts: 14673
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: make more entity prototypes support rotation

Post by Rseding91 »

Largely the issues with making something rotatable that the base game never needs to be rotated are:

A) the entity code has to support it in a path base-game never runs (error prone)
B) the entity needs to use more RAM to store the direction for every entity even when not used by the base game
C) the save file has to save/load the direction even when it isn't being used by base game

B and C are the main factors why things don't support direction. A can largely be addressed with tests but still isn't ideal.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Lubricus
Filter Inserter
Filter Inserter
Posts: 298
Joined: Sun Jun 04, 2017 12:13 pm
Contact:

Re: make more entity prototypes support rotation

Post by Lubricus »

Rseding91 wrote: Sat Dec 18, 2021 3:52 pm Largely the issues with making something rotatable that the base game never needs to be rotated are:

A) the entity code has to support it in a path base-game never runs (error prone)
B) the entity needs to use more RAM to store the direction for every entity even when not used by the base game
C) the save file has to save/load the direction even when it isn't being used by base game

B and C are the main factors why things don't support direction. A can largely be addressed with tests but still isn't ideal.
Is it possible to use Composition design pattern or something to make it possible to mix and match properties for entities more? Or will it be to messy and inefficient?
Atria
Long Handed Inserter
Long Handed Inserter
Posts: 65
Joined: Sat Jul 09, 2016 10:25 am
Contact:

Re: make more entity prototypes support rotation

Post by Atria »

What about adding support for rotations of not rotatable entities by adding new field to entity prototype? This field would contain name of other entity (of same type) which is mean to be a 90° rotated version of the first entity. Making four entity prototypes chained like this would simulate rotating without modifying runtime instance of the entity.
mrvn
Smart Inserter
Smart Inserter
Posts: 5969
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: make more entity prototypes support rotation

Post by mrvn »

As for C: While waiting for the game to (auto)save is boring is that really something we should feature shorten the game for so it's 0.00001% faster?

Why do entities even have rotating and non-rotating types? Or if they must why isn't that using dependency injection?

The entity class should get the rotating or non-rotating support injected into the base type. That way when loading prototypes the entity factory can create a rotating or non-rotating entity for anything depending on the data instead on hardcoding which type is rotating and which is not. Same deal with animated or non animated entity. That would take care of case A too since every entity would be using the same code and with rotating and non-rotating entities in vanilla both sides get tested. A bit harder to save and load when updating versions (when changing between rotating and not, bit of a migration issue).

Or you know, just put those 2 (3 for rails or underground belts) bits of information into some left over bits in something else that doesn't need the full width of it's data type. For non-rotating entities those bits are just ignored. I can't believe there isn't some values you can clip off 3 bits. Like health for example. Do we need 65535 max health? Or is it 2/4 billion?
Rseding91
Factorio Staff
Factorio Staff
Posts: 14673
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: make more entity prototypes support rotation

Post by Rseding91 »

You're welcome to make your own game with a similar feature set to Factorio and implement it in a way you see fit.
If you want to get ahold of me I'm almost always on Discord.
mrvn
Smart Inserter
Smart Inserter
Posts: 5969
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: make more entity prototypes support rotation

Post by mrvn »

Rseding91 wrote: Mon Apr 08, 2024 8:16 pm You're welcome to make your own game with a similar feature set to Factorio and implement it in a way you see fit.
Sorry if I come across snarky. You're doing a great game. I'm just sometimes amazed at some of the problems when they are well known programming issues with established solutions. It triggers the "I've learned about how not do this and that sounds exactly how this was done" syndrom.
Qon
Smart Inserter
Smart Inserter
Posts: 2164
Joined: Thu Mar 17, 2016 6:27 am
Contact:

Re: make more entity prototypes support rotation

Post by Qon »

mrvn wrote: Fri Apr 12, 2024 10:29 pm I'm just sometimes amazed at some of the problems when they are well known programming issues with established solutions. It triggers the "I've learned about how not do this and that sounds exactly how this was done" syndrom.
Well, do you think Rseding91 doesn't know or considered and rejected the things you suggested, when it was first designed? Or maybe he and the team had different goals with the system and more insight into how the tradeoffs would affect the product, which means that they saw that your solution brought more issues than beneits?

"Established solution" works great for standard cookie cutter games, which Factorio is not. Inflexibility is a strength when it leads to reliable and performant systems that handle large amounts of data. And Factorio has become amazing because it is taking advantage of these strengths. Other games would have a series of levels for designing and running each system by itself.

Also, it's a bit weird to suggest completely restructuring the entity system architecture for a mod that can probably already be made with some workarounds if you try a little bit more, when it would give massive amounts of work to Wube and worsen their vanilla product.
My mods: Capsule Ammo | HandyHands - Automatic handcrafting | ChunkyChunks - Configurable Gridlines
Some other creations: Combinassembly Language GitHub w instructions and link to run it in your browser | 0~drain Laser
curiosity
Filter Inserter
Filter Inserter
Posts: 521
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: make more entity prototypes support rotation

Post by curiosity »

mrvn wrote: Fri Apr 12, 2024 10:29 pm Sorry if I come across snarky. You're doing a great game. I'm just sometimes amazed at some of the problems when they are well known programming issues with established solutions. It triggers the "I've learned about how not do this and that sounds exactly how this was done" syndrom.
The devs have different priorities when it comes to Factorio and they won't budge. Rseding enumerated the relevant ones above. You have to argue in the context of those priorities if you want to convince them. For example (no-effort suggestion), make a rotatable variant of each prototype type.
Post Reply

Return to “Modding interface requests”