FIT CTU
Adam Vesecký
vesecky.adam@gmail.com
Lecture 3
Assets
Everything that is specific to a game (and not to an engine).
Any piece of data which is in a format that can be used by the game engine.
All visual elements that are presented to the user and protected by copyright.

Super Mario (1985)

Dangerous Dave (1988)

Trolls (1992)

Oscar (1993)

World of Warcraft (2004)

Order and Chaos 2 (2015)

Binary data

Bytecode

Text files

Hybrid files







Sounds
Images
Video
3D Models
Game Data
Levels
Fonts
Scripts

| 1 | RES ResourceLoader::_load(const String &p_path, const String &p_original_path, |
| 2 | const String &p_type_hint, bool p_no_cache, Error *r_error, bool p_use_sub_threads, |
| 3 | float *r_progress) { |
| 4 | bool found = false; |
| 5 | |
| 6 | // Try all loaders and pick the first match for the type hint |
| 7 | for (int i = 0; i < loader_count; i++) { |
| 8 | if (!loader[i]->recognize_path(p_path, p_type_hint)) { |
| 9 | continue; |
| 10 | } |
| 11 | found = true; |
| 12 | RES res = loader[i]->load(p_path, p_original_path != String() ? |
| 13 | p_original_path : p_path, r_error, p_use_sub_threads, r_progress, p_no_cache); |
| 14 | if (res.is_null()) { |
| 15 | continue; |
| 16 | } |
| 17 | |
| 18 | return res; |
| 19 | } |
| 20 | |
| 21 | ERR_FAIL_COND_V_MSG(found, RES(), vformat("Failed loading resource: %s.", p_path)); |
| 22 | } |
| 1 | HashMap<String, Resource *> ResourceCache::resources; |
| 2 | |
| 3 | Resource *ResourceCache::get(const String &p_path) { |
| 4 | lock->read_lock(); |
| 5 | |
| 6 | Resource **res = resources.getptr(p_path); |
| 7 | |
| 8 | lock->read_unlock(); |
| 9 | |
| 10 | if (!res) { |
| 11 | return nullptr; |
| 12 | } |
| 13 | |
| 14 | return *res; |
| 15 | } |
| 16 |
AIFF
MP3
OGG
WAV
Trackers
JPEG
PNG
TGA
SVG






Shadow of the Tomb Raider, in-game

Wolfenstein 2: New Colossus, video

Warcraft 3, in-game

Warcraft 3 Reforged, video

Types
Formats

Diffuse

Displacement

Normal

Volumetric

Tileable

Sprite atlas
Sprite
Spritesheet
Sprite atlas


| Appr. mesh | Prec. mesh | CSG | Color | Material | Texture | Camera | Lights | |
|---|---|---|---|---|---|---|---|---|
| STL | ||||||||
| OBJ | ||||||||
| FBX | ||||||||
| DAE | ||||||||
| 3DS | ||||||||
| STEP | ||||||||
| X3D | ||||||||
| BLEND |
ZIP
zlib
Serialized data
Database
Save data
Local Storage
| 1 | let myStorage = window.localStorage; |
| 2 | |
| 3 | myStorage.setItem('player_state', player.stateId); |
| 4 | myStorage.removeItem('player_state'); |
| 5 | myStorage.clear(); |
IndexedDB
| 1 | await db.players.add({ |
| 2 | name: 'Warrior', |
| 3 | avatar: await getBlob('sprite_warrior.png'), |
| 4 | key_mapping: 'default' |
| 5 | }); |
| 1 | { |
| 2 | "player": { |
| 3 | "difficulty": "hard", |
| 4 | "scene": "mountains_02", |
| 5 | "posX" : 12, |
| 6 | "posY" : 56, |
| 7 | "inventory" : ["flashlight, lighter, candle"], |
| 8 | "stamina": 45, |
| 9 | "agility": 12 |
| 10 | } |
| 11 | } |

| 1 | // p_saveg.c::P_UnArchiveThinkers |
| 2 | while (1) { |
| 3 | tclass = *save_p++; |
| 4 | switch (tclass) { |
| 5 | case tc_mobj: |
| 6 | PADSAVEP(); |
| 7 | mobj = Z_Malloc (sizeof(*mobj), PU_LEVEL, NULL); |
| 8 | memcpy (mobj, save_p, sizeof(*mobj)); |
| 9 | save_p += sizeof(*mobj); |
| 10 | mobj->state = &states[(int)mobj->state]; |
| 11 | mobj->target = NULL; |
| 12 | if (mobj->player) { |
| 13 | mobj->player = &players[(int)mobj->player-1]; |
| 14 | mobj->player->mo = mobj; |
| 15 | } |
| 16 | P_SetThingPosition (mobj); |
| 17 | mobj->info = &mobjinfo[mobj->type]; |
| 18 | P_AddThinker (&mobj->thinker); |




Zelda (2004)

The Messenger (2018)

Hope is what makes us strong. It is why we are here. It is what we fight with when all else is lost.God of War