Skip to content

Commit

Permalink
new docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Jan 20, 2024
1 parent 6d0f912 commit 13db9fa
Show file tree
Hide file tree
Showing 41 changed files with 72 additions and 21 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion next/dojo-book/docs/pages/cairo/hello-dojo.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ mod actions {
// impl: implement functions specified in trait
#[external(v0)]
#[abi(embed_v0)]
impl ActionsImpl of IActions<ContractState> {
// ContractState is defined by system decorator expansion
fn spawn(self: @ContractState) {
Expand Down
4 changes: 2 additions & 2 deletions next/dojo-book/docs/pages/cairo/migration/0.3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ Ensure the trait is typed with `TContractState`.

To implement the interface:

1. Add `#[external(v0)]` before each method.
1. Add `#[abi(embed_v0)]` before each method.
2. Ensure to reference the created interface in the module with `use super::ICreateCard;`.

```rust,ignore
#[external(v0)]
#[abi(embed_v0)]
impl CreateCardImpl of ICreateCard<ContractState> {
fn create_card(
self: @ContractState,
Expand Down
2 changes: 1 addition & 1 deletion next/dojo-book/docs/pages/cairo/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ mod spawnHuman {
const COUNTER_ID: u32 = 9999999999999;
// impl: implement functions specified in trait
#[external(v0)]
#[abi(embed_v0)]
impl GoblinActionsImpl of IGoblinActions<ContractState> {
fn goblin_actions(self: @ContractState, entity_id: u32) {
let world = self.world_dispatcher.read();
Expand Down
2 changes: 1 addition & 1 deletion next/dojo-book/docs/pages/cairo/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ mod player_actions {
use super::{Position, Vec2};
use super::IPlayerActions;
#[external(v0)]
#[abi(embed_v0)]
impl PlayerActionsImpl of IPlayerActions<ContractState> {
//
// This is how we interact with the world contract.
Expand Down
4 changes: 2 additions & 2 deletions next/dojo-book/docs/pages/cairo/systems.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ mod player_actions {
struct Storage {}
// implementation of the PlayerActions interface
#[external(v0)]
#[abi(embed_v0)]
impl PlayerActionsImpl of IPlayerActions<ContractState> {
fn spawn(self: @ContractState, world: IWorldDispatcher) {
let player = get_caller_address();
Expand Down Expand Up @@ -103,7 +103,7 @@ mod player_actions {
}
// impl: implement functions specified in trait
#[external(v0)]
#[abi(embed_v0)]
impl PlayerActionsImpl of IPlayerActions<ContractState> {
// ContractState is defined by system decorator expansion
fn spawn(self: @ContractState) {
Expand Down
21 changes: 21 additions & 0 deletions next/dojo-book/docs/pages/getting-started.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Dojo The Provable Game Engine

Dojo is a provable game engine built using [Cairo](https://github.com/starkware-libs/cairo). It establishes a standard for game development via smart contracts, blending best practices with streamlined development and deployment tools. With Dojo by your side, you can evolve from initial concept to a fully realized game in days, not weeks.

This book is dedicated to familiarizing you with the Dojo engine and the potential of Provable games. A special section on the [Theory](./theory/autonomous-worlds.md) elucidates this emergent concept of autonomous worlds and Provable games.

- [Quickstart](./getting-started/quick-start.md)
- [What is Dojo? ](./theory/what-is-dojo.md)
- [Explore the Architecture](./cairo/overview.md)

> Dojo is an open-source onchain gaming project currently in its early development phase, and warmly welcomes contributors. For additional resources, join the community on [Discord](https://discord.gg/vUN4Xq9Qv6) and check out the [contribution guide](./misc/contributors.md).
---

### Organizational Structure

Dojo is an open-source initiative, licensed under Apache 2.0, dedicated to promoting and advancing the concept of Autonomous Worlds (AWs). It is spearheaded by [Cartridge](https://cartridge.gg/), [Realms & BibliothecaDAO](https://bibliothecadao.xyz/), [briq](https://briq.construction/) and many more [contributors](https://github.com/orgs/dojoengine/people).

### How do I get involved?

Check out our [Github](https://github.com/dojoengine), our [Twitter](https://twitter.com/dojostarknet), [Discord](https://discord.gg/vUN4Xq9Qv6) and [contribution guide](https://book.dojoengine.org/misc/contributors.html)
3 changes: 0 additions & 3 deletions next/dojo-book/docs/pages/getting-started.mdx

This file was deleted.

14 changes: 14 additions & 0 deletions next/dojo-book/docs/pages/images/Built with.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/ECS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/board.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/dojo-auth.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions next/dojo-book/docs/pages/images/dojo-mark-full-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/katana-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/katana.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/origami-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/origami.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/permissions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/slot-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/sozo-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/torii-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/unity/models.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/world-map.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added next/dojo-book/docs/pages/images/world_flow.png
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![dojo](/Dojo%20-%20Contracts.png)
![dojo](../images/Dojo%20-%20Contracts.png)

# What is Dojo?

Expand All @@ -18,7 +18,7 @@ Dojo offers a standardized approach to building games on smart contracts. Recogn

Utilizing the ECS (Entity Component System) as its core architecture, Dojo effectively manages the state and behavior of Autonomous Worlds (AWs). This model revolves around systems acting on entities, which are collections of pure data components. Systems efficiently determine which entities to process based on persistent queries over these components.

Read detailed information about the [Dojo ECS](/cairo/overview.md).
Read detailed information about the [Dojo ECS](../cairo/overview.md).

### [Torii](../toolchain/torii/overview.md) - Starknet Indexer

Expand Down
25 changes: 18 additions & 7 deletions next/dojo-book/docs/pages/toolchain/sozo/world-commands/model.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,30 @@
sozo model <COMMAND>

Commands:
get Get the class hash of a model
schema Retrieve the schema for a model
entity Get the model value for an entity
class-hash Get the class hash of a model
schema Retrieve the schema for a model
get Get the model value for an entity
```

### SUBCOMMANDS

#### `get`
**Note**: Before to execute the following subcommands, ensure you have added your `world address` to your Scarb.toml file.

```toml
[tool.dojo.env]
rpc_url = "http://localhost:5050/"
# Default account for katana with seed = 0
account_address = "0x517ececd29116499f4a1b64b094da79ba08dfd54a3edaa316134c41f8160973"
private_key = "0x1800000000300000180000000000030000000000003006001800006600"
world_address = "0x28f5999ae62fec17c09c52a800e244961dba05251f5aaf923afabd9c9804d1a"
```

#### `class-hash`

Get the class hash of a model

```sh
sozo model get <NAME>
sozo model class-hash <NAME>
```

##### Arguments
Expand All @@ -43,12 +54,12 @@ sozo model schema <NAME>
_`NAME`_
&nbsp;&nbsp;&nbsp;&nbsp;The name of the model

#### `entity`
#### `get`

Get the model value for an entity

```sh
sozo model entity <NAME> [KEYS]...
sozo model get <NAME> [KEYS]...
```

##### Arguments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Should be noted that `actions` is the contract name.
3. Write a `spawn` function that accepts the `white address`, and `black address` as input and set necessary states using `set!(...)`. Implement the `player` entity from player model. Implement the game entity, comprised of the `Game` model and `GameTurn` model we created in the `game.cairo` and implement the piece entities from a1 to h8 containing the correct `PieceType` in the `spawn` fn.

```rust,ignore
#[external(v0)]
#[abi(embed_v0)]
impl IActionsImpl of IActions<ContractState> {
fn spawn(
self: @ContractState, white_address: ContractAddress, black_address: ContractAddress
Expand Down
2 changes: 1 addition & 1 deletion next/dojo-book/docs/pages/tutorial/onchain-chess/2-move.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
1. Write a `move` function that accepts the `current position`, `next position`, `caller address`, and `game_id`. The `move` function should look like this:

```c
#[external(v0)]
#[abi(embed_v0)]
impl PlayerActionsImpl of IActions<ContractState> {
fn spawn(
self: @ContractState, white_address: ContractAddress, black_address: ContractAddress
Expand Down

0 comments on commit 13db9fa

Please sign in to comment.