Multiplayer Projectiles Question

Post your help queries and engine programming questions here

Multiplayer Projectiles Question

Postby JudgeX » Thu Aug 13, 2015 8:59 pm

Alright, I'm still plugging away at a project with isogenic when I get spare time here and there, and I'm trying to figure out a "best practices" way to handle projectiles.

I've rigged up guns that can be put into the world, picked up, and fired, streamed that information to decrease the ammo in the gun and everything, but I am hesitant to try and build good projectiles off the cuff.

Does anyone have any suggested resources or methods for doing this in a resource-friendly, multiplayer way?

I know this question is a bit general, and I'm sorry for that, I just don't want to start out totally wrong on this, and I looked through the examples and didn't see anything that used a projectile?
JudgeX
 
Posts: 21
Joined: Mon Jan 06, 2014 7:46 am

Re: Multiplayer Projectiles Question

Postby robaldred » Wed Sep 09, 2015 10:00 am

Hello.
There are a couple of ways often used to simulate bullets in games.
1. Raycasting, sometimes called hitscaning, where you just make an instant calculation from where are bullet would spawn (the end of a barrel) forward for x distance in the direction of the barrel rotation. If another entity intersects the invisible line drawn then that object is hit. (simple, requires no physics simulation it's just a calculation).
This is the method chosen by most first person shooters, CounterStrike, Call of Duty.

2. Spawn bullet entity. This is where you would spawn a physical entity in your game world, apply a force to that bullet and physically fire that entity through the game work in the direction of the barrel. This is computationally more intense as it requires actual physics simulation. This gives a more realistic gameplay and things that come with that like trade kills, and the bullet travel time delay. However comes with problems in multiplayer games because of latency so you get situations where players thing they've been shot through cover.
This approach is used in first person shooters like Battlefield & World of Tanks.
I don't work for Irrelon. All comments are my own.
I would strongly encourage anyone building production projects with Isogenic to buy a premium licence, it costs very little and will help towards continued development of the engine. Irrelon have spent thousands of hours developing this wonderful platform with many features found in AAA game engine.
User avatar
robaldred
 
Posts: 243
Joined: Wed Oct 23, 2013 8:09 pm
Location: Manchester, England

Re: Multiplayer Projectiles Question

Postby JudgeX » Thu Oct 01, 2015 12:04 am

Robaldred,

Thanks for your reply, I had already gone with option 2, because I want to avoid hitscan stuff, and happily, it's working pretty well. I can make gun profiles and the properties all flow right into isogenic exactly as expected, with different bullet and gun textures and everything, I even rotate the bullets and all of that, because isogenic is rather charming to work with in these respects. I am super happy with this, and it even stands up to stress testing pretty well.

HOWEVER...

I do have an issue where if I want to click and hold down the mouse button and drag to spray with an automatic weapon, my mousedown (self.vp1.mouseDown(function(){}) seems to continually pass only the ORIGINAL click's coordinates to the server, resulting in every bullet being given the same trajectory...(unless I release the button and click elsewhere) I experimented briefly with trying to coordinate this with mouseMove, but I couldn't come up with a good way to get an updated coordinate passed in when the user is holding down the mouse button and moving the mouse.

Do you have any suggestions for handling this in an isogenic friendly way?
JudgeX
 
Posts: 21
Joined: Mon Jan 06, 2014 7:46 am

Re: Multiplayer Projectiles Question

Postby rob » Thu Oct 01, 2015 9:31 am

Hey ya,

The mousedown event will only have the original click co-ordinate as you have found - this follows standard DOM event behaviour. What you could do is to try what you suggested about using mousemove alongside mousedown.

What I would do is set player states so your player class should have a state isFiring (boolean) and when you do a mousedown you set the state to true.

Inside the tick event of your player class, if isFiring is true, get the current co-ordinate of the mouse via the main ige object (this is top of my head without looking at the code but something like ige.mousePos(); or you could use self.vp1.mousePos() instead if your vp is translated etc) and then still inside your player class, generate the bullets that you want in the direction you want based on the mouse position and the position of the player.

Your player class should also have a state determining what gun is currently in use (which will affect the bullet fire speed etc) as well :)

Hope that makes sense!
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
User avatar
rob
Site Admin
 
Posts: 316
Joined: Tue Oct 22, 2013 5:08 pm

Re: Multiplayer Projectiles Question

Postby rob » Thu Oct 01, 2015 9:41 am

PS, Do you have a screenshot of your game you can share? It sounds pretty cool!
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
User avatar
rob
Site Admin
 
Posts: 316
Joined: Tue Oct 22, 2013 5:08 pm

Re: Multiplayer Projectiles Question

Postby JudgeX » Fri Oct 02, 2015 5:21 am

Thanks for the replies, I implemented it pretty close to that way and it works out pretty well... thanks!

I don't really have anything screenshot-worthy as of yet as its all with placeholder artwork, but we're working on making a multiplayer top down RPG. I've already implemented chat (with distance, muffling, and optional meSpeak.js integration, etc), character biology (HP, life, death, consciousness, bleeding, healing, etc), items with multiple pickup modes, guns, projectiles with a penetration model, mountable chairs, characters can drag items, etc... but, nothing really screenshot-worthy as of yet.

We're having a lot of trouble figuring out a really good way to allow players to customize characters, or have swappable clothing and still have plenty of animations, so, if you have any input on that it would be really helpful... we've looked into RPGMaker, and are currently considering Spriter.

Melee attacks also seem hard to implement in a way that won't make customization and nice animations impossible...

My art guy is practicing up on his pixel art currently, so, maybe I'll have screenshots soon. I'll post them in the project forum here when I have something visible.
JudgeX
 
Posts: 21
Joined: Mon Jan 06, 2014 7:46 am

Re: Multiplayer Projectiles Question

Postby rob » Fri Oct 02, 2015 3:49 pm

In terms of clothing I agree that your proposed spriter tool is a good one. It increases the total number of sprite sheets to download but that is not a massive concern.

You could handle it other ways like mounting individual body parts to an overall character but depending on how many players / characters you have on screen that could get slow quickly.

At present Isogenic doesn't support any skeleton / mesh stuff unless you go down the 3d webgl route which is very immature at this point and hasn't been given any testing or usage outside of the examples.

I think version 2 of the engine will be an entirely webgl based rendering engine so that these sorts of features are just baked in, and also it would allow us to have GPU-based depth sorting rather than the horrible way we have to do it at the moment.

Version 2 is only a dream at the moment though, IGE made almost no money and gets no game royalties so there is no commercial way to fund a new version with new features. I am really sad about that though and hopefully when I have achieved personal financial freedom somehow I can spend my time making version 2 for the sake of it because it is enjoyable rather than to try to sustain it in a commercial way :)
CEO & Lead Developer
Irrelon Software Limited
http://www.isogenicengine.com
User avatar
rob
Site Admin
 
Posts: 316
Joined: Tue Oct 22, 2013 5:08 pm

Re: Multiplayer Projectiles Question

Postby JudgeX » Sat Oct 03, 2015 12:30 am

I'm sorry to hear that isogenic isn't commercially outstanding. It surprises me, really, since after doing a lot of research I couldn't find any other way to make a multiplayer HTML5 web browser game that didn't require a whole lot of coding up front.

I don't know what more someone could really want out of a 2D game engine.

I really enjoy any time I sit down and work on my game in isogenic, and if I had more time and less jobs, I'd have finished something by now.

Maybe more people will buy the engine soon? Have you advertised it recently? People are missing out.
JudgeX
 
Posts: 21
Joined: Mon Jan 06, 2014 7:46 am

Re: Multiplayer Projectiles Question

Postby Epsilon » Sat Oct 03, 2015 6:02 pm

rob wrote:Version 2 is only a dream at the moment though, IGE made almost no money and gets no game royalties so there is no commercial way to fund a new version with new features. I am really sad about that though and hopefully when I have achieved personal financial freedom somehow I can spend my time making version 2 for the sake of it because it is enjoyable rather than to try to sustain it in a commercial way :)


I apologize in advance, because I am not sure if I may recommend you something in this area.

However, I believe that the conspicuous call-to-action banner on the home page with a call to Donate in the project could generate some additional income, which could be used to invest in advertising on Google Adwords.

Also, some thematic answers at famous game developers' forums, linked to examples implemented in Isoengine (it is desirable that all of these examples can be run online without downloading and environment settings) could bring substantial assistance. All this will lead people in the community and create interest in the Engine.

Personally, I think Isogenic Engine is a very good idea, especially captivates implementation of networking and simplicity of internal structure. Well, not so well-documented, but I guess it is temporary issue.

From myself I could make some financial contribution to the development of the engine (Donate), and has written a short article on my forum (in Russian yet, later will translate it to English) http://epsiloncool.ru/igry/isogenic-eng ... -html5-igr.

Thanks.
ZX Spectrum fan and game developer in the past. Wanna be game developer in present again.
User avatar
Epsilon
 
Posts: 13
Joined: Sat Sep 26, 2015 9:40 pm
Location: Russian Federation


Return to Help & Questions

Who is online

Users browsing this forum: No registered users and 1 guest
cron