 Hello everyone and welcome to the 3 o'clock to 3 30 p.m. session of the 2017 Open Simulator community conference as a reminder to our in-world and web audience You can view the full conference schedule at conference dot open simulator dot org and tweet your questions or comments to at open sim CC with the hashtag pound OS CC 17 This session we are happy to introduce a terrific session called why I don't need a physics engine Our speaker today is kayaker magic Kayaker after four decades of writing code in the real world kayaker magic has been scripting in virtual world since 2008 he started by extending his love of water sports especially kayaking sailing and surfing into second life and then opens him But he has expanded his interest to into many different fields of scripting here Welcome all let's begin the session Hi, thanks, Lear. I'm so happy that you are my moderator because I know you crave excitement And I I hope to do some scary things up here on the stage I Know how it feels to be a developer and no matter what you do people always ask for more more They want more features. They want things to run faster more like that other system over there I thought the devs of open sim would like to hear someone say less less for a change I've done I've not quite succeeded in doing this because I am asking for something here, but maybe I can help write it when the time comes I'm a bit of a shit-disturber and I'm I'm probably going to get excited here and and and call the The physics engines by derogatory names, but you shouldn't take that too seriously as a matter of fact I know how hard it is to do a physical simulation and And I think that the physics engines that we have are all awesome This is a picture from a short video which you can find on YouTube I'll paste it into chat here You can watch it at your leisure and in general you can search for bullet and in YouTube on lots of interesting videos like this and I'm not picking on on bullet sim here. It's just it's an easier one to find on YouTube than than any of the other ones so the the point of my talk is that the physics engines are very expensive and they use up a lot of resources in memory and CPU time and And and do I ask the question and I don't think this gets asked very often. Do we really need it? What are the things that the physics engines do that that we think we need? Well, here's a list of things the first one there keeps your feet on the ground I'll go go through these in order later You don't need that me to read the slide to you the first of these keeps your feet on the ground is the the physics of the avatar itself and from observing The avatars in action. I keep asking myself. Where is the physics in the avatar? The avatars don't accelerate when they move they decelerate instantly They seem to even when they're falling they reach their terminal velocity almost instantly and then they don't bounce when they land unless you have a bounce Animation and that's actually just faking the physics and I get the impression that the physics in the in the avatars Behavior is mostly faked it seems to be made of a bunch of special cases and I think if you Kept the special cases and got the physics the rest of the physics out of the avatar Most people would never even notice That there weren't any any physics. There wasn't any physics involved The the one thing that people say the physics engine does is that keeps you from walking through walls But avatars again behave in a rather non physical way when you run into a wall you just stop moving It looks like it's one of those special cases when the avatar collides with an object You just make it stop and as a matter of fact though This is a general part of the problem of detecting collisions between all objects and The physics engine has needed to do this for for a long time It needs to detect when a ball collides with the ground to make it bounce it needs to detect when a bullet runs into something to to transfer a damage and and so this is the one thing that the physics engine does that it that it shares with everyone else that That I found a use for I'd like to be able to detect when the the scripted objects that I make collide with other things and I And I'm glad that I do get notification of some of these events But I don't get those notifications in all the the the times that I need it The physics engine seems to be kind of selfish It doesn't need to detect non physical objects colliding with each other and so it doesn't even tell me about about those sorts of events and I've had a lot of trouble trying to use the physics engine in in lot other in lots of scripted objects because it's it's much less predictable than than than scripting an object to move it yourself and so I would prefer to move objects myself and then have the the Collision engine if there was one tell me when they collide and have me decide what to do instead of having two boats colliding in the water and they often if they're physical boats they often do bizarre things like jumping up in the air or flipping upside down and I think I could script better behavior than that in a special purpose boat script so the other thing that That physics is supposed to be good for is for making things fall down Well, what things do we really need to fall down in in? In the virtual worlds, I'm gonna paste a couple of videos into Into chat and these are examples actually of bullet sim being amazing again And and so I'm not I'm not here to to say that I don't like the physics engines I think they're fantastic, but I think they're they're perhaps This may not be the right place for them I also think that a Daytona formula race car is fantastic, but I don't want to use it to drive to work every morning So these these videos here are people doing Amazing things with bullets in for example building those those video I showed you before of the of the bullet Having the building collapse that was actually a standalone program that was it didn't have to generate its its Images in real time, but these are examples of people using bullets him to do things in real time And I have for people who don't have time for the videos here some some stills from those videos This is a building with with 1,000 blocks and they all Fall down in a fairly realistic way and it's amazing that that this is even possible in a general-purpose program like Like open sim and here's a someone testing bullet sim with 2,500 balls that you can run around and kick and And that's kind of fun. It's always fun to stack things up and watch them fall down But that's not I think a core use of open simulator Here's a chain that is that's hanging down and you can fly into it and the the chains Swing back and forth and and bounce in a realistic way And here's one of those other videos It's a chain between two poles and it swings back and forth and behaves in a physical way And it's really impressive that it does this, but this isn't the correct way for example in in Open simulator to say implement a swinging chair The the owners of the grids that you do things on this will ask you please stop doing this Please stop stacking a thousand objects up because it's creating a lot of leg that is slowing down the experience for other people You could build a swinging chair without using physics and make it swing back forth in a reasonable way And and that Could be done without physics So last year I gave a talk about Bullets in open sim or about weapons in general And i'm going to res a couple of objects on the stage here and unfortunately I have to res them really close to the audience Because there's a bug in open sim 0.8 Where if you if you try and cast a ray in a weapon It will It will collide with invisible objects all over the place and the stage has a lot of those invisible objects I need to there we go So i'm going to To try and shoot down this And i'm having trouble Aiming oh dear, but perhaps perhaps you are seeing the bullet fly through the air. I tried to slow them down for this talk And the the gun is not letting me reload it very fast And I keep missing Of course that would happen in the middle of a presentation well, then While it's uh reloading I'll demonstrate a couple other features of this weapon That uh the bullets explode when they hit something These are total non physical bullets And um perhaps you know I have to fly over there. I made it over somebody's head That bullet just flew into another region And generated an explosion in another region and that's something that uh You can't do in open sim 0.8. Of course And uh my cursor is not appearing Uh, so I finally hit the uh the blimp and it's going to crash into the audience So I've spent too much time on bullets because I spent some time talking about that last year And another thing that the physics engine is good for is for just making things move smoothly And so there are a lot of of small items in uh open sim That you want to move around like you know, you want fish to swim in your water And you want uh Your birds to fly through the air and uh the non determinism of the physics engine has always been a problem for me That when I tried to make a fish stay in the water If I use tools like uh set keyframe motion, which we didn't originally have if you recall It was added late in second life and it was added even later in open sim So for a long time you try and move things like move to target Which was a useless tool for moving uh a small items around because it was critically damped meaning that things start fast And then slow down I want my fish to swim at a constant speed and there wasn't any tool to do that except the the vehicle api And programming writing a a a script to become a vehicle seemed way overkill for just making a fish swim around And then there's the determination the deterministic nature of uh of key set keyframe motion I can tell my fish where to go and I can tell it don't go out of the water Or I can tell my bird don't fly outside of the uh of the region and speaking of birds Here's uh a Uh for a minute, I thought it was a dead bird Here's a couple of birds to fly around the region and you'll probably see them doing things Like flying through the uh the stage and through the screen But this is an object moved with set keyframe motion and I claim it's better than physics because of that deterministic uh capability and because it's very easy to use compared to using the the the The physics api for vehicles And the other thing well well so far. I don't know if you've noticed I said uh avatar Physics don't avatars don't seem to really need physics I've said that uh for bullets. I don't need physics for uh for small moving objects I don't need physics and then we everyone says oh well everyone wants physics for their vehicles And you would think that set keyframe motion is not going to be a good tool for uh for for building a vehicle because Well, it moves at a constant velocity and you want all those physical abilities like acceleration and and collisions to uh in your vehicles, but I found that that you can Script a vehicle with set keyframe motion and open sim sort of forced me to develop this technique Which is to do my own physical calculations infrequently like once a second And then to call set keyframe motion and have it interpolate the position of the of the object In between those calculations and that's allowed me to do a whole bunch of of non physical vehicles Which had another advantage at least in the in the especially in the early days That set keyframe motion has been working well in open sims its version 7.6 And if I have a vehicle that uses that then it it was it started working back then when when ode uh could not basically was was Uh, not usable to make physical vehicles and we had to wait for bullet sim and we had to wait for ubo de recently before we could we could write a A physical vehicle script so I could write vehicle scripts that were working before the physics engine was ready and then When kitely came along I could put a vehicle for sale on the kitely Marketplace and somebody who who was in a region far far away that didn't have bullet sim Or who had bullet sim when I wrote the the script for for ubo de That my scripts would work everywhere in the metaverse. And so I uh, I Became really fond of the idea of not using physics engines to do my my vehicles and Let's try another demonstration Let me give myself a little bit of a runway here So I can probably still talk while I fly around And this is a a flying uh physical object script And you'll probably see me miss and fly through walls and things like that boy. I'd like to have uh the uh Of the collision engine tell me and here I am running into the edge. Whoops of things And uh recovering because I can script And now I'm totally lost Hey kayaker, you're on the back side behind the viewer behind all the signage come back to the center I'm working on it I think I'm flying around in circles back here. Maybe I should just uh I should just always get another carpet. They're they're cheap, man Well now I made a terrible mistake Yeah, well, I made it the terrible mistake of of stepping off and flying isn't allowed So it took me a while to get back And let's see. I have a few more videos of other vehicles that we we I'm sure we don't have time to uh To do much of that So uh this first video was a short one and the second one is a longer version of a uh Of a sailboat that that I that I Did for open sim That uh is all non-physical and yet it has all sorts of of features like it's a sailboat that has leeway Meaning that when when it's not sailing the wind blows it down wind It has a healing which means that it the the boat tips over And it tips over in a different direction than the sailboat in the In the the physics vehicle api Because I think the physics api is is wrong that it always has the boat Tilting um, actually, I'm not quite sure where it's tilting it My boat is tilting in the direction of the lift vector of the sail and I don't think that's how the uh the the boat Script in the physics api does it And so I'm really really proud of that of that vehicle So I took a version of that vehicle and put it in the sandbox and I reprogrammed it to sail on terrain And so you could go to the sandbox and try that out And I also stuck in the in the sandbox here a um, uh, a physical a non physical Wheeled wheeled vehicle that you can jump on and drive around And that is uh, just about the end of the talk. I've found that well one one more point is that In my case, I would love to get all the memory back from the From the physics engine and I could replace it with just a a handful or a half a handful of Vehicle scripts that don't use physics and use set keyframe motion instead So the only remaining thing that the physics engine does for me is that it does collisions And so I'd like to have a collision engine and I'd be willing to share that information with the physics engine if it needed it But I don't even need that physics engine so you can go to uh Oh and that would that this slide was for what I was uh was was just saying about I need a collision engine instead of a of a physics engine And my last slide Is uh some links to to find me I have a Booth in the in in the expos Expo it's written down on the slide for uh Booth 22, but it says ocean engineering on it Uh, and if you go there, I have some uh some freebies to give away I've got a full perm versions of some uh cast ray Non-physical weapon scripts. I have uh my my zero leg holiday lights, uh, which is uh just A way of making blinking lights without without even using a script A lot of my stuff like the sailboat is already for sale at on on the kitely market I have uh things to play with in the sandbox. I mentioned the sailboat and the the vehicle Uh the the the all-terrain vehicle that all-terrain vehicle is much more fun on rough terrain because it it bounces and tilts and And it's it's like the real thing of being bounced around on on rough terrain And also there I have uh some non-physical weapons to try out. There's a couple of these Uh target blimps that you can shoot down with various different weapons Hey, thank you kayaker. We had a question come in from gamisa Um physics can it be killed via open sim dot i and i and did you try it? Uh, I haven't tried it yet. Uh, I've been curious to find out there. There's a there's something called basic physics And uh, I wonder if that is is what I want except of course what I want is is more notifications And so in my spare time and I like to say that I have uh some spare time scheduled for 2028 and uh And I have uh 1,876 other projects to do in the meantime And so I have I I I I'm kind of embarrassed to say Yes, I would like open sim to have better notifications of collisions And no, I haven't sat down and learned uh c plus plus or c sharp to uh to contribute And do that uh myself And so uh, that's something that that I might be able to do and I haven't Found the time yet to do projects like that Well, thank you kayaker and you'll notice in the chat professor fish and grand mills Several of them have some more to discuss on that So I want to point out that he is on oscc expo zone three in booth 19 Unfortunately, I can't go and hang out there because I have to run off to my next meeting soon That's okay. Thank you kayaker for a terrific presentation as a reminder to our audience You can see what's coming up on the conference schedule at conference dot open simulator dot org Following kayaker session the next session will begin at 4 p.m In this keynote region and it's entitled an educator's approach to developing usable prototypes for serious games in open simulator Also, we encourage you to visit the oscc 17 poster expo in oscc expo three region To find accompanying information on presentations and to explore the hyper grid tour resources In oscc expo two region along with the sponsor and crowd funder booths Located throughout all of the oscc expo regions. Thank you again kayaker and thank you audience