Cineamatic camera, event system, and folower ai. Contains quasi tutorial

(Cortu) #1

A template and quasi tutorial for cinematic games in upbge.
The main features include,

  • Cinematic cameras
  • Navmesh switching
  • Follower ai
  • Character switching
  • An event system including,
  • Buttons
  • Traps
  • Teleporter
  • Conveyor

Key Binds
up: e
left: s
down: d
right: f
jump: space

switch: tab
follow: f2
stay: f3

Click here for the readme.

Pictorial logic brick layout can be found here.

The quasi tutorials can be found in the game scripts as heavily annotated code. To read the code.

Direct download link.

Designed on UpBge 0.2.4
License Cortu Johnstone CC BY-SA 4.0

(blenderaptor) #2

need dropbox to download :confused:

(Cortu) #3

I’m pretty sure the direct link doesn’t need Dropbox. Dose this one work?

(Camos1011) #4

There is meant to be a mouse over text system and I’ve been having the hardest time finding anything here (I guess I suck at searching for stuff).
So, I made my own really simple one.
hover text.blend (509.5 KB)

(- Click for resources) #5

I tried it out.

How the peep do you get upstairs? i managed only 1 time to climb the ladder and have no clue how i’ve done it. haha. xD

Also didn’t use the button but do they for example stop the floor from opening? i just stepped on the floor and jumped into the hallway :wink:

Anyway nicely done.

simple one? it’s how you do it with bricks only, so you done good.(could also have used messages)

(Cortu) #6

Theres a ladder to the left, a stairwell to the right and a green button left of center.
Stand next to the button and click it with the mouse. Same goes for the ladder, click it with the mouse. Both the ladder and the button have a proximity limit, so you have to be kinda close, but if you block it, then you cant click on it. The ladder in particular is a problem because I had to take it out of the corner due to some issues with character physics. Make sure you’r right in front of the ladder when you click it, not to the side. The stairwell is easy, just walk up it. The red buttons due indeed disable the trap.
I’m guessing the way you got up the ladder the first time was by clipping threw the corner, creating weird physics problems. :slight_smile:
Btw, you can change the allowable distance by changing the maxDistance property on the trigger objects.

(- Click for resources) #7

I got that part haha, i purely meant up the ladder :slight_smile:
It’s indeed a bit bugged, if you walk against the ladder/wall you kinda get pushed up to there. (i believe this has to do with friction settings in the wall and or player material).

Ah ok that’s what i wanted to know, thanks!

Thanks for the explanation.

(Camos1011) #8

I just decided to center the active player triggers and keep the ai and navmesh ones as is and move the ladder and wall further to the left more and now it works far smoother and I don’t have to worry about the following AI pushing me off the map if you move too slow.

I’m just stuck with not being able to figure out how to get the ai to teleport with the active player on both characters.

(Cortu) #9

The easiest way is to teleport them indevidualy by pressing tab and having both characters press the button. If you want them both to teleport at the same time, then your probably going to want to send a message. You’ll need some way to know who the follower is and something that sends the message. You could also have an area teleporter that telepoted every one standing in a ghost object.

target = folower
eventName = 'teleportEvent'
eventAction = 'do'
gry.msgr.say('event', [target, eventName, eventAction], 'event')
(Camos1011) #10

I was actually thinking about the area teleporter and somehow assign properties to the a collider linked with the ai True Property but, can’t get it to work.
I was also thinking that an area teleporter could be used to “fake” certain actions like entering vehicles and teleport a static vehicle and characters for a vehicle with them both jumping inside as an opening animation too. I was up all night thinking of the implications of an assignable teleporter and there are a lot.

UPDATE: earlier was wrong version -_-

(Camos1011) #11

Can those lines be added in-engine or through Python app only? I tried it and it didn’t work and wasn’t quite sure where to put it. I tried below the last line for teleporting within and under line 37 too.

(Cortu) #12

The problem is that you have to know who the follower character is. Thats who fills the target argument. Making a trigger is or less like this.

  1. Have a way that the event triggers. Like walking over a particular area, pushing a button or something dies, etc.
  2. Decide who or what triggered the event.
  3. Send a trigger message to a triggie message receiver.
  4. The triggie then decides what should actually be done.

The problem with teleporting the follower is that its not the one that triggering the event. So you have to store the follower somewhere.

  1. When the button is clicked, gryTrigger.gryTrigger.Button.input runs.
  2. Each time you switch characters you send a currentCharacter message. This is handled in gryCine.cineChar.CineamaticCharature.input. The trigger then receives the currentCharacter message in gryTrigger.gryTrigger.Trigger.message and stores it in The button then runs This sends an event message.
  3. That message is received by gryTrigger.gryTriggie.Triggie.message. If eventAction == ‘do’, then the triggie runs
  4. The do method for teleporting is defined as

Each step of the way is defined separately so that its easier to customize, but it means that you have to trace each step.

One way to teleport the follower is to send a currentFollower message and have it received and stored in the same way the target is. Then when the button is pressed you could run; You could also make target a set and run do with a for loop.

Maybe the easiest way would be to store the follower in the Global Dictionary.

(Camos1011) #13

Is there a way to not have the follower spaz out when they follow active to a new section of a map? There Is an area that I’m trying to send them to together and the follower drifts but, I managed to solve the not facing active character problem but, now this is the only issue.

(Camos1011) #14

Is anyone else willing to help me out with this?

(Camos1011) #15

Well, I figured out my own way to teleport both characters.
Now my problem is how do you just make the camera jumpcut to a teleport zone?
Is the camera programmed to not drip smoothly when it transitions?

(Cortu) #16

its something similar to but not actually,
bge.logic.getCurrentScene().currentCamera.timeOffset = 0.0. its
called ‘slow parent’. higher is slower.

(Camos1011) #17

How about placing AI that doesn’t spaz out in a new side area on the map?
teleport ai spaz out.avi (3.0 MB)

(Camos1011) #18

I’m beyond beyond stupid.
I didn’t link the trigger to the nav mesh!!

(Camos1011) #19

Which script do I ad this to?
cineCam and if so, how do I do it without ruining the transition in rooms other than ones you jump to?
The closest thing that does it is “smove” but, it looks like it’s bound by the main cam

Could someone else help me out with this?
Vague stuff doesn’t help me out.
This camera setup is driving me nuts :confused:

(Cortu) #20

I actually meant to implement this functionality, but I forgot. You’r right, its done with smove. Its only about three lines. So Ill tell you what. I can tell you what those three lines are and you could change them yourself. Maybe you’d get a better feel for the code. Or you can put the code up on GitHub and Ill change those three lines for you. That might be easer, but there could be licensing problems. I don’t really know. Just make sure you only upload the code, GitHub doesn’t like art. You might want to license the art differently anyways.