Skip to content
This repository has been archived by the owner on Sep 2, 2020. It is now read-only.

Drawing performance

stephank edited this page Sep 11, 2010 · 1 revision

All rendering in Orona is delegated to a Renderer subclass. There are several different Renderer implementations:

  • Direct 2D, which has nothing to do with the DirectX technology, but simply means that each tile is drawn directly to the canvas. It is the simplest renderer. The code for this lives in src/client/renderer/direct_2d.coffee.
  • Off-screen 2D, which prepares chunks of the map into off-screen canvas buffers. Map tiles are then no longer drawn directly, but instead these chunks are drawn, massively reducing the number of drawImage calls. At the time of writing, this increases performance in Firefox, but doesn't seem to matter much for Chromium. The code for this lives in src/client/renderer/offscreen_2d.coffee.
  • WebGL, which basically collects fixed-size batches in a VBO, and sends them off to the graphics hardware. Another nice thing is that this draws styled tiles using multitexturing and a fragment shader, but it's not clear what effect this has on performance. Overall, this off-loads the CPU really well, but is strangely a bit more stuttery in Chromium. The code for this lives in src/client/renderer/webgl.coffee.
  • Table, which is actually no longer in the current code base. It used a large DOM table to render the map, and was quickly dropped, because scrolling was not nearly smooth enough in many browsers. However, it is slated for return for use in a map editor, because it does have the advantage of natural page scrolling.

Switching between renderers is not too difficult. The renderer used on the client is selected at the top of src/client/index.coffee, on the line that says:

DefaultRenderer  = require './renderer/offscreen_2d'

Simply change the string './renderer/offscreen_2d' to point at whichever renderer you wish to try today.


stephank: I only really have one set up to test things on, which is an Ubuntu laptop with an Intel GM 965. I'm interested in some raw performance numbers on other set-ups. Perhaps this page should describe a solid way to benchmark and a nice table that any passer-by can add his/her observations to?

Clone this wiki locally