Warzone2100 / warzone2100

Command the forces of The Project in a battle to rebuild the world after mankind has been nearly destroyed by nuclear missiles. A 100% free and open source real-time strategy game for Windows, macOS, Linux, BSD+
https://wz2100.net
GNU General Public License v2.0
3.22k stars 531 forks source link

Propulsion animations #864

Open cpdef opened 4 years ago

cpdef commented 4 years ago

Describe the feature you'd like Add some animations for the different propulsions, like wheels, tracks so that they look like they are moving. For example the wheels should rotate. Also if the droid stands, the animation should stop

Describe why do you think it is needed looks good

Images Here you can find the images for the drives, which should be animated: Images Images

MaNGusT- commented 4 years ago

It will require changes to code -> event-driven should be expanded to propulsions.

bjorn-ali-goransson commented 4 years ago

So propulsions are non-animated currently?

MaNGusT- commented 4 years ago

Currently, only buildings and bodies are able to use even-driven animation.

cpdef commented 4 years ago

Ok that sounds more hard to do then expected, but maybe only to me, because I'am not so familiar to the code until now. Any ideas where we could start adding the event-driven animations to propulsions? Maybe the same should be done with weapons to?

bjorn-ali-goransson commented 4 years ago

I did a POC for this just now: https://github.com/bjorn-ali-goransson/warzone2100/tree/bjorn-ali-goransson/animate-propulsion

https://youtu.be/J1xYe7vvvTY

There are two types of animation, texture animation and transformation animation (dunno what else to call it). That fork does only the transformation based animation, which is essentially the wrong kind, but was more difficult to implement so textures should be much easier.

Transformation based animation propulsions presents the following challenge, when to start the animation? And when to stop it? And at what speed? So I guess we'll hold on to that one until time comes. No doubt real animated tracks would look better than texture animations. But, baby steps...

I'll try to do the texture animation next.

cpdef commented 4 years ago

If i understand MaNGusT right, it isn't currently possible to stop them. Or could you do it?

bjorn-ali-goransson commented 4 years ago

I believe it's not so hard. But to keep track of the current frame, especially throttled by movement speed, over time, is a challenge. Luckily the tracks won't have to be gracefully animated, they just need to "go brrr"

bjorn-ali-goransson commented 4 years ago

It works! And it was easier than the transformations based animation, just as I suspected!

https://youtu.be/yDvRVqWanQg

bjorn-ali-goransson commented 4 years ago

Fork for that modification: https://github.com/bjorn-ali-goransson/warzone2100/tree/bjorn-ali-goransson/animate-propulsion-texture

We now need a texture for moving tracks. Perhaps we can get by with 2 frames, just alternating the colors of the tracks?

I'm thinking we can duplicate the contents of this red square and modify the PIE files accordingly. Maybe even make a new texture page...

image

@MaNGusT- what do you think? Would you be up to the task?

bjorn-ali-goransson commented 4 years ago

Forgot the new youtube link, where I link the animation speed to the unit speed:

https://youtu.be/NRA2eia4cv8

MaNGusT- commented 4 years ago

I have my own to-do list in ARmod like from here to Mars. Also, I don't want to bother myself updating classic models but If you'll have success with the code committed, we could add such animation to ARmod in future releases. If you want to update classic models, you should better ask @Berg53

bjorn-ali-goransson commented 4 years ago

OK, just implemented this with some amateur pixel pushing.

https://youtu.be/y5SLI2IwLJ0

page-16-droid-drives