Recommended Posts

Hi everyone,

Been away for a while but I've kept practicing with Babylon. This is at a prototype phase with no 3d/sound/artwork. Just pure javascript code for now. Trying to get the mechanics working properly first.

One question I have is how the projectile rotationQuaternion is cloned. It seems to follow the lookAt() quaternion from the origin tower even after the quaternion is cloned. How can I ensure that the rotationQuaternion is not linked to the original quaternion it is taken from? This causes problems when a tower shoots a projectile and then rotates to target another enemy. The previously mentioned projectile rotates in midair still copying the rotation of the tower.

Here's the relevant code taken from line 53 of https://github.com/xtreemze/defend/blob/master/src/js/main/projectiles.ts

    const clonedRotation = originMesh.rotationQuaternion.clone();
    clonedRotation.normalize();

    projectile.rotationQuaternion.copyFrom(clonedRotation);

 

Comments, questions are welcome!

The project is hosted here with open source: https://github.com/xtreemze/defend

View the project here: https://xtreemze.github.io/defend

screenshot_-6-5_11-19 (44).png

screenshot_-6-5_11-19 (61).png

Share this post


Link to post
Share on other sites
On 6/5/2018 at 6:00 PM, Deltakosh said:

Really cool!

can you create a repro on the problem in the PG?

Thanks, I solved it by delaying the firing of the projectile to give the lookAt function some time to complete. Don't think it's anything wrong with the engine, just too many position queries on the meshes on every frame to measure distances and acquire the nearest target. The delay is not noticeable.

 

Updated: now with generated sound thanks to the WASFX library by @fenomas

screenshot.png

Share this post


Link to post
Share on other sites

Nice start already of your prototype game! Cool arcade style. Like it! Can't wait to see how it is played.

I was working on the gun emplacement operation controls of my Model Train Simulator webgame in BabylonJS and stumbled upon your post... :-)

Share this post


Link to post
Share on other sites

Thanks everyone for having a look! I've done a lot of work on balancing and improving the feel to increase fun and reduce frustrations. Veteran John Romero says your first 10 - 20 games will suck, and this one still isn't #20 yet. With that in mind, comments that may improve this game, or my approach for future games would be greatly appreciated 😀. Just as well if you see this and wonder how something works, I'd be more than happy to help.

You're welcome to give it a try again if you've played before because it's a very different feel since I last updated this post.

Play here: https://xtreemze.github.io/defend

Share this post


Link to post
Share on other sites

oh, this new version is a big improvement! it's a lot more clicky to get a victory - only thing is that it would be harder if the base didn't regenerate so fast and also it seems the new attackers come predominately from two opposing sides, whereas before it felt more balanced.  anyway, it's lots of fun - thanks for sharing!!

Share this post


Link to post
Share on other sites
3 hours ago, brianzinn said:

oh, this new version is a big improvement! it's a lot more clicky to get a victory - only thing is that it would be harder if the base didn't regenerate so fast and also it seems the new attackers come predominately from two opposing sides, whereas before it felt more balanced.  anyway, it's lots of fun - thanks for sharing!!

Good feedback, thanks @brianzinn! I did try to make the game more forgiving but based on your feedback I'll increase the difficulty so it feels more rewarding in the end.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.