Tom Atom Posted April 5, 2017 Share Posted April 5, 2017 Hi, just another game made for Gamee was released - Brick Stacker. Your aim is to build as high pile of bricks as possible. You can play it here: https://www.gameeapp.com/game/zxyM4Kb (it is better to run it on some device with portrait screen) Umz and old_gamer_adam 2 Quote Link to comment Share on other sites More sharing options...
spinnerbox Posted April 5, 2017 Share Posted April 5, 2017 Good time waster. Quote Link to comment Share on other sites More sharing options...
NumbOfAthma Posted May 1, 2017 Share Posted May 1, 2017 Nice one, trying to build a game like this myself but I'm still struggling with the p2 :)) I was wondering how do you check the balance of the brick tower? Quote Link to comment Share on other sites More sharing options...
Tom Atom Posted May 5, 2017 Author Share Posted May 5, 2017 @NumbOfAthma - problem of physics engines is in how they work. If you have two bricks - one on top of other, then gravity sinks upper brick into bottom one. Physics engin then solves this penetration and repels birck from each other to restore position befeore they started to penetrate. But it can happen, that another new penetrations may appear (with floor, other bricks on side, ...) For this physics engines usually have several iterations for solving positions per frame. Problem is, that with pile of bricks you have really lot of interactions betwwen them. With 5-6 bricks, that should stay still, usuall number of iterations per frame is not enough. Bricks start to strangely slide on top of each other and so on. When bricks are falling and should bounce from each other, then everything is OK, but not when it should be static and stable... so I had to come with another solution... Fortunatelly, I drink a lot of tea! It has no impact on my skills, but I have lot of empty boxes, that look like brick Simply, when will such brick fall off your table? When more than half of it is over edge. If brick above is too much left over edge or too much right (see first row on picture) it will fall. Then I used boxes do simulate more complex situations and I found, that for game it would be enough to take brick N and: take all bricks above current brick and sum their parts to the left and to the right from edge of brick N. See second row. On series of pictures on right you can see increasing tower one by on. In step 1 and 2 brick is still OK, because more of the mass is still above bottom brick. When 3rd brick is dropped, mass on right is higher then on left and all three bricks will fall. I do this check for every brick in pile - always suming all bricks above it as described, because point of break can be at different places. This is fake physics, but it looks good. When I find point of instability, I rotate upper part of tower around it by 5-10 degrees and then I switch bricks that should fall into P2 objects to just let them fall nicely. Because it is already rotated and gravity continues fall immediatelly, it does not suffer from looking like elastic soft bodies (which would if it was not rotated ... because of interactions - iterations problem above). Next thing: only visible part of tower is calculated - it would be unfair to break it two or three screens below display when player can not see it. Tower below screen is just recorded - no actual bricks are there. When game ends and camera scrolls down, sprites for bricks are placed at correct positions according to recorded data. old_gamer_adam, Taz and NumbOfAthma 3 Quote Link to comment Share on other sites More sharing options...
NumbOfAthma Posted May 6, 2017 Share Posted May 6, 2017 @Tom Atom Duuuuudee! Thank you very much for taking your time to write such a post! I really appreciated it! I'll give it a try and let you know how it works! Thank you again! You are awesome! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.