MZ Animated sailing background

It is more like a idea for now. But think about a ship. The background loops but the distant part of the background should be much slower.
It is like mode 7 but I test without scaling in the picture, I just split-draw that part of the water line by line.
Any thought?

Edit*
The project ends up being a demo instead of a plugin.
You can download check the event script commands too see how it works.

possible, but will require quite some work.

basically you'll have to split the parallax into several different rows, so each row can move independently.

then for each row the width of the parallax needs to be different, because that one determines the scrolling speed (unless you really overwrite everything)

then there is the artistic challenge of making each part fit for looping with not only the opposite row-ends connection but the different lower and upper bounds between the rows fitting togetherno matter where the different parallaxes are currently standing.

and if you want that up-down railing implemented, that has to be done with a different parallax layer.

nothing really impossible or even complex to program, but quite fiddly to get everything right and working together.
You might consider making this an independently called layer structure, leaving the original parallax untouched for regular use - it would require too many data changes otherwise.
Ocean2.png

The pictrure I'm using is from MZ's default resource(I erased the small isle in the distance). It is already looped so left and right sides always connect.
Currently I place the sprite between the parallax and map tiles. I think it is a bit tricky because there are plugins that insert pictures or parallax in different layers. So maybe I should just make something that animated the picture itself, and let the user worry about putting the picture in a specific layer.

Edit*
One problem of the idea is the picture looks calm at first, but will deform later because different lines have different speed.

Edit*
Another trick is never slice the picture into lines that are too small. I let the scene run for a while, here's the differences:

With a minimal slice of 16 pixels and 75% opacity
Maybe adding some random pieces of drifting wood it will look OK for a sailing scene
1738052484071.png


Fixed 1 pixel slice, completely scrambled beyond recognition
Maybe still usable for a chasing scene with jet ski...
1738052612519.png


Original sea texture
1738052797298.png
One problem of the idea is the picture looks calm at first, but will deform later because different lines have different speed.
That is why I mentioned above that the different up/down boarders of the different slices need to be done carefully.
It was already obvious to me that you can't simply split a larger picture into rows and have that automatically work.


besides what you tried to do isn't a true parallax, it's just a special loop with different speeds. In my answer above I assumed that you want a true parallax for movement, but that is not what you attempted.
It is now obvious that you don't really understood what a parallax is or how mode 7 (which is something entirely different) works, resulting in your mixed try that won't work either way.

both parallax and mode 7 are based in different ways on angles, trigonometry and projections. Neither is really based on different speeds like you assumed, and that is why your tries to split the picture and move it at different speeds didn't work out.

And sorry, I have neither the time nor the detailed knowledge to guide you through that.
I can only suggest that you hit some advanced mathematics books to learn the formulae that you need to program in order to get the effect you're after. I really doubt that you'll be able to get it done with simple spped-loops.
Yeah I think you are right.
I should definitely go for a mode 7 solution for this.

Let this topic be an experiment then. I may pick it up when I have better ideas.
I decided to make a demo instead of a plugin.
The link in the first post contains 2 maps.
Map001 uses a mode7 background, and Map002 uses the idea in post #3.

The mode7 still needs some tinkering it seems.
Fixed 1 pixel slice, completely scrambled beyond recognition
Maybe still usable for a chasing scene with jet ski...
1738052612519.png


Original sea texture
1738052797298.png
looking at the demo, I like the first one better, but moving left, and water slows
down, while moving right a bit faster.

funny part, the 2 picture are moving, despite png's 😛

but I love the ship how you do that, moving up and down, hopefully,
it can work in MV, else to bad for MV users 😀

keep up the nice work, love the effect though.
Yeah, that is the idea. While moving left the player literally chases the water so it slows down.
Ideally, the water moves relatively to the ship.
funny part, the 2 picture are moving, despite png's 😛
Do you also hear the echoes of the sea? 😎
hopefully,
hopefully,
it can work in MV
In theory, the only difference is the script editor has a limit of 12 lines in MV.
Let me see if I can make a demo for MV later.

Edit*
A demo for MV is already added.
There's jittering problem when the display position is changed using script. Let me see if I can fix it, for now that is the only problem I've found.

Edit* Fixed
MV might be limit to 12, but I think it was 11, but still,
they can make it a 1 liner as well, as the length has no limit
so far I can tell.

I didn't use sound, so I need to check that.
I made another update.
The 3rd map uses a mode 7 + wave effect.
Math.sin is so slow, I have to create a lookup table for it.
Now it barely keeps 60 fps on my current pc.

I'm thinking about optimizing it. Maybe only update every 2 frames, or use half size texture.
I love the wave one, its smooth 🙂
Just did some speed optmizations.
1. Move the update code inside the scene's render function.
2. Use Int32Array instead of Array for faster memory accessing.

Now the only thing in the TODO list make an actual plugin.

Known issue:
MV version still has large delay spikes in those two mode 7 maps. I tested inside a web browser and it was much smoother. I guess it is because of nw 0.29. The MZ version is also much smoother.
I can try with version 0.48.4 that I use to see how it works for MV.
but didn't heard of Int32Array though.

Original thread: https://forums.rpgmakerweb.com/threads/animated-sailing-background.175002/