Is my javascript network game client planning correct?

beavoid
beavoid used Ask the Experts™
on
Hi,

So, I'm going to use Javascript for my game client. I can do the server in Java, thanks to local legends. I need a listener waiting for user directives on the game window and sending an activity packet for each frame.
It's going to be a platform style multiplayer.
I'm going to treat it like an RTS, UDP over TCP, for fast delivery of info in UDP packets over reliable TCP sends.
Does Javascript block for GameWindow activity? How is it queried?

What should I know? I got it done in Java be4 w Threads
Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
This is a very broad question and I am not quite sure what it is you are asking - are you aware of JavaScript Service Workers

https://developers.google.com/web/fundamentals/primers/service-workers/
from the above
A service worker is a script that your browser runs in the background, separate from a web page, opening the door to features that don't need a web page or user interaction.
https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API
from the above
Service workers essentially act as proxy servers that sit between web applications, the browser, and the network (when available). They are intended, among other things, to enable the creation of effective offline experiences, intercept network requests and take appropriate action based on whether the network is available, and update assets residing on the server. They will also allow access to push notifications and background sync APIs.
beavoidSelf Employed

Author

Commented:
Thanks.

I'm aware of a few situations where not all browsers support functionality for security reasons.
Is this one of them?
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
Always a good resource is https://caniuse.com/ and the MDN resources - they give good indications of cross browser compaitibiliaty.
Ensure you’re charging the right price for your IT

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

beavoidSelf Employed

Author

Commented:
Thanks

Since Javascript can't do Threads, do you think a multiplayer game could work, where the server is done in Java, like many RTS's I've made,
and the clients in Javascript. -  And, because Javascript is single Threaded. - I'd have to use the packets being received on the clients as the game clock. Do you think TCP would be pointlessly slow?  - is there a UDP type workaround, for fast duplicate packets to be sent faster, a microsecond behind?

I'd prefer the servers to be off-site on my machines, to eliminate cheating, - altering the game-state, and a UDP type quick packet failsafe is desirable.

Ideas?
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
If you want to offload processing then you can also look at Web Workers .
WW run in a different thread - don't have access to the DOM but can be used to do processor intensive calcs
Services workers act as an intermediary between your app and the external network or cache.
beavoidSelf Employed

Author

Commented:
Thanks,
We Workers look promising.
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
You are welcome.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial