Hot answers tagged

39

Keep all your game data and logics on the server. Part of the game which is on the client side can be copied using appropriate tools anyway (even if it's in Flash or Java), so just accept it and don't care too much about it. To keep your javascript less copyable, because of bad readability, you can minify it. That's a good practice anyway as it makes the ...


39

The short answer is you can't do it. Anything that runs client side, especially from source, can be modified to defeat your tactics trivially. If you put in place a client side checker to look for abrupt changes, a user can just disable the checker. The good news is that, generally, there is very little cheating on single-player games. The only major ...


31

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 ...


25

jQuery and MooTools are awesome JavaScript libraries; I prefer jQuery myself. Either one will assist you in your JS game development if you use the DOM. If you go with Canvas rendering, I still think you should use one of those libraries, but you will need to learn the Canvas functions. Here is a tutorial which introduces you to canvas by creating a Breakout ...


21

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 ...


17

Both solutions (drawing on your canvas VS. traditional HTML/CSS) are totally valid and will work just fine. Some things to consider: If you're already using a canvas-based library, your code may be cleaner/more organized by continuing to use canvas instead of having additional (DOM-based) methods for UI. If your UI is extremely text-heavy (with dialogs ...


17

I just ran the HTML5 test: My iPod Touch 2nd generation with iOS 3.1.3 scores 125 and 7 bonux points out of 300 in Safari. Of particular note to game development: Full points in Canvas! Great for game rendering. Supports the video element with MPEG-4 and H.264 formats Supports the audio element with PCM, MP3 and AAC formats (great for bgm and sounds!) ...


16

Don't just send an integer score to the server. Send a collection of game stats that can be used to verify the score was realistic. Or you can implement some pre-shared key for calculating the score. You could send incremental scores and stats throughout the game and ensure that the increase is reasonable. However, I wouldn't worry too much about it. The ...


16

As you said, the only ones I have found are either betas or alphas with none seeming to be ready for release. At this point in time it is probably better to roll your own: Better understanding of the internals. Able to tweak the engine to your needs. Develop the features you need to use Skip features of other engines you don't need, reducing code bloat, ...


16

There's http://www.phonegap.com/ which is open source and cross-platform. Besides packaging your HTML 5 as a native app, it also lets you access native features of the mobile phone.


15

I agree with Ef Es, get a couple of people, parents/friends whoever, and watch them play through it. It's the worse to launch a game only to find it really hard because you were use to the game mechanics. I suggest maybe making a blog of the launch of your game, just go over the details, any updates can be listed there as well. If money isn't a concern, ...


15

Get a couple of friends and make them go through bugs and check all game assets. Think of ways of monetizing it, like implementing the Kongregate API or so.


15

There's box2dweb, which is a much newer port and has a lot fewer issues than box2djs. I highly recommend it. http://code.google.com/p/box2dweb/


15

I have created a framework specifically for creating HTML5 realtime multiplayer games, based on the Client/Server model. In this model, players send only input to the server (keys being pressed) - and the game occurs on the server. The server sends timed world-snapshots to all clients, and clients render themselves say 75 ms back in time from the current ...


15

Double buffering a canvas based game will certainly be a performance hit. You'd be drawing an extra amount of pixels equal to your canvas size every frame. In canvas based games drawing to a canvas is the biggest bottleneck in most cases and you want to limit that as much as possible, especially on mobile devices. Chrome has GPU acceleration (as of the ...


14

Let's start with the array. Don't think about it as tridimensional. Indeed, if you want to have stackable units there, it makes sense at first sight: first dimension is collumns of rows of tiles second dimension is rows of tiles third dimensions is tiles, i.e. arrays of units. But this third dimension won't be consistent, as you will store there not only ...


14

Unfortunately, the answer is to draw less. I've found the bottleneck with canvas based applications (on any platform, really) is the time it takes to actually draw pixels. Here are some things to try: Use several canvas layers. Draw your background to one layer while drawing your objects to another layer (absolutely positioned on top of the background ...


14

Yes. ForPlay. WebGL and Canvas 2D code paths exist for maximum performance and platform support respectively. The ForPlay GWT library helps with the abstraction. See the Google IO presentation Kick-Ass Game Programming with Google Web Toolkit for details.


14

There is a lot of hype around HTML5 but to say that Flash is largely being replaced by it is an overstatement. While video and audio tags may gain traction, gaming will be one area that holds out for a long time, not just because of better tooling and performance, but also because there is a business infrastructure built around distributing Swf files, that ...


13

If this is for kids, then another option is to use a GUI based alternative. Taking your example as reference: if FindEnemy if stamina > 0.6 dobattle; else returnToNest; endif; endif Rather than getting them to type out text, you can have blocks (very literally) like so: Then you can work out what kind of mechanism you could ...


13

Yes. There are many ways to wrap an HTML5 game for distribution on iOS. Solutions include CocoonJS, Game Closure, PhoneGap, and Ejecta. Examples of HTML5 games on iOS include Onslaught! on iPad and Biolab Disaster on iPhone.


12

When I evaluated JavaScript engines a little while ago my favorite was Crafty: http://craftyjs.com/ There were a loooot of options I had to consider, and some others I liked were: http://easeljs.com/ http://www.limejs.com/ http://code.google.com/p/casualjs/ (Incidentally, another option that looks pretty slick initially is http://impactjs.com/ but ...


12

N-grams are popular here. The basic idea is to keep a list of moves the player has made. You can then, given the last N moves of the player, figure out percentage likelihood of what his next move might be. Your game should have a database of effective counters and blocks to each move. For offensive modes in the AI, you can still basic player modeling to ...


12

In the interest of exploring just how far you can take the newest crop of browsers, I and some colleagues cross-compiled the open-source Java port of Quake II to Safari/Chrome (it ought to work on Firefox at some point as well, though it didn't initially, largely for performance reasons). The project is here: http://code.google.com/p/quake2-gwt-port/ It ...


12

Just a couple of things to add to @Marco's answer: .gif is sorely outdated. I would completely avoid using .gif files as much as possible. I think people only use them these days because of in-browser animations, and animated png's aren't well supported at this time. So all you have is jpg and png. PNG: Is lossless. The only thing you are considering ...


12

Add whatever your game needs. Not every engine needs every feature and I strongly recommend you to focus on the ones used by your game, if you ever want to finish working on it. It's as easy to get lost in collecting engine features as it is to be frustrated later when figuring out that the gain of all this work turned out to be void because those engine ...


12

If you want to protect your source, don't write it in HTML/Javascript? Part of the really nice things about the web as it's all human-readable. This makes it an excellent learning resource. If you're telling me that you've never looked at the source of a website to learn how it does something, then feel free to tell me I'm wrong. I'm all bout sharing the ...


12

Socket.IO offers a system built on top of several other layers (including websockets, flash, comet techniques) with graceful selection. Node.js is one option for running it server side.


12

This means that when the background is drawn, not all of it is redrawn every frame. When something on the map moves, the area it used to occupy gets marked as dirty. Then when drawing, you know you only need to redraw that portion of the background. This is beneficial because then you only need to redraw the areas that weren't shown before. So this is ...



Only top voted, non community-wiki answers of a minimum length are eligible