Some questions about Campaigns, Animation and Lua

2 replies [Last post]
BJ99
User offline. Last seen 42 weeks 6 days ago. Offline
Joined: 2022-09-11
Posts: 3

I wanted to make a Campaign for myself, but I was stuck at the starting point.

The code for the knowledge base or the campaign that comes with the game is obscure to me, and I have a hard time understanding them.

For example, animation, I wanted to have an opening like "A Classic Fairytale", but I didn't know how to create a series of animations and let the player continue the game at the end.

Is there someone who can provide me with some guidance and simple demos?

Thanks a lot! ;)

Wuzzy
Wuzzy's picture
User offline. Last seen 4 days 17 hours ago. Offline
Joined: 2012-06-20
Posts: 1301

Animations are quite advanced so I suggest you first try to familiarize yourself with the Lua API in general and creating a single basic mission first with no animations and play around for a little until you are more confident.

I just looked at the HWKB page of Animate and yeah, it could see a rewrite indeed. But the gist of it is that you first add the boilerplate code as mentioned in the HWKB page for onGameStep and onGameInit.
Then you start defining tables of animation "steps" which are tables containing info what happens in each step of an animation. The campaign missions have a LOT of code doing just that.
Finally, you start an animation with AddAnim.
The devil lies in the detail, of course.

Campaigns are just collections of missions and I wonder what exactly made you stuck. Can't find the correct place to put in the files? Don't know what files to create? Don't know what code to write? Need to figure out unlocking of missions? Etc.

It would be more helpful if we know where you are stuck.

Hi, I am a Hedgewars developer. Smile

Wuzzy
Wuzzy's picture
User offline. Last seen 4 days 17 hours ago. Offline
Joined: 2012-06-20
Posts: 1301

Today I took some time and rewrote the documentation of the Animate library: LuaLibraryAnimate

It turned out a couple of functions were undocumented and there was also no overview. So I updated this, extended the introduction part and have added functional example code for a minimal animation in a mission script to demonstrate the basic structure of a typical animation script.

I hope this helps!

Hi, I am a Hedgewars developer. Smile

Copyright © 2004-2023 Hedgewars Project. All rights reserved. [ contact ]