OpherV

Members
  • Content Count

    43
  • Joined

  • Last visited

About OpherV

  • Rank
    Advanced Member

Contact Methods

  • Twitter
    OpherV
  1. How do I get the motor to turn counter-clockwise though? Setting the motorSpeed to a negative value doesn't seem to help? Scratch that
  2. Schteppe - I have no idea how I missed that. Looks like I was trying to literally and figuratively reinvent the wheel Thanks!
  3. I'm using P2 and I have three boxes: "body", "left wing" and "right wing". The wing boxes are connected to the body using a hinge joint. The physics world has no gravity. I'm attempting to rotate the wings around their hinge connection, as if the joint is motorized but I'm not exactly sure how to achieve that. If I exert force with a downward vector on the center of the wings, the body itself flies down. This is undesirable. With an actual hinge motor, only the wings will rotate about the hinge, affecting the body only when they hit it. Which forces should be added to the wings, and at which origin points?
  4. I received a few interesting ideas here: http://gamedev.stackexchange.com/questions/75844/how-to-implement-soft-edge-areas-with-particles In the end I went with the approach of creating small sprites with soft edges, randomly place them in the polygonal area and and using add blend mode to achieve visual coherency. You can see the end result here: http://www.github.com/opherv/evolb
  5. @SeanEBaby You have no idea how much that comment meant to me! It's heartwarming to see that someone shares and understand the vision of something you've worked really hard on I even included your comment as "positive feedback" in my presentation deck, hope that's alright by you In any case I've improved much of the game during the past couple of days, and included a new gameplay video of the updated state. How can I get this thread moved to the game showcase? Btw your game is complex! So many sliders and buttons One of the interesting debates I had during the research phase for my game was whether to frame the project as a game, a toy or a simulation. In the end I chose the game concept, with a simplified evolution\reproduction module. For example, in real life you have complex traits that are derived from multiple chromosome combinations. I simplified the whole mess of gender, gonosome and reproduction issues by modelling each organism to have a list of traits. The organisms are genderless, and when two reproduce the offspring traits are determined from its parent traits. (If both parents have the trait, the offpsring will too. If only one, there's a 50/50% chance unless the trait is dominant). So while it's a simplified model, it's still somewhat complex. Just not infinitely complex like in real life I think I'll do a write up of the model in the github wiki page so other interested people can follow.
  6. @wayfinder Thanks for the insight... I thought as much but still 15% seems a bit high, no? Or is that normal for this amount of physics objects? @lewster32 Thanks for the suggestion! It makes a lot of sense, but even running the game in a small viewport with no filters has no effect. I still see slowdowns at random intervals. Maybe the big background is the culprit... I'll try disabling those layers to see if that changes anything.
  7. Here are two quick ideas: 1. Instead of adding a body to the weapon sprite, you can add a new shape to the character body. It might help you to set its shape as a sensor. 2. Don't add the weapon as a child, but rather add it as a sibling of the character and use some constraint to fix the two together
  8. So I just posted the new game I've been working on, Evolb I've been running into really bad performance issues - I'm not really sure what is their cause or how to tackle them. To see what I'm talking about http://opherv.github.io/evolb/?loadLevel=random This generates a random level with all possible game objects (creatures\enemies\power ups\rocks etc) Try to move the creatures around with the mouse. At first everything moves very smoothly, but soon you'll start to notice some game hiccups and slowdowns, even on a strong dev machine. When running Chrome devtools profiler the only interesting bit of data is that I get 12.65% total runtime on SAPBroadphase.getCollisionPairs, which is part of P2 physics Thing is - the game is not that intensive on physics. While there are around 200 objects in the level, most of those have only a circular body. Only the rocks and the environment areas have polygonal bodies. Everything is ordered neatly into collision groups so that characters collide with characters\rocks\power ups\areas but for examples rocks don't collide with anything but the characters. I saw that the P2 demos can handle much more complex simulations than this... so I'm really not sure what is the problem here. Profiling the Heap Allocations doesn't reveal any noticeable memory leaks either. In fact, if you try this level with very few objects you still get slowdowns. I'm truly happy with my choice of Phaser as a platform so far, I really hope I can get this resolved Please advise! Source is available here: https://github.com/OpherV/evolb
  9. So for the past two months I've been working on a new game called Evolb, the final project in my year long Game Design course in the Bezalel Academy of Arts and Design. It's a strategy\survival game that uses basic principles of evolution such as natural selection, mutation, trait change over generations and more using fun and simplified models EDIT: New gameplay video here: I have most of the general mechanics up, a basic level editor as well as a major part of the design. The basic premise is that you start out with a bunch of creatures, these creatures must eat otherwise they die. They also breed, and their offspring can mutate to change or add traits: Speed, size, offensive capabilities, armor, resistance to cold\hot\poisonous environments, cannibalism and more... ! Since I'm a big believer in free knowledge the entire game and its assets are going to be open source under GPLv2. You can see what I have so far here: http://opherv.github.io/evolb/ Source code is available here: https://github.com/OpherV/evolb I'll appreciate thoughts, suggestions or any general comments. Thanks!
  10. Did you try setting up hitArea? http://www.goodboydigital.com/pixijs/docs/classes/DisplayObjectContainer.html#property_hitArea
  11. @wayfinder Here's an example of the issue - as you can see it's easily recreated
  12. I know that there's a difference between P2 and Phaser units, but that still doesn't explain why it works properly with addRectangle (or any other shape for that matter) and not with addPolygon.
  13. Update: Here's an example of the issue ----- In my game I have several defined "areas", that are basically dynamically generated polygons. This is an example of a set of polygon coordinates: this.pointArray=[[0,0],[300,-40],[400,-100],[500,0],[370,300],[100,450],[-100,200]];I draw these using a Graphics object and that works great: Now the weirdness begins. I try to add a body with the same polygon sensor shape using addPolygon and the same coordinates, like so: Phaser.Sprite.call(this, this.game, 0, 0); this.game.physics.p2.enable(this,true,false); this.body.clearShapes(); this.body.addPolygon({},this.pointArray); this.body.data.shapes[0].sensor=true;Below is what I get. Body shape polygon is OK, but notice that the graphics coordinates (green polygon) were shrunk down by a factor of 20, even though the only thing that was changed was the addition of the body. This affects every child object of my area sprite, so if a child object has some X value, that value will get translated to X/20! This does not happen if I use addRectangle: Phaser.Sprite.call(this, this.game, 0, 0); this.game.physics.p2.enable(this,true,false); this.body.clearShapes(); this.body.addRectangle(500,500,150,150); this.body.data.shapes[0].sensor=true;Notice how now both the rectangle body shape as well as the original coordinates behave accordingly. Now for more weirdness - If I put the addPolygon part AFTER the creation of the Graphics object I get the image below - both the polygons have the proper dimensions, but now every child sprite is offset by some amount. I'm really at a loss at how to debug this. I'm sure this has something to do with the phaser\p2 MPX conversions, but hours later into debugging and I still can't wrap my head around this. It's a crucial aspect of my game. Help!
  14. @Teemu-Tor did you figure out how to properly add polygon shapes? I'm still struggling with this
  15. You can use P2 physics and create a hexagon polygon body to go along with your hexagon sprite, then detect clicks on the body: http://examples.phaser.io/_site/view_full.html?d=p2%20physics&f=body+click.js&t=body%20click