[Mod] Boost cart [boost_cart]

User avatar
Krock
Developer
Posts: 4510
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Boost cart [boost_cart]

by Krock » Post

goldcrest42 wrote:Is there a list on the wiki anywhere which clarifies what keys the control bits refer to?
https://github.com/minetest/minetest/bl ... #L157-L393
Specifically: https://github.com/minetest/minetest/bl ... s.txt#L181

Open the advanced setting dialogue in the main menu and change "keymap_sneak" to "KEY_SHIFT". Or wait for version 5.0 where the fix will most likely be included.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

goldcrest42
Member
Posts: 10
Joined: Sat Sep 29, 2018 17:46
GitHub: claretty

Re: [Mod] Boost cart [boost_cart]

by goldcrest42 » Post

A (somewhat belated) thanks for that, Krock. I will wait for 5.0.

I also realised, a bit after I posted, what LMB and RMB were.. I'm slow!
Beware of programmers with soldering irons!

User avatar
v-rob
Member
Posts: 738
Joined: Thu Mar 24, 2016 03:19
GitHub: v-rob
Location: Right behind you.

Re: [Mod] Boost cart [boost_cart]

by v-rob » Post

So, since the pull request for get_rotation and set_rotation was merged, will you use this to change the cart's pitch when 5.0 comes out? As it is, only the cart models made for boost cart work properly. Any other model won't rotate when moving up hills.

//////////////////////////////////////////////////

Anyway, about hitching carts (yes, I know I'm persistent :-P): You were talking about a video hidden on Youtube for hitching carts. I found two possible candidates of what you might be talking about.

The first one is of the last rendition of the trains mod by jordan4ibanez, which, although glitchy, did include basic cart hitching. Here are three links:
The video itself: https://www.youtube.com/watch?v=rBvKqzT ... e=youtu.be
The forum topic: viewtopic.php?f=9&t=11027&hilit=my+train+mod
The source code: https://github.com/jordan4ibanez/trains

This mod seems to hitch things by defining a leader cart and making all carts in the lineup follow that leading cart by setting their velocity to it.

The other video is here: https://vimeo.com/156622682. I found this one in the railnet mod topic by the author. This has no accompanying code, so I can only guess as to how it worked. The hitcher seems to move the cart forward until it hits another cart, whereupon it hitches.

So, from these, I think that the best way to proceed (and this is just an idea) is to make some sort of cart hitcher craftitem/tool that hitches two carts together if the carts are right next to each other. These would be stored in an attachment table that would probably look something like this:

Code: Select all

attachments = {
    front = cart_id_here or "",
    back = another_cart_id or "",
    leader = true/false
}
The cart id's would be an id given to each boost cart randomly, such as a large number, or something extremely hacky, like tostring(self) (That would be one of the most hacky solutions ever ;-)) The leader would be the cart in the front of the train and would only change if a cart is hitched in front of the leader.

From here, all changes to the leader would make changes to the rest of the train. Only the leader would be affected by punches, speed changes, start/stop/brake/mese rails.

If a rail is broken or a cart was removed from the center of the train, breaking the chain, one of three things could happen (I'm not sure which is best): The carts one the side without the leader should either automatically be assigned a new leader, keep their attachments but not get a new leader and a new leader would have to be assigned by hitching another cart, or lose all their attachments and become a bunch of normal, unattached carts. The carts on the side of the broken chain with the leader should keep moving like normal.

//////////////////////////////////////////////////

Anyway, this is just a concept, and may be nothing like your ideas, if you have any at all. If you ever feel like making actual hitching, I'd be willing to help in whatever way I could since I know how hard it is to program a large thing like this alone. (I do hope you decide to do it soon, because it's unbelievably fun to ride a line of carts around, even if it is a laggy, buggy mod from 2015).

User avatar
Krock
Developer
Posts: 4510
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Boost cart [boost_cart]

by Krock » Post

I am well aware of the new rotation feature in Minetest 5.0.0-dev but I'd like to make use of this feature as soon the remaining bugs are solved. Afterwards I'd love to add an API to register carts - maybe one mod will extend boost_cart with an oversized train model ;) - I wouldn't worry much about the motion jerkyness. For psudo-diagonal rails it would be possible to tweak the yaw interpolation a bit.

Hitching carts sound great, look nice but for performance reasons and the attachment system which currently sucks, I'm not keen on implementing this feature anytime soon. That would be up to extension mods - where I hope that I can provide API functions they need for it.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Miniontoby
Member
Posts: 375
Joined: Fri Mar 01, 2019 19:25
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

Re: [Mod] Boost cart [boost_cart]

by Miniontoby » Post

Can you do that rails that is placed not connect with the other rails that be near the rails .

I mean that you can set on witch direction the rails should connect
My English isn't very good because I'm Dutch ---- Check my mod "Doorbell"

User avatar
Krock
Developer
Posts: 4510
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Boost cart [boost_cart]

by Krock » Post

Miniontoby wrote:I mean that you can set on witch direction the rails should connect
The rail connections are calculated by Minetest, thus I cannot change anything there. Although it's possible to register multiple kinds of rails, like so:

Code: Select all

boost_cart:register_rail("boost_cart:rail2", {
	description = "Rail 2",
	tiles = {
		"carts_rail_straight.png", "carts_rail_curved.png",
		"carts_rail_t_junction.png", "carts_rail_crossing.png"
	},
	groups = boost_cart:get_rail_groups({ rail = 2 })
})
This will allow you to place two different kinds of rails next to each other without having a connection. But there's yet no way to switch from one rail type to another while driving.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
Miniontoby
Member
Posts: 375
Joined: Fri Mar 01, 2019 19:25
IRC: Miniontoby
In-game: Miniontoby
Location: The Netherlands

Re: [Mod] Boost cart [boost_cart]

by Miniontoby » Post

Does this now works? viewtopic.php?p=172788#p172788
My English isn't very good because I'm Dutch ---- Check my mod "Doorbell"

User avatar
Krock
Developer
Posts: 4510
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Boost cart [boost_cart]

by Krock » Post

Miniontoby wrote:Does this now works? viewtopic.php?p=172788#p172788
Sorry? That's a showcase of the mod's capabilities. The only thing you need is a simple mod to register more rails.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

ThorfinnS
Member
Posts: 233
Joined: Mon Feb 25, 2019 22:05
GitHub: ThorfinnS

Re: [Mod] Boost cart [boost_cart]

by ThorfinnS » Post

Must not have been an issue before 5.1, but now I'm getting a fatal loading moreores and boost_cart.

Code: Select all

2019-10-17 15:56:31: ERROR[Main]: ModError: Failed to load and run script from C:\games\mt\latest\bin\..\mods\boost_cart\init.lua:
2019-10-17 15:56:31: ERROR[Main]: C:\games\mt\latest\bin\..\mods\boost_cart/rails.lua:24: attempt to index field 'moreores:copper_rail' (a nil value)
2019-10-17 15:56:31: ERROR[Main]: stack traceback:
2019-10-17 15:56:31: ERROR[Main]: 	C:\games\mt\latest\bin\..\mods\boost_cart/rails.lua:24: in main chunk
2019-10-17 15:56:31: ERROR[Main]: 	[C]: in function 'dofile'
2019-10-17 15:56:31: ERROR[Main]: 	C:\games\mt\latest\bin\..\mods\boost_cart\init.lua:33: in main chunk
2019-10-17 15:56:31: ERROR[Main]: Check debug.txt for details.
2019-10-17 15:56:31: ACTION[Main]: Server: Shutting down
For what it's worth, the gits we're using are:

Code: Select all

https://github.com/SmallJoker/boost_cart.git
https://notabug.org/TenPlus1/moreores.git
Or is it that the migration of copper to mtg is not complete?

User avatar
Krock
Developer
Posts: 4510
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Boost cart [boost_cart]

by Krock » Post

The official moreores repository can be found here: https://github.com/minetest-mods/moreores
However, the following commit broke boost_cart: https://github.com/minetest-mods/moreor ... t/d0a1798b

Bug fixed in https://github.com/SmallJoker/boost_car ... t/ae33bd7a.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

ejmarkow
New member
Posts: 1
Joined: Sun Dec 01, 2019 10:57
IRC: Markow

Re: [Mod] Boost cart [boost_cart]

by ejmarkow » Post

I'm using this mod with Minetest version Minetest 5.2.0-dev-4b6bff4 (Linux). Everything is working well except sound.

Sound for the cart while moving is not working. Without this mod, having the Carts mod only, sound works.

I tested out the ogg files in the sounds directory of the Boost Cart mod on VLC. Nothing, no sound. Sound files for the Carts mod work on VLC.

User avatar
Krock
Developer
Posts: 4510
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Boost cart [boost_cart]

by Krock » Post

ejmarkow wrote:I tested out the ogg files in the sounds directory of the Boost Cart mod on VLC. Nothing, no sound. Sound files for the Carts mod work on VLC.
I don't know what's going on there. Both sounds have the same codec - only difference could probably be the sample resolution. For comparison:
Image

Please note that boost_cart only plays the sound when passing a random amount of rail nodes. Maybe it's not the best choice, but originally there were no sounds at all.
Attachments
audio_comparison.png
(44.66 KiB) Not downloaded yet
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

tvtd
New member
Posts: 3
Joined: Thu Oct 31, 2019 07:12

Re: [Mod] Boost cart [boost_cart]

by tvtd » Post

This is a great mod! I would like to see switch points controlled by mesecons, that way I can control carts from a distance. Right now I use a method with sticky pistons. It works but looks ugly.

I would propose a track type that allows you to place a mesecon on either or both sides. If the mesecon is on and there is a junction ahead with a turn option on the same side of the track, the cart turns to that side.

Silly question: When the cart moves very far away, it stops until I approach it. Is this a function of the minetest engine "sleeping" in places where nobody is near?

User avatar
Krock
Developer
Posts: 4510
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

Re: [Mod] Boost cart [boost_cart]

by Krock » Post

tvtd wrote:I would propose a track type that allows you to place a mesecon on either or both sides. If the mesecon is on and there is a junction ahead with a turn option on the same side of the track, the cart turns to that side.
That's a good idea, although not directly the most efficient one due to additional node lookups.
Ideally the rail node would be swapped between a fixed curve and the regular junction. Or alternatively to abuse "param2" (8 bits, unused for raillike nodes)... maybe I'll pick this up sometime, otherwise pull requests are welcome ;)
tvtd wrote:When the cart moves very far away, it stops until I approach it.
That's indeed due to how Minetest deals with unused mapblocks - they're not kept in memory until needed. For singleplayer you could try to increase the values of these two settings (causes more disk and CPU usage by server).
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

tvtd
New member
Posts: 3
Joined: Thu Oct 31, 2019 07:12

Re: [Mod] Boost cart [boost_cart]

by tvtd » Post

Ideally the rail node would be swapped between a fixed curve and the regular junction.
Hmmmm... Would that break the track where it previously offered a straight path through? Carts coming the other way down the broken track would not roll through the switch (the way they do in real life). I would think about leaving the junction in place but allow the behavior to change from "straight through" to "turn" based on the mesecon on the non-turned out side. Maybe the switch points could appear differently when turning versus going straight. You could even let the user punch the track to switch its default position.

Another way to think about it is to add 4 junctions to the default. Two for each direction (one open, one closed). The graphical look is slightly different for each, showing which side the turnout joins to and whether or not the points are open or closed. The behavior would be as follows:

Default junction: No different.
Side 1 points closed: Cart moves from side 1 to turnout or vice versa. Cart entering side 2 exits side 1.
Side 1 points open: Cart entering side 1 exits side 2 (and vice versa). Cart entering turnout exits side 1.
Side 2 points closed: Same as above, reversing sides 1 and 2.
Side 2 points open: Same as above, reversing sides 1 and 2.

Punching the junction could cycle between the 5 variations. Mesecon activity on the "flat" side could switch between the open and closed variations, doing nothing for the default junction.

Would this alleviate the extra node lookup problem?


The first looks and acts the same as it does now. The second shows the curve only between the turnout and ONE if the other sides. The third is the same but for the other side. That way it is clearly visible which route a cart will take no matter how it enters the switch.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 7 guests