[Mod] Carts [carts]

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Jul 31, 2012 09:11

Tggtt wrote:Thanks a lot. I think you forgot to add the recipe for pickup_plate in the first post.

Image

Ive added your picture.
Tggtt wrote:I had to open the code to find it.
While reading the code for the pickup_plate, I came across your "fors" to search for the boxes and plates. I think you should try merging the "fors" because they are exactly the same, only the "if" changes. Merging them would improve performance for the same result.

Ive changed it (see version 26).
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Jul 31, 2012 09:14

cornernote wrote:Mine would stop if i made a stair-like slope into my mine. I got it working really nicely (havent seen it crash) with a really small change:


Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
        -- downhill
        local vel = self.object:getvelocity()
        vel.y = -3*MAX_SPEED -- used to be -2*MAX_SPEED



edit: no it still crashes sometimes

My cart works with -2*MAX_SPEED.
 

User avatar
Ragnarok
Member
 
Posts: 213
Joined: Thu Mar 22, 2012 12:56

by Ragnarok » Tue Jul 31, 2012 09:15

I made a bit more natural sound for cart. Do you like it?:

http://speedy.sh/r4dPu/carts-cart-sound.ogg

License: WTFPL
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Jul 31, 2012 09:27

Ragnarok wrote:I made a bit more natural sound for cart. Do you like it?:

http://speedy.sh/r4dPu/carts-cart-sound.ogg

License: WTFPL

Ive set this to the default one but leave the old one in the sound folder so everyone can choose on his own.
 

User avatar
Ragnarok
Member
 
Posts: 213
Joined: Thu Mar 22, 2012 12:56

by Ragnarok » Tue Jul 31, 2012 09:43

Fantastic :) What do you think about using two different sounds for cart on straight rails and railway crossover?
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Jul 31, 2012 09:55

Ragnarok wrote:Fantastic :) What do you think about using two different sounds for cart on straight rails and railway crossover?

I had the idea that theres only one short sound that is played when the cart enters a new rail block.
With this method you can make many different sounds that are played randomly. You can also make different sounds for different rails.
But the sounds have to be realy short.
 

User avatar
Ragnarok
Member
 
Posts: 213
Joined: Thu Mar 22, 2012 12:56

by Ragnarok » Tue Jul 31, 2012 10:27

This can be problematic because of embedding the clatter of train wheels in the sound. Rails are too short. But you can use sound which has approx. 4-rails-length (with current speed of cart). You could check rails below cart, and if it meets an crossover (or bend) swap sound and simultaneously block the substitution of a different sound for a period equal to 4-rails-length (8-rails-length?).
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Jul 31, 2012 10:37

Ragnarok wrote:This can be problematic because of embedding the clatter of train wheels in the sound. Rails are too short. But you can use sound which has approx. 4-rails-length (with current speed of cart). You could check rails below cart, and if it meets an crossover (or bend) swap sound and simultaneously block the substitution of a different sound for a period equal to 4-rails-length (8-rails-length?).

I can do this if you provide the sounds. The coding is easy.
 

User avatar
Ragnarok
Member
 
Posts: 213
Joined: Thu Mar 22, 2012 12:56

by Ragnarok » Tue Jul 31, 2012 10:58

Ok, I'll make sounds. Maybe it would be better if the default sound will play all the time and swapped only when the train hovers on the crossover (and played for few moments)? You could then use the sounds of various lengths regardless of the cart speed. What do you think?
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Jul 31, 2012 11:08

Ragnarok wrote:Ok, I'll make sounds. Maybe it would be better if the default sound will play all the time and swapped only when the train hovers on the crossover (and played for few moments)? You could then use the sounds of various lengths regardless of the cart speed. What do you think?

I would prefer the short sounds.
 

User avatar
Ragnarok
Member
 
Posts: 213
Joined: Thu Mar 22, 2012 12:56

by Ragnarok » Tue Jul 31, 2012 12:42

Two sounds 2s long (10 rails) and one 1s (5 rails):

http://speedy.sh/jqz7M/carts-sounds.7z

License: WTFPL, enjoy =)
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Jul 31, 2012 12:53

Ragnarok wrote:Two sounds 2s long (10 rails) and one 1s (5 rails):

http://speedy.sh/jqz7M/carts-sounds.7z

License: WTFPL, enjoy =)

Thanks a lot!
Im still working on a other mod so it will take some time (1 day).
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Tue Jul 31, 2012 14:43

PilzAdam wrote:
cornernote wrote:Mine would stop if i made a stair-like slope into my mine. I got it working really nicely (havent seen it crash) with a really small change:


Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
        -- downhill
        local vel = self.object:getvelocity()
        vel.y = -3*MAX_SPEED -- used to be -2*MAX_SPEED



edit: no it still crashes sometimes

My cart works with -2*MAX_SPEED.



does it ever stop on a descent slope? (not just 1 step down, then flat, i mean lots of steps like this)...

|_
|_
|_
|_
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Tue Jul 31, 2012 14:51

cornernote wrote:
PilzAdam wrote:
cornernote wrote:Mine would stop if i made a stair-like slope into my mine. I got it working really nicely (havent seen it crash) with a really small change:


Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
        -- downhill
        local vel = self.object:getvelocity()
        vel.y = -3*MAX_SPEED -- used to be -2*MAX_SPEED



edit: no it still crashes sometimes

My cart works with -2*MAX_SPEED.



does it ever stop on a descent slope? (not just 1 step down, then flat, i mean lots of steps like this)...

|_
|_
|_
|_

Image
This works for me.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Wed Aug 01, 2012 01:07

still too small. mine goes down about 50-70. It USUALLY works, but it sometimes stops.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Wed Aug 01, 2012 01:14

Your screenshot - this is correct movement:
x+
x+
x+
y-
x+
y-
x+
y-
x+
y-
x+
x+


Here is what mine does (sometimes):
x+
x+
x+
y-
x+
y-
x+ <---- after this point the cart:on_step() didnt get called until the cart moved twice in the X+ direction
y- <---- at this point there is no track at y-1 (the track is at y-2), the cart stops

Note, this only happens on a really long descent. And I think it never happens on the way back up.
Last edited by cornernote on Wed Aug 01, 2012 01:15, edited 1 time in total.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Wed Aug 01, 2012 01:26

im not sure, but it might also have the same effect if you have lots and lots of corners and no straight track?
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Wed Aug 01, 2012 08:13

cornernote wrote:im not sure, but it might also have the same effect if you have lots and lots of corners and no straight track?

Yes. It is the same problem. The cart moves on its one and the on_step() method (wich controls the cart) is only called every 0.25 sec. (or something like that). So if the server lags the control method cant control the cart -> problems appear.
 

cornernote
Member
 
Posts: 844
Joined: Wed Jul 11, 2012 15:02

by cornernote » Wed Aug 01, 2012 10:23

is there any way to store the last piece of track it went over (and the direction) and then if it goes off, kinda try to put it back?
 

pagliaccio
Member
 
Posts: 65
Joined: Tue Jul 31, 2012 07:38

by pagliaccio » Wed Aug 01, 2012 11:29

error[serverthread] serverenvironement deactivatefarObjects(): id=74 m_static_exists=true but static data doesn't actually exist in (3,0,-2)
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Wed Aug 01, 2012 19:33

pagliaccio wrote:error[serverthread] serverenvironement deactivatefarObjects(): id=74 m_static_exists=true but static data doesn't actually exist in (3,0,-2)

Never had this error. Does it appear when you go far away from a cart and then come back to it?
Does it appear always or just sometimes?
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Wed Aug 01, 2012 19:33

cornernote wrote:is there any way to store the last piece of track it went over (and the direction) and then if it goes off, kinda try to put it back?

Sounds like a good idea. I will think about that.
 

pagliaccio
Member
 
Posts: 65
Joined: Tue Jul 31, 2012 07:38

by pagliaccio » Wed Aug 01, 2012 19:50

PilzAdam wrote:
pagliaccio wrote:error[serverthread] serverenvironement deactivatefarObjects(): id=74 m_static_exists=true but static data doesn't actually exist in (3,0,-2)

Never had this error. Does it appear when you go far away from a cart and then come back to it?
Does it appear always or just sometimes?


it appear sometimes. Does it appear when i go far away from a cart and the cart stop or disappears.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Thu Aug 02, 2012 09:15

pagliaccio wrote:
PilzAdam wrote:
pagliaccio wrote:error[serverthread] serverenvironement deactivatefarObjects(): id=74 m_static_exists=true but static data doesn't actually exist in (3,0,-2)

Never had this error. Does it appear when you go far away from a cart and then come back to it?
Does it appear always or just sometimes?


it appear sometimes. Does it appear when i go far away from a cart and the cart stop or disappears.

The cart is an object and objects only can move if there is a player near by. If all players go far away the engine creates something that is called "static data" to save the current state of the cart. When you go closer the engine gives the static data back to the cart, so the cart knows what to do.
It seems that there appear problems when the static data are created in your game.
Could you please answer the following questions:
  • Wich version of Minetest do you use (please not only "0.4")?
  • Wich version of the carts mod do you use?
  • Wich other mods do you have installed.
  • Do you have any other problems with any mod?
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Thu Aug 02, 2012 10:24

cornernote wrote:is there any way to store the last piece of track it went over (and the direction) and then if it goes off, kinda try to put it back?

Thanks for this idea! I was able do fix the derail bug.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Thu Aug 02, 2012 10:25

Ragnarok wrote:I made a bit more natural sound for cart. Do you like it?:

http://speedy.sh/r4dPu/carts-cart-sound.ogg

License: WTFPL

Ive implemented it in version 28. The sounds are now played randomly.
 

pagliaccio
Member
 
Posts: 65
Joined: Tue Jul 31, 2012 07:38

by pagliaccio » Thu Aug 02, 2012 12:12

PilzAdam wrote:
pagliaccio wrote:
PilzAdam wrote:Never had this error. Does it appear when you go far away from a cart and then come back to it?
Does it appear always or just sometimes?


it appear sometimes. Does it appear when i go far away from a cart and the cart stop or disappears.

The cart is an object and objects only can move if there is a player near by. If all players go far away the engine creates something that is called "static data" to save the current state of the cart. When you go closer the engine gives the static data back to the cart, so the cart knows what to do.
It seems that there appear problems when the static data are created in your game.
Could you please answer the following questions:
  • Wich version of Minetest do you use (please not only "0.4")?
  • Wich version of the carts mod do you use?
  • Wich other mods do you have installed.
  • Do you have any other problems with any mod?



  • v 0.4.1
  • 25 but now try a new version

i need a transport in long distance.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Thu Aug 02, 2012 12:14

pagliaccio wrote: but now try a new version

Tell me if the bug is stiil there.
 

pagliaccio
Member
 
Posts: 65
Joined: Tue Jul 31, 2012 07:38

by pagliaccio » Thu Aug 02, 2012 13:25

PilzAdam wrote:
pagliaccio wrote: but now try a new version

Tell me if the bug is stiil there.


i have a make a rail for connect a mine width castle and return. cart stop at midle way. not return.
the problem is the long distance.
 

User avatar
PilzAdam
Member
 
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam

by PilzAdam » Thu Aug 02, 2012 13:31

pagliaccio wrote:
PilzAdam wrote:
pagliaccio wrote: but now try a new version

Tell me if the bug is stiil there.


i have a make a rail for connect a mine width castle and return. cart stop at midle way. not return.
the problem is the long distance.

This is an engine thing. I cant change anything about that. Sorry.
 

PreviousNext

Return to Mod Releases

Who is online

Users browsing this forum: No registered users and 1 guest

cron