CSC-105

LibraryPicking a setup for your app

Picking a setup for your app

Most projects are pages with lists, forms and buttons, and How your app is built covers them. Some need more: a game loop, a 3D scene, sound or a map. Your agent starts those from the defaults below. Each one is small enough for you to read, works on a phone, and runs on the course's host with no build step. They're starting points, not rules: tell your agent when you want something else.

Where to start

Your appStart withReach for more whenWatch for
Board, card or puzzle gameHTML buttons in a CSS gridit needs smooth motion: a canvasevery square easy to tap
Action gameone <canvas> and one game loopmany sprites, physics or scenes: Phasertouch controls, not only keys
3Dthree.js, with boxes and spheres firstreal models: glTF files in assets/phones have small graphics chips
Music or rhythmthe Web Audio APIsynths and sequences: Tone.jssound starts only after a tap
MapLeaflet with OpenStreetMapno key needed
ChartsSVG your agent drawsmany or interactive charts: Chart.js
Live or shareda Bun server with SQLiteupdates without a reload: WebSockets in Bun.servetry it on two devices at once

A library loads as a module from a CDN such as https://esm.sh, with its version in the address, so an update can't change your app overnight. In a Bun app, your agent adds it with bun add instead.

Games

  • One loop: requestAnimationFrame draws each frame, and things move by the time since the last frame, so the game runs at the same speed on every screen.
  • State apart from drawing: positions, score and level live in one object; drawing only reads it. That makes the rules easy to test with bun test.
  • Phones have no keyboard: every control has a touch version, such as on-screen buttons, taps or swipes.
  • Sharp and polite: the canvas is scaled by devicePixelRatio, and the game pauses when the tab is hidden.
  • The state in words: the score, level or whose turn it is also shows as text on the page, such as "Score 3 · Level 2". Screen readers read it, and so does your agent when it looks at your app.

3D

  • three.js from a CDN, in one scene with one camera and a few lights.
  • Get the controls and the feel right with simple shapes before adding models.
  • On a phone, keep the pixel ratio at 2 or less and use few shadows.

Sound and music

  • Phones play sound only after someone taps, so audio starts from a button.
  • Beats are timed on the audio clock (audioContext.currentTime), not with setTimeout, which drifts.

"An app on my phone"

The course hosts web apps, not App Store apps. A web app can still open from the home screen like one: with a web app manifest and an icon, people add it to their home screen and it opens full screen.