Tag Info

New answers tagged

1

You use a library that handles those numbers: https://github.com/MikeMcl/big.js


0

Got it working full javascript below var game = { //game object level: 1, //current level turn: 0, //current turn difficulty: 1, // user difficulty score: 0, //current score active: false, //whether a turn is active or not handler: false, // whether the click and sound handlers are active shape: '.shape', // cached string for ...


0

I guess you want something like this: var givenTime=10000 var timeLimit var clockInterval resetClock() function updateClock(){ var now=new Date().getTime() if(now<timeLimit){ //Set the displayed clock to timeLimit-now } else{ //Time has run out clearInterval(clockInterval) } } function resetClock(){ ...


0

Javascript has the setInterval(function(), milliseconds) function which could help here. If you need to get rid of the interval once you're done with it you can store your interval like so, and then clear it: var timer = setInterval(tick, 1000); clearInterval(timer);


0

Run the game like any other, calculate data on the client side as needed and simply overwrite when you receive packets from the server.


5

tl;dr You control how much data you are willing to process each frame. If a packet is too big, break it into smaller cells and process them one at a time (i.e one each frame). If you get a lot of small packets than split the group into chunks and limit the amount of information processing that is done each frame. The client does not need all the information; ...


1

I assume that when your network data arrives, its processing diverts enough CPU power to slow down your rendering process. Are you enforcing a constant framerate or are you just rendering frames as fast as you can? Assuming you have a constant framerate, you may chose when your network packets are processed. I mean by that that your websocket event should ...


2

Try this: var speed = Math.sqrt(Math.pow(heroVelX, 2) + Math.pow(heroVelY, 2)); The case is that the ^ operator is the bitwise XOR operator. You should use Math.pow(base, exponent). Here is a an example: link.


0

The client is written with JS? If so, than you need to use some kind of async library to make network IO in backgraound. There is RxJS and many other (try google: reactive, async etc.). Also consider switch from JS to CloujeScript: some local guys are using it for kind of tasks you've described.


1

When you want a really advanced light engine where objects create shadows, you should look into WebGL and use a 3d engine. But when you don't need accurate shading and only want objects to create cones of light which illuminate the canvas without respect to content, this is what you could do. Have two canvases, the normal scene and a second background ...


2

The difference between html5 games and native games is a vast discussion, one that im not going to be able to answer in just one post. So the closest thing i can come to a straight answer is : It depends on the game. This stems from that both technologies are fairly new, and growing exponentially. As far as I know, no game studio have tried making the same ...


7

For a Chrome-based solution to make the game run offline and enjoy some native functionality, you can consider making a Chrome App. This way, you can distribute it in Chrome Web Store for added visibility, you can enjoy some powerful APIs, and make it look more like a standalone app. The downside is, of course, requiring Chrome.


20

You can embed images in the HTML document using the dataurl-syntax which allows to put the base64 representation of the binary image data as the src-attribute of an image. This also works on any other kind of media file. <img ...


29

Just putting all the files into a .zip file isn't a viable solution because most web-applications need a web-server so that they can access resources via HTTP-requests. On some systems you can access files via the file:// URI-scheme, but that's not guaranteed to work everywhere because of security-reasons and will fail for things such as AJAX requests. It ...


0

One good suggestion is multi-user dungeons (MUD). They are text-based games that are open source (free), developed in multiple languages including C, C++, java, python and more. They are also online multiplayer games that pretty much gave birth to the whole massively multiplayer online games such as Ultima Online, Everquest, Dark Age of Camelot and of ...


0

One c++-based approach is a gaming library at: GameApi It is designed for kids to write mini-games, with support for sprites and 3d objects.


1

Long story short you have several free options to let kids make games. My favorites are: Scratch: Everything is made using logic blocks. Perfect your young kids. They can do simple things easily. Algoid: Perfect for kids wanting to really "code". Easier than usual engine / langage. Adapted for teenagers. First of all that's a great initiative. I was ...



Top 50 recent answers are included