Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

2018/01/31

Still busy...

Hi!

Okay, the fact that we are busy hasn't changed since last month... But at least now I have some time to write about our latest Unreal 4 adventures.


We had to script a horseman. The horse mesh was given to us, complete with materials and animations. The challenge was putting an already heavily script-based human on top of the horse and syncing up their animations and movements.


The movement part was easy, we attached the human's pelvis to a socket on the horse's saddle. However the animations were a bit more tricky, and we still think the whole system could have been done better, but not sure how.



This was our solution:

We united the horse and human skeletons in Blender, and animated the human on top of the horse that way. We then exported the unified skeleton, along with the animations, and assigned the horse to that skeleton. An animblueprint was built for the unified skeleton that contains IKs for putting the rein in the human's hands and the stirrup on his feet (If the IKs relied on any variables outside of their respective animblueprint, they lagged behind about one frame).


Now comes the hacky part: we stuck the human on top of the horse, retargeted the riding animations of the merged skeleton onto the human's skeleton, then built the same animblueprint for its skeleton too, sans the IKs. We rigged the whole thing so that the merged skeleton's BP sends signals to the human's BP to change anim states, so the changes occur at the same time and the animations stay in sync. Occasional errors still occur once in a blue moon (oh crap, today's a blue moon!), but we suspect those are framerate-related.

This system feels bloated and makes any later changes risky, however, we couldn't come up with anything more stable at the moment, and under our current pressure. Do you guys have ideas on how to make such a system more stable?

2014/07/31

Swordfighting!

Hi, Lussy here.

We’re progressing with the game, even if it seems like we’re just lazing around not doing anything. I’m working on weapon scripts at the moment, while Geril is creating the 3rd player character’s model and working on Eslie and the bobcat too. The bobcat has lots of placeholder combat animations, so I started working on a more serious combat system (until now it was very simple). I’m going to talk about these scripts now, in hope of either helping out someone, or someone telling me why they suck. Remember, I’m not an experienced scripter, I just get an idea and then try to make it work. So with that said, let’s begin.

The current combat system consists of 3 possible combat animations being played. The first one simply plays when you push the attack button, and the second and third ones appear if you successfully maintain a combo. Until now, all this was simply based on timers in the script, but right now I’m experimenting with AnimNotifies. It works like this:

-Player presses the attack button. The combat animation starts.

-When the animation gets to the point where it should start dealing damage, an animnotify calls the function for tracing the swing, and when it shouldn’t deal any more damage, another animnotify stops the tracing process. This way if the animation has a part where the sword is held stationery, it won't hurt anyone.

-There are also two animnotifies for doing combos. They mark the two points in between which the player can push the attack button to continue the combo.

-The last animnotify marks where the second animation should play, if the player wants to continue the attacking combo. If there wasn’t any input, the current animation simply finishes and the player gets back to the idle state.


I needed to do lots of planning to make this work, and I’m still not sure if it’s going to stay (there are lots and lots of ways it can make the weapon stop working altogether, as of now.). If any of you know any better, please don’t hesitate to comment.

Players can have two weapons with them (and some more in their bags, which can only be accessed while out of combat), though only one can be equipped at a time, the other one will be sheathed. Right now, only the sword has the combo system mentioned before, the axe is still very primitive, but functional. Obviously, the axe will be slower but stronger.


The sword only has these really slow animations for debugging purposes. It will be a quick weapon in the final game, with great mobility.

Planned combat speed

That's about it, for now. See you next time!