Mythruna

Development => Blog => Topic started by: pspeed on December 09, 2018, 07:29:00 AM



Title: Big Foundational Progress
Post by: pspeed on December 09, 2018, 07:29:00 AM
As many of you may know, one of the core requirements of Mythruna is a physics engine that can handle an infinite world and block objects.  The "infinite world" thing turns out to be quite tricky... and we essentially impossible to thread into the existing engine.  That's why some time ago (commit history seems to indicate 2+ years ago), I start taking a different approach.

The theory behind the approach was that it would be easier to build a block world game on top of a solid infinite-world capable networked physics engine than it would be to try to integrate such a beast into an existing game.  Because I already failed at that twice.

Also given that my available time comes and goes, I need to avoid giant monolithic things wherever possible.

So I came up with the approach to start building small libraries that someday might be open sourced.  For example, block-based geometry would be one, a generic zone-based physics engine another, layers to network and integrate those another, and so on.  Let me say that just splitting it up like that was not without its own design challenges... but they are totally worth it in the end because each piece is separately testable.

For example, out of that I was able to build a simple BlockEd application for making 3D block sprites that my kids and I could use in game prototypes.  Also, the physics engine was initially testable with just simple sphere and cube primitives on a simple ground plane.  It was the better part of a year just to get the 'zones' working to support the infinite world part.

I wish I had videos of all of that but I did post some imgur links at one time.
(https://i.imgur.com/7SZD6la.png)

Culminating in block shape integration here:
(https://i.imgur.com/uyHDBp9.png)

Since Thanksgiving break, I've been trying to shore things up and integrate all of that with the SimEthereal open source networking library I created way back.  (Over the spring/summer I took a break to try to create a demo FPS with another developer but he got busy doing other things.)  I took Thanksgiving week off and did some major coding which included:
* patching and releasing updates for all of my active open source projects for the JME community
* finally integrating the physics engine into an Entity System (ES).
* starting the network demo that ties blocks, physics, ES, etc. together

Post-Thanksgiving, I've been trying to put an average of an hour a day into continuing to move things along.  (One of the nice things about smaller, easily tested, pieces.)

Well, this weekend I finally have something working end to end.  Don't get me wrong.  Some of this is duck-taped together and much of it needs a LOT of cleanup... but the hardest integration parts are done and working.

Here is a video:
https://www.youtube.com/watch?v=6JlVCa0641w

I'm really excited to have this working.  I'm not sure you even know.   (It may not be obvious from the video since I clicked "Single Player" but it's actually running an autowired server and client.  At least for now, single player is a networked game that creates a local hosted game and automatically logs you into it... keeping me honest.)

Next will be cleaning this up.  Figuring out what I can remove to trim it down to the essentials, etc... but it feels so good to have a working foundation to iterate upon.

I hope over Christmas break that I can get to the point where I feel like I'm directly implementing Mythruna again.

Note: if you don't follow @MythrunaGame or @Simsilica on twitter but want to stay the most up-to-date on progress, that's where I'm most likely to post stuff until I start having more official announcements again.  I'm cautiously optimistic about 2019... but don't let the universe hear me saying that.

P.S.: the daily chart mentioned http://mythruna.com/forum/index.php?topic=2373.0 (http://mythruna.com/forum/index.php?topic=2373.0) is certainly working.


Title: Re: Big Foundational Progress
Post by: pspeed on December 09, 2018, 07:33:28 AM
Other random stuff I posted to twitter and elsewhere:

A quick-and-dirty temporary "person" sprite created in BlockEd so I could test "upright drivers" for the physics engine... ie: a component that can be associated with physics objects to keep them upright or in more advanced cases walk them around, etc..
(https://imgur.com/CFBGRjv.png)

Here it is with the upright component implemented.  "Business... business... business..."  "My card!"  "business... business..."
(https://imgur.com/0bD5POX.png)

Objects in a sine-wave world... world collision test:
(https://imgur.com/8ZstWyY.png)


Title: Re: Big Foundational Progress
Post by: Michael on December 09, 2018, 03:49:55 PM
Fancy. It's been a journey surely, and I'm glad your daily chain has been working for you.


Title: Re: Big Foundational Progress
Post by: Sean on December 10, 2018, 06:42:18 PM
I'm glad you're developing in a way that best suites your schedule. Also seeing those guys flopped on the floor in a shrugging position is some /r/meirl material.


Title: Re: Big Foundational Progress
Post by: Rayblon on December 12, 2018, 12:59:44 PM
I'm glad you're developing in a way that best suites your schedule. Also seeing those guys flopped on the floor in a shrugging position is some /r/meirl material.

I want this to be a spell.

It just petrifies people into an eternal shrug.


Title: Re: Big Foundational Progress
Post by: pspeed on December 27, 2018, 12:51:08 PM
I'm glad you're developing in a way that best suites your schedule. Also seeing those guys flopped on the floor in a shrugging position is some /r/meirl material.

I want this to be a spell.

It just petrifies people into an eternal shrug.

Heheh.  I suspect it won't be as funny with "real" models... so maybe part of the spell is turning them into boxy minecraft-style men.


Title: Re: Big Foundational Progress
Post by: Rayblon on December 27, 2018, 04:48:39 PM
I'm glad you're developing in a way that best suites your schedule. Also seeing those guys flopped on the floor in a shrugging position is some /r/meirl material.

I want this to be a spell.

It just petrifies people into an eternal shrug.

Heheh.  I suspect it won't be as funny with "real" models... so maybe part of the spell is turning them into boxy minecraft-style men.

Oh yes.

Real talk, gag magic would be amazing. Nothing useful or dangerous, but amusing or mildly annoying to the recipient at worst.


Title: Re: Big Foundational Progress
Post by: pspeed on December 27, 2018, 05:19:00 PM
Oh yes.

Real talk, gag magic would be amazing. Nothing useful or dangerous, but amusing or mildly annoying to the recipient at worst.

Heheh... a spell you can cast on someone so that everyone they see looks like stiff block models for some period of time.  Ultimately mostly harmless... but potentially hilarious, too.


Title: Re: Big Foundational Progress
Post by: Rayblon on December 27, 2018, 07:19:08 PM
Oh yes.

Real talk, gag magic would be amazing. Nothing useful or dangerous, but amusing or mildly annoying to the recipient at worst.

Heheh... a spell you can cast on someone so that everyone they see looks like stiff block models for some period of time.  Ultimately mostly harmless... but potentially hilarious, too.

A wonderland spell that makes monsters look like teddy bears and candy. Dying is just you getting hugged and falling asleep.

Or a spell that turns the target's head into a giant nose, allowing them to sneeze as an attack.

The possibilities!


Title: Re: Big Foundational Progress
Post by: ebag51 on December 30, 2018, 01:58:33 PM
Here's hoping next year we see a Mythruna update,


Title: Re: Big Foundational Progress
Post by: pspeed on December 30, 2018, 02:40:20 PM
Here's hoping next year we see a Mythruna update,

Wouldn't it be nice.  I'm still waiting to play Fallout 4 since I set a goal for myself to do before I could play it... and a) I still haven't reached it, and b) I'm stubborn and refuse to give up.

For those reading this deep who somehow don't subscribe to my youtube channel or twitter feeds:
https://www.youtube.com/watch?v=-euRO21tnlI
..and from just now:
https://www.youtube.com/watch?v=TCM47feUkUc

I really did hope to be making forward progress today instead of fixing old progress... but progress is progress, I suppose (assuming I can find the issue).


Title: Re: Big Foundational Progress
Post by: pspeed on January 09, 2019, 04:42:11 PM
A week late follow up to that "funny" physics bug.  It's especially interesting because that video got more traffic than most of my videos so now I'm always on the look out for other strange bugs I can post videos of.

Anyway, that particular physics problem has been fixed:
https://www.youtube.com/watch?v=YOU2m1r3-ME

And is further re-enforcement of the approach I'm taking.  I would never have been able to solve this if the physics engine was fully integrated with a giant game engine.  I currently have three versions of the test harness that will be part of the open source release someday:
-one raw physics engine example with all kinds of detailed debugging visualizations and features (like being able to pause physics and single step, etc.)
-physics engine example that is integrated with the entity system. 
-physics engine example that is integrated with the entity system and the networking layers

Fortunately, I was able to go back to the first one where I have lots of nice debugging stuff and see some strange behavior.  For one thing, hitting the ship with the ball in single-step showed that the ship was bouncing away from the ball... and the ball would continue forward.  For a 10,000 kg ship and a 20 kg ball, that shouldn't really happen, eh?  You'd expect the ball to bounce off without hardly moving the ship at all.

Looking further into the physics calculations, the issue is that all of the inertia was being swallowed up by rotation.  There was none left to bounce the ball back... or conserve the position of the ship for that matter.

So as I guessed when I posted the video, the issue was likely due to the inertia tensor... which I'd left as a default value. 

For those not up on physics, there is probably no easy explanation but an inertia tensor describes how an object will tend to rotate when pushed in different places.  If you think of a broom as an example, it is easy to see that the broom will want to rotate really easily around the handle but not very easily in the other long-wise directions (though easier along the broom's flat axis than otherwise).  So if that broom were floating in space and you pushed on the outside bristles, it's more likely that most of your push would go to spinning it rather than flipping it end-over-end.

...plus, it turns out that the mass of the object will of course change its inertia tensor.

I spent last Monday teaching myself about inertia tensors and the math necessary to calculate them from a bunch of cubes.  In the end, it's reasonably straight forward even if none of the online docs explained it well.  5-6 web sites later and I had an approach and some code.  Because these are stand-along libraries, it was really easy to write some automated tests that test just these things.  So I was able to iterate very quickly.  I even tested it against some inertia tensor formulas for ideal solids like cubes and got the exact same answers... which made me immensely happy.

Bottom line is that now objects behave better... but especially giant heavy oddly shaped objects like sailing ships.

Even the chairs behave more like chairs now as they are a little back heavy as they should be.  1,000,000 more things to do but progress is progress, as said before.

Bonus pic... because my vacation was winding up and I had no 'quick' projects, I added .obj export to the Block-Ed tool so that I could 3D print objects created there.  So here is the ship:
(https://i.imgur.com/sc6VuJO.jpg)


Title: Re: Big Foundational Progress
Post by: Rayblon on January 14, 2019, 12:32:24 PM
A week late follow up to that "funny" physics bug.  It's especially interesting because that video got more traffic than most of my videos so now I'm always on the look out for other strange bugs I can post videos of.

It was probably popular because watching you throw a marble into a ship and causing it to have a seizure is hilarious. ;)