Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

2D Physic game / sandbox with drawing

edited July 2012 in General Posts: 436

Hi, i was working in this prototype:

The source code is here:

https://gist.github.com/3155875

I was wondering if we could use brushes like crayon in stead of solid lines...what do you think?

Tagged:
«1

Comments

  • BortelsBortels Mod
    Posts: 1,557

    That's really neat! I'm gonna grab it and try it now!

  • Posts: 563

    blimey - that is very impressive!

  • Posts: 8

    I quit

  • SimeonSimeon Admin Mod
    Posts: 4,319

    Looks like a lot of fun. Loved the video.

  • edited July 2012 Posts: 436

    Hey!, thank you everypeople! :) I'm glad you liked...
    Well, i'm studying all this new physic stuff in Codea, and I missed some things from the original Box2D, I would need a Rope Joint...

    For example, for a bridge I am using a for loop that builds n bodies and n-1 DISTANT joints, the first and the last bodies I set them to STATIC , so you have a very good looking wood bridge XD

    But for the rope physics...that's another topic!

    See:

    section 8.13. Rope Joint... if you implement this, you can have a "Countre Jour" like game in a few hours...well, I know the rope joint is a relatively new addition to Box2D, so, you can addapt this code:

    Elastic ropes could be used also for fluid dinamycs simulations...
    what do you say people?

  • Posts: 225

    @juaxix, are you a genius or what? ^:)^ Great things you make (I'm stuck for the moment trying to figure out how to produce physical bodies from an emitter, like drops from a nozzle for example b-( ). Interesting idea about using elastic ropes for fluid dynamics simulations... I would like to know more about your idea, if possible :-D
    Saludos ~O)

  • JohnJohn Admin Mod
    edited July 2012 Posts: 359

    @juaxix
    I totally forgot but the ROPE joint should already be in there, I just forgot to document it.

    The syntax is:

    rope = physics.joint(ROPE, bodyA, bodyB, anchorA, anchorB, length)
    

    I used it for this example to do the chain for the vehicle. I actually used one rope joint and a bunch of revolute joints to give the impression of realistic chain movement.

    Here's a link to the code on gist: https://gist.github.com/3167310
    Check out the SlammerPod class to see how it works.

  • edited August 2012 Posts: 436

    Thank you very much @John !!, that is exactly what i was looking for :-)

    I was playing around with this rope but i would like to create a rope like cut the rope, i think it could be made with circles connected with rope joints and filter by category and masks the behaviour of the bodies like you do with the rectangles in your character metal string of rings, but if i want a thing like a pulley!

  • edited August 2012 Posts: 436

    I realized there is no PULLEY joint, following the box2d manual we stop at ROPE.
    I'm figuring how to build a pulley with distant, prismatic and rope joints...let's see where it goes

  • Posts: 436

    Meanwhile I have invented a simple orbit physics with a main static planet applying forces to the bodies around it, take a look:

    Code:

        local x,y = self.base.position.x, self.base.position.y
        for _,b in ipairs (debugDraw.bodies) do
            if b.type == DYNAMIC then
                local grav = vec2(x-b.position.x,y-b.position.y)/2
                b:applyForce(grav)
            end
        end
    

    Video :

    http://yfrog.us/5g8p6kvyhwbvrogpahjixscrz

  • Posts: 383

    A very cool development, @juaxix!

  • Posts: 2,820

    Wow... This is amazing. Looking forward to it's release!

  • Posts: 436

    Thanks all , i am studying water physics and ropes, pulleys, etc, this part is hard, specially when you are ill and have fevers xD

  • Posts: 436

    Just wanna let here the latest art (3+ months ago)

  • Jmv38Jmv38 Mod
    Posts: 3,265

    Very nice!

  • Posts: 674

    Looks superb

  • SimeonSimeon Admin Mod
    Posts: 4,319

    Looks incredible @juaxix. Your intermediary screens (You Won / Lost) are very strange. They look great, just very out of place. Is that intentional?

  • Posts: 436

    Those screens... @Simeon heat stroke this summer in Portugal and Spain and I caught a staph infection, I designed these screens amid the delirium of that heat stroke and heat fevers... Hahaha

  • Posts: 383

    Ha ha @juaxix, they are frightening! Must have been awful to have been sick like that.

  • BortelsBortels Mod
    Posts: 1,557

    I actually liked the win/loss screens because they were weird. :-) they add character.

  • edited May 2013 Posts: 436

    haha, ok, I'm putting all together guys, this game is going to see the light soon...

    Last news...here is some experiments with music and collisions:

    I had to reduce the number of polys for each shape and the points for each poly too,...Polys are now closed using Bezier splines (not lines), also, the box2d engine need some time to be able to gather all the garbage so, to avoid glitches, bugs and crashes you have to allow some ms (0.3s aprox) between each shape created to be destroyed properly, the game now detects if you are creating a poly inside the player ball or inside/around another user shape, these are the extreme cases where the engine goes down so ,i take appart those conflicting objects and destroy it ,in some time after the creation time, then if you want a good framerate you can check the Deltatime, if it is greater than 0.5 this is a bad thing, I take the last poly created and destroy it (logic rule)...
    I had also to reduce the number of particles for almost everything, change animations for simple images and I have started using tweener, omg, now it is so simple to code animations and events with Codea , just amazing.

    I have created 6 worlds with 6 stories and 6 comics with 2 parts, which are presented in the first and the last levels of each world with a mesh + shader technique of background moving using glsl mod() function...so easy, it took me 30min aprox to have this comic thing working hahaha!

  • Posts: 2,820

    This is getting really cool! Looking forward to its release.

  • Posts: 372

    That one looks awesome!!

  • Posts: 436

    Thanks all for your comments.
    Here is a fish I coded yesterday made with mesh api in 3D

  • edited July 2013 Posts: 436

    This is the game version with the fish and the fish level and the cool music just the music has done XD

    Hope @Simeon and @John could finally fix the physics bugs of the box2d engine to be able to publish it in AppStore

  • Posts: 2,820

    Super cool. Nice job. I look forward to seeing it on the app store.

  • Posts: 436

    Thanks @Zoyt , here is the video with 4 of the worlds already designed and running some level samples

  • Posts: 2,820

    @juaxix - Extra cool. I like how you combined lots of the code posted on this forum. Looking forward to it.

  • Posts: 674

    Cool

  • edited August 2013 Posts: 436

    This tutorials series about programming with processing and Box2D are unvaluable!!
    https://vimeo.com/channels/natureofcode/page:1

    thanks to this guy i have coded this game mechanic for the physics game:

  • edited August 2013 Posts: 436

    This is the physics game type (dimension 4th - UFO Dimension) of the planets gravity and so on:

    Here it is the third dimension (droid world),

    with eyes, elastic ropes, ropes, softbodies, water phsyics and other stuff.

    And at finally! i finish the game with the 6th dimension ( hedheog vehicles dimension) with rampages, obstacles, etc.

    Now you can post to twitter and facebook a screenshot with the level result, record a video and save it automatically in your library, ...etc

    Only 7 levels left :)

  • Posts: 1,976

    Out of curiosity...is that my metaball technique?

    The hedgehog dimension looks very close to @Luatee's Splinerider...

    And has nobody else noticed how close this looks to Crayon Physics Deluxe?

  • Posts: 436

    Yes @SkyTheCoder !, the water is a modified version of the metaball technique with some adjustments to improve the shapes and to be able to run in smaller screens (iPhone's).

    And yes, it is @Luate splinerider ,who sent me his code :-)

    All this project began the past year with the inspiration of Crayon Physics, but, the idea was to make something different,...I was searching to make a game that uses box2d physics in Codea, while it can be used to improve the engine, let people learn from the code and, find new ways of entertainment, hopefully I will submit the game this month with the multiplayer part, i'm coding the objective c classes and will post here too, something I have waiting for so long! ;)

  • Posts: 1,976

    @juaxix Yes! I got them all right. :P

    And it seems VERY cool. I would buy this.

  • Posts: 2,024

    @juaxix, holy. That looks amazing, and definitely something I would pay 2 bucks for

  • Posts: 1,595

    @juaxix I love the look of this, @SkyTheCoder stop being a ball buster! ;) I like the crayon look as well, fits in with drawing concept.. I look forward to picking this up from the App Store when its finished!

  • edited August 2013 Posts: 436

    Thanks, this is more than a year of hard work....thanks to people here it is much less pain, finally we can see the end to all this project of bringing all the box2d lib properties in Codea into one game :D

    I have submitted the game with bugs that crashes the whole world XD ... while @Simeon updates the online libs, hope Apple approves it
    :]

    I have upload a video for each level of the 60 in this channel:

    these videos can be viewed each time you press the "solution" button while the game is paused in a level inside a subview of Codea.

    Now I'm working in the multiplayer part, I'm adopting the Harmony project from @shrike to share the draws in a coop simple game throught GameCenter turn based system, initially with 2 players per game.

    Just now #6Dimensions only has one leaderboard and no achievements...do you think this is important for gamers?

  • Posts: 1,193

    I'm late to peek in on this... but I'm kind of glad I am. So many cool videos to watch, and the state of the game looks fantastic. It's kind of like a "best of" all the coolness I've seen in the forums squeezed into one creative box.

  • Posts: 1,976

    @Luatee I'm just excited that people use my code. :P

  • Posts: 2,820

    @SkyTheCoder, I've got to admit, you've really stopped agism here...

  • Posts: 2,024

    @juaxix, how did you get the crayon effect lines?

  • IgnatzIgnatz Mod
    Posts: 5,396

    I love the crayon effect ^:)^

  • Posts: 2,024

    @Ignatz, I know, that's why I want to know :p

  • edited August 2013 Posts: 436

    Ah, that's easy, I only play with the parameters of stroke, fill, color, strokeWidth...
    Consider you have a simple body or chain / edge

    blendMode(MULTIPLY)
    noTint()
    noSmooth()
    noFill()
    pushStyle()
     strokeWidth(4.4) -- 5 also
     stroke(color(11,11,211,200) -- your color here
     for i=1,#body.points-1 do
       local a = body.points[i]
       local b = body.points[i+1]
       line( a.x, a.y, b.x, b.y )
     end
    popStyle()
    

    of course, if the body has an angle, you have to pushMatrix(), translate and rotate before the line or draw.
    I also made a version of this with sprites, using as width and height parameters the distance between points, but it looks weird.

    For the other crayon effects I'm using sprites, like clouds, trees, etc,

  • Posts: 436

    And this is the trailer:

  • Posts: 2,820

    @juaxix - Wow... That's really cool looking. Did you make it with Blender, or what?

  • edited August 2013 Posts: 436

    The logo is made in Maya with physics particles, lightning and animations.
    I made the whole video in three steps, first record the videos from ingame, then create the After Effects ink video (took some time to render) with a template, then composite in any video software the transitions with music ,sounds, animations and so on.
    I'm Glad you liked it!

  • Jmv38Jmv38 Mod
    Posts: 3,265

    A-W-S-O-M-E...!!!!
    I wish you'll let us know the sales when it is out.

  • Posts: 1,595

    I can't wait, can't wait! How much is it going to be? $2-3? The video looks amazing aswell

  • Posts: 436

    .@Jmv38 : I ll share ;)
    @Luatee the members of these forums have promo code reserved as other times :)

Sign In or Register to comment.