Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1370252 Posts in 64449 Topics- by 56501 Members - Latest Member: liquidpigstudios

December 09, 2019, 01:46:09 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsGearBlocks - Build working physics based machines and mechanisms [DEMO]
Pages: [1] 2 3 ... 9
Print
Author Topic: GearBlocks - Build working physics based machines and mechanisms [DEMO]  (Read 23905 times)
dangersam
Level 1
*



View Profile WWW
« on: August 22, 2013, 09:19:30 PM »



GearBlocks is a game about creative building, physics based machines, and gears - lots of gears.



GearBlocks is a sandbox construction game where you build all things mechanical: cars, trucks, cranes, lifts, planes, quadcopters or anything else you can think of.  Want your car to have working steering?  Build all the steering linkages and hook up the rack and pinion gears.  Want it to have a functional drive-train with a differential?  Put it all together with gears, axles and a motor.

Once you’ve made your construction, share what you’ve built with your friends, try out what others have made, and maybe learn a new building trick or two along the way.

Pillars of the game:-

  • 1. Creative building.
  • 2. Interactive working machines & mechanisms.
  • 3. Community & sharing.



Key Features

The game is still in early pre-alpha development, so many of these features are still in progress or not available yet.

  • Hundreds of parts to build with (blocks, wheels, axles, gears, motors and much more).
  • Intuitive and flexible first person building system.
  • Physics based mechanical elements that behave very much like their real world counterparts.
  • Damage system that lets you smash your constructions to smithereens.
  • Creative game mode: ultimate flexibility to build and test your creations, and then share them with others.
  • More game modes planned, will be announced soon.



Pre-alpha Playable Demo

Build 0.5.7273 for Windows


Get More Info

Right now it's a team of one making this game, just me (there's no "I" in team, but there is a "me"? Smiley)  You can find me here: @dangersamn



Pick your poison:-




Original Post

Hey everyone, finally getting around to starting a devlog!

I'm making a physics based open world construction game where you can build pretty much whatever you want - buildings, machines, vehicles, etc.  I'm taking inspiration from Garry's Mod, LEGO Technic, Minecraft, and a lot of the construction / exploration / crafting games that are coming along now.  One of my key motivations behind this project was to make an experience that is as open as possible, allowing players to be totally creative, and not constrain them to only be able to build certain things.



Currently it's still just a sandbox "toy", but my plan is to add game mode(s) that will make it into a proper game, I'll expand on my thoughts on this in a later post hopefully.








A summary of what I've done so far:-
  • The first attempt at the core construction mechanic.  Everything happens in the first person view, you build by picking up parts, bringing them in contact with others, and their position and orientation then snaps into place appropriately.
  • A small selection of parts that you can build with.  The most basic being beams and plates that lock together rigidly.  Then there are axles that attach to beams and can rotate, wheels and gears that attach to axles, a motor that drives axles etc.  Each type of part can have a behaviour (motors apply torque to axles, gears transfer torque to their neighbours, propellers generate thrust when rotated, a seat will lock the player into place when activated, lights turn on and off, and so on).
  • Part behaviour controls.  When you've built a construction, you can then interact with it to make it do stuff.  For example, you can map key presses to activate motors, allowing things like building a car that you can drive around.
  • Basic networked multi-player, you can create a server and build stuff with other players.
  • Simple inventory, holds the parts you currently have, and used to spawn them into the world.
  • Basic save game support, you can save out the world state including all the constructions you've built, and load it back in.
  • Procedurally generated island to build on and explore, the terrain is generated from a seed string that you can type in or generate randomly, so there are essentially an endless number of islands to play on.

Here's an old video that's a bit out of date, but it gives an idea of how the construction process works:




I have a playable demo build that I keep updated regularly: https://dl.dropboxusercontent.com/u/157530041/GearBlocksDemo.html

I've been keeping a dev blog since the start: http://dangersam.tumblr.com/, from now on I'll try and keep both of these updated, but it covers things in a bit more depth if you're interested.

Right now it's just me working on this project, all art is very much place-holder, and progress is slow!  Oh yeah, and I still don't have a name for the game yet, anyone got any suggestions? Smiley  Thanks for reading, and I welcome any feedback.
« Last Edit: December 05, 2019, 09:03:10 PM by dangersam » Logged

Dawmino
Level 0
**



View Profile
« Reply #1 on: August 22, 2013, 10:18:38 PM »

I'm imagining something like the Incredible Machine. You're given a limited selection of pieces and have to build something to solve the "puzzle". Is that what you're going for? Making gameplay around these kinds of things is a challenge, but there's always a way. I mean just look at Kerbal Space Program. That's a great example of a game where building is its own reward.

This has potential and I'd like to see where you go with it.
Logged
dangersam
Level 1
*



View Profile WWW
« Reply #2 on: August 23, 2013, 11:38:19 AM »

I'm imagining something like the Incredible Machine. You're given a limited selection of pieces and have to build something to solve the "puzzle". Is that what you're going for? Making gameplay around these kinds of things is a challenge, but there's always a way. I mean just look at Kerbal Space Program. That's a great example of a game where building is its own reward.

This has potential and I'd like to see where you go with it.

Thanks DaCo!  Yeah, something along the lines of what you're suggesting is definitely one possibility.

I was thinking it could work a bit like Junkyard Wars / Scrapheap Challenge if you ever saw those shows, where each player (or team of players) is given a set allocation of parts and they have to build something to achieve an objective (e.g. build a car then race to a checkpoint, or build a tank then try and destroy the opposing teams tank, or make a catapult and see who can fling stuff the furthest, and so on).
« Last Edit: April 07, 2016, 08:32:35 PM by dangersam » Logged

dangersam
Level 1
*



View Profile WWW
« Reply #3 on: August 23, 2013, 11:47:50 AM »

Following on from the introductory post, I thought I'd go through what I think needs improvement right now.  The main things that need work are:-
  • Construction mechanic - I really like the basic idea of putting parts together in a first person view, but there are big problems with my current implementation, such as (among others):-
    • It's hard to position and orientate parts accurately.
    • Once a part is attached, you can't adjust it's position without detaching it and reattaching.
    • There are cases where jointed things (like blocks and axles) only attach properly if you put them together in a certain order.
    • It's possible to attach parts which results in them inter-penetrating.
    • And yes, if you're on a slope, parts can roll away from you as you're building, very annoying! Smiley
    I basically need to bite the bullet, rip out the current stuff and rework a lot of it.  My plan is to scrap the current implementation which uses contact points calculated when the player touches one part to another to determine attachment positioning and orientation.  Instead, I think I'll use the contacts only initially to determine which two parts to consider for attachment and then switch over to a different control scheme to actually position the part.  The details of this I still need to work out.
  • Player stuff - improve first person controls and camera, physics interaction, add player's arm holding some kind of construction tool, etc.
  • Networked multi-player - implement client side input prediction, optimise state sync / RPC usage to reduce bandwidth, make a dedicated server.
  • Construction parts - add more types of parts to build with, to expand the scope of what can be constructed.

If you get a chance to check out the build (https://dl.dropboxusercontent.com/u/157530041/WebPlayer.html), I'd be really interested to know how you find the process of building stuff in the game!
Logged

Eigen
Level 10
*****


Brobdingnagian ding dong


View Profile WWW
« Reply #4 on: August 23, 2013, 11:56:15 AM »

Awesome! Addicted

Is your player grounded or is it a free-flight camera? Make it so that you can't just float around and in order to build something tall you first need build stuff to climb higher. Ladders, lifts or whatever. That would be cool I think. So to build a tower you first need to figure out how the get parts all the way up there, and puzzles like that.

edit: So I tried building stuff a bit. The snap tool is a bit finicky. Sometimes the highlight appears and disappears by moving the mouse only a couple of pixels. Rotating and aligning pieces is pretty difficult and takes a while to get used to. I tried building a vechicle but it kept rolling down the hill. So I just jumped on and got the ride of my life. That was a lot of fun! Smiley
« Last Edit: August 23, 2013, 12:10:30 PM by Eigen » Logged

rundown
Level 5
*****



View Profile WWW
« Reply #5 on: August 23, 2013, 02:19:48 PM »

Will there be a way to control multiple engines with one button eventually? I can see this being a problem for your liftoff with your quadcopter. This way the proppellers would equally lift you up at the same time.
Logged

dangersam
Level 1
*



View Profile WWW
« Reply #6 on: August 23, 2013, 03:28:54 PM »

Quote
Is your player grounded or is it a free-flight camera?
Right now you're grounded, there's no free-flight mode.  I agree that it's kinda cool that you have to build up to climb higher, and then build further.  Mind you, as it is right now you could just build a tower horizontally on the ground, then pick it up and set it upright. Smiley

Quote
edit: So I tried building stuff a bit. The snap tool is a bit finicky...
Totally agree, all the issues you mention have been bugging me too for a while now.  Overhauling the construction mechanic has to be my next step I think.  Thanks for the feedback!

Quote
Will there be a way to control multiple engines with one button eventually?
Yep, actually you can do this now by mapping multiple motors to the same button (and turning them all on).  That way you can get all the quadcopter props to lift at the same time.  The problem is it's unstable and eventually will tilt over, and there's no way to steer it.  I need to figure out a way to provide better control!
Logged

PeteDevlin
Level 0
***


View Profile
« Reply #7 on: August 24, 2013, 01:40:19 PM »

The problem you will have here is differentiation; why do I need to play this when I could fire up say Garry's mod, Kerbal Space Program or even minecraft?

I applaud your work to date, so hopefully you can find the particular niche that makes your idea compulsive to try out.
Logged
dangersam
Level 1
*



View Profile WWW
« Reply #8 on: August 25, 2013, 03:28:26 PM »

The problem you will have here is differentiation; why do I need to play this when I could fire up say Garry's mod, Kerbal Space Program or even minecraft?

I applaud your work to date, so hopefully you can find the particular niche that makes your idea compulsive to try out.

Thanks GameTheory!  I'm hoping part of the differentiation (at least from Garry's Mod) will come from making the construction a bit more user friendly and approachable, assuming I can achieve that.  But yeah, I agree, most importantly it needs a concept that will set it apart from other similar games, I have some ideas, but definitely something I'm still working through...
« Last Edit: April 07, 2016, 08:33:28 PM by dangersam » Logged

CryingGhost
Level 0
**


gomennasai


View Profile
« Reply #9 on: August 25, 2013, 08:03:22 PM »

So far it looks really cool! As for direction I think it would be cool if you had several different gamemodes all based around the building mechanic. The main trouble with this would be making sure each gamemode has enough depth. You'll probably have some work to do design wise so that your game is dynamic enough and interesting enough to keep people coming back. If you can achieve that though I think you would have a really stellar game on your hands! Grin

For now though just keep working on that building system  Wink
Logged
icompose
Level 0
**


View Profile
« Reply #10 on: August 29, 2013, 04:30:50 PM »

This looks really addicting, can i do the music for it?
Logged
diegzumillo
Level 10
*****


This avatar is so old I still have a some hair


View Profile WWW
« Reply #11 on: August 29, 2013, 05:04:22 PM »

We can never have too many of these games. I'm curious to know what game modes you have in mind.
Logged

dangersam
Level 1
*



View Profile WWW
« Reply #12 on: September 02, 2013, 01:33:56 PM »

Ok, I'm going to follow up on game modes a little bit and brain dump my thoughts so far on this.  The problem with allowing players to build whatever they want is that it's a little tricky to directly measure player progress, or to even define what it means to progress through the game.  Whatever game mode(s) I come up with need to be flexible enough to allow players to come up with different solutions to the same problems.

I have a few vague ideas so far:-
  • Challenge mode.  For each challenge the player is given a set allocation of parts and they have to build something to achieve an objective.  I think objectives with fairly simple outcomes (that could be measured in terms of times, distances, speeds etc.) would work best for solution flexibility.
  • Survival mode.  This would be along the lines of Minecraft and other similar games, where you gather resources, craft parts, and then build things with them that help you survive.  For the survival aspect you'd probably need NPC creatures (which can be killed for resources, but can also attack the player and can damage your constructions), or maybe you're just surviving against hunger and the environment (sun, weather, etc.)
  • Escape mode.  This would combine aspects of the above two ideas.  Essentially, while trying to survive, you'd be building things to complete challenges at various places in the environment, which would somehow gradually build up to allow an "escape" from the island you're trapped on.  It would give a reason to explore, and an end goal to work towards.

I'm not sure yet what direction I'll end up going with, but right now I'm most intrigued by the third option, so I'm gonna try and expand that idea a little more.  In the meantime, any thoughts / ideas are welcome!
Logged

dangersam
Level 1
*



View Profile WWW
« Reply #13 on: September 13, 2013, 05:53:58 PM »

Construction Improvements - Freezing

In the first step towards overhauling the building game mechanic to make it easier to use, I have changed the controls a bit.  Now, you have to “freeze” a construction before you can attach other parts to it.  You do this by holding shift and left clicking, either when highlighting a construction with the cursor, or when a construction is selected (i.e. picked up).  In either case, it gets frozen in place (with a blinking bounding box outline to indicate that it’s currently frozen).  Shift + left click again will unfreeze, as will selecting it.

Because you can pick up a construction and then freeze it, it can be frozen in any position & orientation, making it easier to modify less accessible areas, as in this example:-



In addition, when a construction is frozen, any parts that freely rotate with respect to each other (e.g. blocks and axles) are reset to a default orientation that realigns everything within the construction.  For example, you can see in the image above moving parts such as the wheels, gears, and steering beam are all aligned at right angles to the rest of the construction.

Right now, the main benefit is that it prevents stuff rolling away while you’re trying to build!  However, the plan is that it will also allow me to improve the part snap-to behaviour and make positioning & orientating parts easier.  More on this soon hopefully!
Logged

dangersam
Level 1
*



View Profile WWW
« Reply #14 on: November 11, 2013, 05:38:16 PM »

Wow, it's been a long time since my last update!  I've been locked away working on the building mechanic for the last couple of months, but now I finally have something new to share.  After the construction freezing stuff that I posted about before, the next step was to work on how the player positions, aligns and attaches new parts to a frozen construction.  The implementation I had in place for this (dating right back to the beginning of the project) was clunky and difficult to use, and was in need of a major overhaul.

Over the past two months I have been prototyping many different ideas for alternative solutions.  It has been a challenging and frankly frustrating experience, because every method I tried seemed to have its own pros and cons, and no single idea jumped out as the "correct" way to go.  It's not been an easy problem to solve, but I have now settled on what is hopefully the least worst solution!  I think with further refinement it can be made to work quite nicely, certainly it's already much better than what I had before.

Original method

The original implementation I had for alignment and attachment was done just using physics collider contacts.  You had to position your selection, so that it touched the frozen construction roughly where you wanted it to attach, and it would snap in place based on that.  The problem was that you had to be very precise with the positioning in 3D space, otherwise things might not contact where you wanted.

Rejects and epic fails

To try and help positioning the selection, I tried various ways of aligning it to a plane oriented relative to the frozen construction.  This helped a bit, but it was clear that manoeuvring stuff in 3D space with high precision was still gonna be too fiddly.  I decided that more of a screen-space approach was needed with smarter, more automated alignment.

Unity's physics system can sweep a rigidbody through the world, determining which colliders it would contact.  I tried using this to sweep test your selection away from you in the direction you're looking, to see where it might contact a frozen construction.  But because the test is done in world space, not the perspective space of your POV, it felt weird and I couldn't really find a way to make it work.

So then I tried raycasting from your view position through every attachment point of your selection, to find intersections with a frozen construction, and use these results to determine where to position / align for attachment.  This had potential to work well, but simply required way too many raycasts for reasonable CPU performance.

One last raycast

In the end for the final solution I decided to keep it simple, I now do a single raycast through the screen centre to find an attachment point on a frozen construction.  The selection point (position of the cursor relative to the selected construction) is used to find an attachment point on the selected construction.  These two attachment points are then used to snap the selection into alignment.  The effect of this is that the point where alignment is happening is always right under your cursor at screen centre which is quite nice from a usability perspective.

This approach had a problem however - you could only align relative to a single point on your selection!  Rather than having to drop it, and pick it up again at a different point, I wanted the player to be able to move their selection underneath the cursor.  So now when aligning a selection to a frozen construction, by holding shift and using the directional keys (i.e. WASD), you can do exactly that.

Next steps

After all the prototyping, some of the code has ended up a bit of a mess, so first I need to clean that up.  After that there's a bunch of further work to the construction mechanic that I need to do:-
  • Selection movement improvements - as I mentioned, you can now move a selection relative to the cursor using shift + WASD, but it's still a bit clunky and needs some work.
  • UI / visualization - now that the core mechanic is close to being done, I need to add some visual feedback during construction, as (unless you've memorized the controls ahead of time!) it's hard to figure out how it all works.
  • Part multi-select on a frozen construction, selected parts can then be picked up for re-positioning, cloning, or deleting.
  • Ability to flip block to axle connections between rigid and hinged, post attachment.
  • Various bugs and other minor issues.

Once I have some basic UI / visual feedback elements in place, I'll put together a video to demonstrate the new building mechanic.  In the meantime feel free to try it out in the build: https://dl.dropboxusercontent.com/u/157530041/WebPlayer.html
Logged

dangersam
Level 1
*



View Profile WWW
« Reply #15 on: November 20, 2013, 07:53:26 PM »





Glowing highlight

I’ve just replaced the old construction highlighting (line drawn bounding boxes) with a new glowing outline effect.  When a construction is selected it glows blue.  Then, when aligning it to another construction, the colour changes to green if the attachment is valid, red if not (i.e. if parts are interpenetrating).  Constructions also glow blue when they’re frozen.

More UI / visualisation improvements coming soon hopefully...
Logged

dangersam
Level 1
*



View Profile WWW
« Reply #16 on: December 06, 2013, 10:41:36 PM »



Energy beam

Over the last couple of weeks I’ve mostly been doing code cleanup and bug fixes, so there’s not much new to show.  I have added a new energy beam effect though, for when you have a construction selected.  It’s a first stab at it and still needs some tweaking, but it works pretty nicely.  Once I add the construction tool held by the player, the beam will emanate from that, but for now it comes from just below camera.
Logged

dangersam
Level 1
*



View Profile WWW
« Reply #17 on: January 10, 2014, 12:39:28 PM »

Construction controls walkthrough

The construction game mechanic is getting close to being finished now, barring a few minor tweaks here and there, so I’ve made a video to demo how the controls work to position, align and attach parts together.



« Last Edit: December 22, 2015, 09:18:31 PM by dangersam » Logged

dangersam
Level 1
*



View Profile WWW
« Reply #18 on: February 19, 2014, 02:42:16 PM »

Apologies for the lack of updates of late, I've been struggling with physics stuff for a while, and I also had a pretty bad flu a few weeks ago which slowed me down a lot!  However, I've now finally made some good progress on the physics front, much improving the way gears and motors work.

Gears

For the gears to work, we want neighbouring gears rotate in sync with each other, taking the ratio of their respective diameters into account.  My old implementation for this synced neighbour gear's angular velocities, but didn't sync angular displacement (so gears would slip under high torque loads), and didn't take rigid body inertia tensors into account (particularly noticeably wrong with gears that were part of rigid bodies with large moments of inertia).

The proper way to do this is to have a physics constraint that forces the angular velocity and angular displacement to stay in sync.  Unity comes with a configurable constraint (or joint), which is almost flexible enough for what I need, except that you can't specify any kind of gear ratio.  PhysX 3.X supports custom constraints, but Unity is still using an old version of PhysX (2.8.3 I think).  So I had to implement my own constraint, which gets applied in FixedUpdate to modify rigid body angular velocities.  This works OK for the angular velocity part of the constraint, but because I don't have access to the internal physics update code, I found it problematic for syncing angular displacement.  This is because Unity doesn't provide the current total angular displacement of a rigid body.  I attempted to track it myself, but because I don't have direct access to the changes made by the physics update, it was not accurate.  So instead, over every update, I accumulate an angular displacement delta between the two rigid bodies using their respective angular velocities, and then use that to apply a correction back to their angular velocities.  This isn't as good as syncing the angular displacements directly, as it means the gears still slip under high torque loads, but they do eventually correct themselves with a kind of delayed "springyness".  At least now they won't slip indefinitely, so it's certainly better than my old implementation!

Motors

As Unity physics doesn't "know" about my gear constraint that is modifying angular velocities outside of the main physics update, the built in joint motor no longer worked properly.  So I had to implement my own motor constraint (which was pretty simple because it only constrains angular velocity, not displacement).  An added bonus to doing this was that it gives me much more control, and I was able to add a torque curve that makes the motor behave more realistically, and can be customised for all different kinds of motor.

Also, now that the new gear constraint properly accounts for rigid body inertia, I was able to increase the motor torque to a much more reasonable level, and have it behave consistently regardless of whether gears are part of large or small rigid bodies.

Well, that's it for now, these changes are now in the playable build: https://dl.dropboxusercontent.com/u/157530041/WebPlayer.html.  Hopefully they'll allow you to build more complex and interesting machines!
Logged

hogge
Level 0
***


View Profile WWW
« Reply #19 on: February 20, 2014, 07:35:42 AM »

I find the tools frustrating to use, but the end results seem really awesome.
Perhaps if you could generate a more interresting world, this could be even better Smiley
Logged

Pages: [1] 2 3 ... 9
Print
Jump to:  

Theme orange-lt created by panic