Jump to content

Best way to run animations without affecting my game mechanics?


dennis
 Share

Recommended Posts

Heya,

 

How can I make some sort of cinematic (ingame just by using animations) without affecting my game mechanics?

I have something in mind but it doesnt't really come to life.

 

i think I do need to run the cinematic (by creating a standard camera) and after completion of the sequence my player gets spawned or something.

How does the industry standard apply or do you guys have a good idea for me to bring this alive?

 

I'd like to here from you all, chreers!!

Link to comment
Share on other sites

You could use coroutines in lua to make designing such a thing easier and more logical. It sort of gives you the ability to use a poor mans cinematic tool.

 

Coroutines can yield out of the function they are in so the rest of the game can continue to run and when they come back into their function they start off where they left off. So you could be inside a loop increasing a number and yield out each loop and each time you come back in the state of everything (let's say that number) is exactly as it was when you left it.

 

What this provides for you is the ability to make sequences of events rather easily. Each sequence could also be in their own files which makes then nice and separate from each other and easy to maintain. You end up with a script sort of like:

 

-- pass in LE's world, window, & camera & anything else you need or you can query entities from the world
function IntroSequence(world, window, camera)
local player = FindEntity(world, "player")

player.script:DisableInput()

PlaySoundAsync("Sounds\Music\IntroMusic.wav")

local camera1Pos = FindEntity(world, "camera1_intro")
MoveEntityToLocation(camera1Pos, camera1Pos)


player.script:EnableInput()
end

 

 

Functions that I want to continue running the script I give Async at the end. Functions that I want to run until it's done I don't. For example I may want a move to point and don't want the script to continue until the entity is at that point so that function would be "blocking". I'm still working out none blocking move script as there would be something to track after the function call and not sure how to do that yet.

 

Dead Anyway needs something like this so going to take a look. Combining with the tween library I posted about this could be pretty slick. I've done tests so I know it works, the question is just making functions to make it easy to work with.

Link to comment
Share on other sites

  • 2 weeks later...

You could use coroutines in lua to make designing such a thing easier and more logical. It sort of gives you the ability to use a poor mans cinematic tool.

 

Coroutines can yield out of the function they are in so the rest of the game can continue to run and when they come back into their function they start off where they left off. So you could be inside a loop increasing a number and yield out each loop and each time you come back in the state of everything (let's say that number) is exactly as it was when you left it.

 

What this provides for you is the ability to make sequences of events rather easily. Each sequence could also be in their own files which makes then nice and separate from each other and easy to maintain. You end up with a script sort of like:

 

-- pass in LE's world, window, & camera & anything else you need or you can query entities from the world
function IntroSequence(world, window, camera)
local player = FindEntity(world, "player")

player.script:DisableInput()

PlaySoundAsync("Sounds\Music\IntroMusic.wav")

local camera1Pos = FindEntity(world, "camera1_intro")
MoveEntityToLocation(camera1Pos, camera1Pos)


player.script:EnableInput()
end

 

 

Functions that I want to continue running the script I give Async at the end. Functions that I want to run until it's done I don't. For example I may want a move to point and don't want the script to continue until the entity is at that point so that function would be "blocking". I'm still working out none blocking move script as there would be something to track after the function call and not sure how to do that yet.

 

Dead Anyway needs something like this so going to take a look. Combining with the tween library I posted about this could be pretty slick. I've done tests so I know it works, the question is just making functions to make it easy to work with.

 

I don't really understand all of that. tried to find out how to but didn't work out :/

Link to comment
Share on other sites

I got it going for our game. I need to release the base code and demonstrate how to use it. Been behind on doing that. I'll see if I can get to it in the next day or so.

 

I combined the tween library I was using and make some cool functions around those which can make some cool effects. It's not 100% worked out yet and could have fixes but just might release it and let others improve on it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...