-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Coco Models
Each Model has several files associated with it. For a Model to be fully functional, it needs the following:
- A handler in
/server/handlers
. Implements the REST endpoints associated with this Model, security logic, which properties are editable, and pretty much anything else special or logically unique to that Model. These subclass Handler.coffee, where all common logic among handlers is found. - A schema in
/server/schemas
. Defines the data structure of the model, and uses common.coffee for utility functions that construct the schemas (because they can be rather verbose, and there tend to be certain things we like to have set by default, likeadditionalProperties
tofalse
for objects). - A server model class in
/server/models
. Uses Mongoose to create an Active Record class for that Model, and ties in Mongoose plugins and any custom middleware. - An app model class in
/app/models
. This is class the browser uses, and is subclassed from CocoModel which subclasses from Backbone.Model. It defines the server endpoint and any custom logic for that model in the browser.
Plugins are a way to share common logic across different Models. To 'install' a plugin, have its server model add the plugin from plugins.coffee and the schema extended with the plugin properties from common.coffee.
Some of these are more mature than others, but all of them are changing regularly as CodeCombat develops. Check the code for the latest data on any given Model.
A single Level on CodeCombat. Includes:
- Thangs (game units) and their Component configuration
- Systems and their configuration (these coordinate Components)
- Scripts (event triggers and actions)
- Articles to show in the Guide of the Level
A bundle of logic to give properties and behavior to a Thang. These rely on certain Systems being present. Examples: ai.AttacksNearestEnemy
, programming.Programmable
, ui.Selectable
A bundle of logic for a given Level. This defines things like how health or physics work. Different Systems can fundamentally alter how Levels work. The Systems that have been built are for RTS/RPG style gameplay, but more could be written to allow even more types of games. Examples: Inventory
, Collision
, Combat
A common bundle of data for a Thang (actor, unit, doodad). Includes:
- Graphical data, in the form of raw vector data
- Audio data, like what it says when you click it
- Logical data, i.e. the Components that it has by default and their default configurations
State for a single play of a given Level, usually for a given player. Includes:
- Script state
- Code state
- Playback state
Documentation for general programming knowledge. In addition to gameplay, CodeCombat needs a reference corpus for players to check if they want a good general explanation of any given programming concept. These are what Scribes work on.
Individual elements in a Level are Thangs. Because these are denormalized as an array of them within the Level model, there's no explicit Thang model. Any given Thang within a level is pretty much just a single ThangType (which describes audio and visuals) and an array of Components (which describe behavior).
Like Thangs, these are denormalized to just an array of them within a Level. Each Script consists mainly of how it is triggered and what happens when it's triggered.
CodeCombat | Home | Blog | Forum | Teachers | Legal | Contribute
- Home
- Archmage Home
- Artisan Home
- Diplomat Home
- Archmage General
- Mission statement
- Coco Models
- Coding Guidelines
- Cookbook
- File system
- JSON Schema
- Technical overview
- Testing
- Third party software and services
- Artisan General
- Building A Level
- Coding Guidelines for Artisans
- Editing Thang Components
- Important Artisan Concepts
- Keyboard Shortcuts
- Debugging
- Artisan How-To Index
- Diplomat General
- i18n
- i18n Glossary nb
- i18n Glossary ru
- i18n Glossary es-419
- Dev Setup
- Dev Setup: Linux
- Dev Setup: Windows
- Dev Setup: Mac
- Dev Setup: Vagrant
- Dev Setup: Issues
- Game Engine
- Component
- Multiplayer
- Surface
- System
- Thang
- Thang Component System
- Tome
- World
- Artisan Tabs
- Components And Systems
- Scripts
- Settings
- Thangs
- Other
- Aether
- Client models
- Developer organization
- Educational Standards
- Events, subscriptions, shortcuts
- Chat Room
- Chat Room Rules
- Permissions
- Project Ideas List
- Treema
- Versioning
- Views