Skip to content

Commit fa3b9aa

Browse files
committed
update some random docs
1 parent 9e72ea2 commit fa3b9aa

File tree

11 files changed

+110
-7
lines changed

11 files changed

+110
-7
lines changed

docs/general/best-practices.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Best Practices
22

3-
## Conventions
4-
53
Part of writing clean, efficient and maintainable code is following conventions.
64
This makes it easier for you and others to read and understand the code. Every
75
team or project may have their own conventions. What's important is that you

docs/general/concepts/addons.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
# Addon
1+
# Addons
2+
3+
An addon is a self-contained package of content and scripts that expands the game. Addons are placed in `<experiment directory>/addons`, where they override or supplement the base game files. Addons can contain:
4+
5+
- Scripts
6+
7+
- Materials
8+
9+
- Models
10+
11+
- Sounds
12+
13+
- And more content
14+
15+
16+
The directory structure inside an addon mirrors the main game directory. You can imagine every addon that is loaded as being "overlaid" or "merged" with the main game directory. This means that if an addon contains a file that is also present in the main game directory, the addon's file will be used instead.

docs/general/concepts/gamemodes.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
# Gamemode
1+
# Gamemodes
2+
3+
Gamemodes define the core rules of gameplay. Like addons, they are structured similarly but focus on defining mechanics rather than adding extra assets. A server can only run one gamemode at a time.
4+
5+
You can specify the gamemode to run using the `gamemode` console command or `+gamemode` launch option.

docs/general/concepts/hooks.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,14 @@
22

33
Using the [Hooks Library](../../libraries/Hooks/index.md) you can attach code to certain events in the game. This allows you to run custom code when certain things happen in the game.
44

5+
A function registered to a hook will execute when that event occurs. The typical pattern involves:
6+
7+
```lua
8+
Hooks.Add("Think", "MyScriptUpdate", function()
9+
-- Custom logic here
10+
end)
11+
```
12+
13+
This ensures that custom logic runs at the appropriate time.
14+
515
You can find all the hooks in [Hooks](../../hooks/index.md) section of the documentation.

docs/general/concepts/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
11
# Concepts
2+
3+
- **[Scripts](scripts.md)**: Explanation of Lua scripts and their execution.
4+
5+
- **[Realm](realms.md)**: Differentiating between client, server, and shared execution.
6+
7+
- **[Hooks](hooks.md)**: Understanding event-driven scripting.
8+
9+
- **[Addons](addons.md)**: Expanding the game with additional content.
10+
11+
- **[Gamemodes](gamemodes.md)**: Structuring gameplay rules and mechanics.
12+

docs/general/concepts/realms.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Realms
2+
3+
Scripts in *Experiment Source* run in one of three realms:
4+
5+
- **Client**: Code executed on the player’s game client (e.g., HUD elements).
6+
7+
- **Server**: Code executed on the game server (e.g., game rules).
8+
9+
- **Shared**: Code executed on both realms, but only affect their own execution environment (e.g., constants or utility functions).
10+
11+
Since there is no automatic state-sharing between client and server, communication between them requires explicit networking via the [`Networks` library](../../libraries/Networks/index.md).

docs/general/concepts/scripts.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Scripts
2+
3+
In Experiment Source, Lua scripts define functionality and gameplay logic. These scripts are stored in the `<experiment directory>/scripts/lua/auto_load` directory. Scripts in this directory are automatically loaded when the game starts on [both the client and server realms](realms.md).
4+
5+
To create auto-loaded scripts for only the client or server, place them in the `<experiment directory>/scripts/lua/client` or `<experiment directory>/scripts/lua/server` directories, respectively.
6+
7+
## Writing Scripts
8+
9+
Scripts are written in Lua, a lightweight, high-level programming language. Lua is easy to learn and use, making it an excellent choice for modding and game development.
10+
11+
### Example
12+
13+
Here is a simple script that prints a message to the console when the game starts:
14+
15+
```lua
16+
print("Hello, world!")
17+
```
18+
19+
Place this script in the `<experiment directory>/scripts/lua/auto_load` directory. Then start Experiment Source to see the message in the console.
20+
21+
### Code Editor Recommendations
22+
23+
When writing Lua scripts, we recommend using a code editor with syntax highlighting and code completion. Some popular code editors for Lua development include:
24+
25+
- (Recommended) [Visual Studio Code](https://code.visualstudio.com/)
26+
27+
- [NeoVim](https://neovim.io/)
28+
29+
- [Sublime Text](https://www.sublimetext.com/)
30+
31+
We recommend Visual Studio Code for its extensive Lua support and ease of use. You can install the [Lua Language Server](https://marketplace.visualstudio.com/items?itemName=sumneko.lua) extension to enhance your Lua development experience.
32+
33+
??? note "Future Support"
34+
In the future, we plan to provide definitions for our API in the form of a [LuaLS Addon](https://luals.github.io/wiki/addons/), similar to [this LuaLS Addon for Garry's Mod](https://github.com/luttje/glua-api-snippets)

docs/general/conventions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 📔 Conventions
1+
# Conventions
22

33
!!! warning
44

docs/general/goals-and-roadmap.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,21 @@ In order to provide complete transparency, we have outlined the goals of Experim
7171
This way we can document the API as we go, reducing the slog of documenting everything at once.
7272
Additionally this recurring task adds some more variation to our development process.
7373

74+
- [x] **TF2 SDK Merged:**
75+
76+
The TF2 SDK has been merged into Experiment to provide support for:
77+
- NextBot AI
78+
- VScript
79+
- 64-bit binaries
80+
- WebM video playback
81+
- Vulkan renderer
82+
- Radial Fog
83+
- Swaying Trees
84+
85+
*See [the ValveSoftware Developer Wiki](https://developer.valvesoftware.com/wiki/Team_Fortress_2_engine_branch) for more features and information*
86+
87+
- [ ] Ability to spawn what Garry's Mod calls "effects" (prop_static models) in the world.
88+
7489
- [ ] *TODO: More tasks*
7590

7691
### **`v0.2`**: ???

docs/general/welcome.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ With this wiki we aim to provide reference material for the Lua API, as well as
55

66
With Experiment we aim to help you quickly prototype Source Engine mods without having to write any C++ code.
77

8+
!!! warning
9+
10+
Experiment is still in development and the Lua API is subject to change. Right now is not
11+
the best time to use it for a large project. Instead, we recommend using it for playing around
12+
with the API and providing feedback to us.
13+
814
## First Steps
915

1016
Depending on your experience we recommend the following steps to get familiar with the Experiment Lua API:

0 commit comments

Comments
 (0)