I have read numerous times that programming languages when making games or large software often use multiple languages / scripts together. I'm wondering how that works. How do they compile it? How does it work together?

Also, how does this work with web design also, i.e. How does one combine their HTML/CSS with their Javascript code and make it run?

I know these are really basic low level questions, but I cannot find information on this on google. I'm probably just not searching well enough.


3 Answers 3


As for the web: The browser is the magic that ties these things together.

It has instructions on how to turn html into pixels on the screen. It has instructions on how to read css and apply the rules in it to the html, and then update the pixels on the screen. It has instructions on how to read javascript files and do the things that it asks.

The browser is a big compiler for three different languages, as well as a program which can respond to your clicks and keypresses.

In more generic terms, and other environments: An interface is the key to allowing different languages to talk to each other.

A database is built and written using SQL. A program sits running the database, and users can ask the database questions through the interface. An interface is an agreed set of instructions that the program promises to try to respond to.

A Node.js program relies on the node executable running, and can talk through that to the file system, databases, and anything that someone has created a well defined interface to.

Even "compiled" executable programs still rely on an interface. They run on your operating system (Windows or Linux or Mac OS X, typically), and they have at least a "main" entry point that the operating system knows how to call to start your program. Operating systems are usually written in C or assembly language, because they need to be fast.

A compiler like gcc will take C source code and turn it into something that has a recognisable interface with your operating system, so that it can run on your computer.

  • Exactly what I was looking for. Fantastic job. Mar 1, 2013 at 21:42

Specifically for Javascript and web development:

Web applications usually consist of at least 4 languages/elements.

  1. HTML - this is the markup that defines the structure of the page
  2. CSS - this is a styling language that defines the look and feel of the page
  3. Javascript (or something that compiles to JS) - this is a scripting language that runs in the browser (IE it runs on the client side machine)
  4. Server side code - (Java,ruby, C#, python, etc etc) Usually there are one or more languages running on the server.

How do these all work together? The browser renders the HTML/CSS and provides an environment for the javascript to run. The javascript can send requests to the server in order to interact with the serverside code.

The serverside code may be compiled (Java/C#) or dynamic (python). The key is that it isn't mixed in with the client side code, its run seperately and communicates with the client side code through a series of requests and responses.


The underlying data, be it for game world or the webpage (HTML) contains objects/elements - characters, items, structures - or in case of webpage, elements - DIVs (boxes) and SPANs (marked spans of text like this).

All these have various properties attached to them - looks, textures, locations, shapes, behaviors, content data, audio data, whatever makes them unique. Amongst these properties they have triggers (a.k.a. events - when something happens to the object, e.g. user hovers the cursor over it, or click it, or a clock countdown reaches zero...) and the triggers have scripts attached to them.

Now the engine - be that the web browser or a game program takes that data and renders it. Whether it's deciding a piece of text found between marks <strike>...</strike> should be rendered like this or whether following the definition of texture and vector model a tree should be set in game environment, this is something the user will see.

Now, if the user performs an action - say, click the tree while the character is holding an axe, or click a box on the page, if there's an event defined for that action, the browser will pass the script attached to the event to its internal scripting engine and execute it as a program. Then the script may affect other objects, like add an object "piece of wood" to the player's character inventory, or open a help box in the page.

There's of course one special object - the world, or in case of webpages the document, and it can have events attached too - especially "finished loading" event, to which a whole bunch of scripts is being attached and they start just then. (there's some more caveats with that but let's keep this simple now). This, in case of WWW often performs the job of getting all other kinds of events attached to the rest of the webpage, and all different kinds of tasks.

Summing up: you have data (game data or webpage) and renderer (browser or game engine). It displays the data and performs generic actions with it, also observing events. All objects in the data can have events attached to them, and scripts attached to the events. When event occurs, engine loads up and executes the script.

And as for interface, the webpage or the game world is the environment and the language has features to interface with that environment, e.g. modify properties of other objects, create their instances or delete them. document.getElementById("title").style.border="solid red 3px" in javascript will find the title and surround it with a red frame.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.