Skip to content

Commit 16862f4

Browse files
[wiki] Add tons of examples to every single function enum and struct in the lib
1 parent 0b72fac commit 16862f4

23 files changed

+259
-33
lines changed

wiki/README.md

Lines changed: 10 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
1-
# 🏠 The Art of CORE
2-
3-
## 🤗 Welcome to the Official CORE Documentation 📚
4-
5-
Read it carefully, there are many helpful tidbits hidden in here.
6-
7-
Especially the [tips & tricks section](tips_and_tricks) down below and the tip boxes in the [Core Library Pages](core_library/README) can be incredibly helpful.
8-
9-
Reading the documentation sucks, but it was handwritten to be as helpful as possible and is worth a skim. If there was a question that the documentation didn't answer, please let us know so we can tell you and improve the documentation.
1+
> 🤗 Welcome to the Official CORE Wiki, Documentation & Reference 📚
102
113
# 👾 What is CORE?
124

@@ -20,10 +12,6 @@ You can receive gems by having your units attack the gem deposits on the map or
2012

2113
# 🚀 Getting Started with Your Own CORE Bot
2214

23-
To start building your own CORE bot, ensure you've completed the following prerequisites:
24-
25-
### Prerequisites
26-
2715
1. **Be a Registered CORE Participant/Team**
2816
- Visit our website, [COREGAME.de](https://coregame.de/), sign up, join the right event, and add your team members.
2917

@@ -33,25 +21,17 @@ To start building your own CORE bot, ensure you've completed the following prere
3321
3. **Follow the README in the repository** 📧
3422
- Basically, run `make devcontainer`, and then you can get started! Compile using `make`, visualizer to view the games is under `localhost:4000`, everything in `src/` will be compiled into your bot.
3523

36-
🎉 **You are now ready to start coding!** 😎
37-
3824
4. **Push some code!** 🔝
39-
- The code you pushed will be used to execute games in the queue and in the final tournament. So make sure to push your code regularly and use to queue to test your bot against other participants!
40-
41-
### 🔎 Get into Core Game!
42-
43-
Look at all the different [Core Game Library Info Pages](core_library/README) in the sidebar to get sense of how things work! This wiki is your key to the trophy. 🏆
44-
45-
### Play and test against other Teams 🎮
25+
- The code you pushed will be used to execute games in the queue and in the final tournament. So make sure to push your code & test it against other players regularly!
4626

47-
Once the default test bot is too boring and you always win, feel free to share your compiled bot with other teams and play against them. You can do this via the queue feature on the website or locally. Of course, you can't force them but it might benefit both of you to see your bots in _real_ action.
48-
49-
# 🏆 To win the event
50-
51-
> Don't overcomplicate things! Simple but well-balanced bots may often reign over overcomplicated but ineffective bots.
27+
🎉 **You are now ready to start coding!** 😎
5228

53-
> Play against other players as often as possible!
29+
# 🏆 The Five Sacred Laws of Core Game Victory 👑
5430

55-
> Have fun! Don't take things too seriously & be nice to each other. Embrace the good vibes in a friendly competition! ⚡️
31+
1. **Simplicity is Strength** - A simple, balanced bot will crush an overcomplicated mess. Build, test, refine — step by step, one small feature at a time.
32+
2. **Battle is the Best Teacher** - No plan survives first contact. Face off against others as often as possible; every loss is data, every win is progress.
33+
3. **Knowledge is power** - Master the documentation, understand every function you wield. A wise coder outplays a reckless but fast one every single time.
34+
4. **Unity is Might** - Team up if you can. Two brains debug faster than one, and strategy thrives on collaboration.
35+
5. **Have fun!** - Don't take things too seriously & be nice to each other. Embrace the good vibes in a friendly competition! ⚡️
5636

57-
Good luck from the CORE team! 🚀🎸🔥💥🗿
37+
***Good luck*** **from the CORE team!** 🚀🎸🔥💥🗿

wiki/basics.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
The game is set on a square grid filled with objects.
22
- There can only ever be one object at one position, no more.
33
- Each object has a unique, unchanging id.
4+
- The memory location of objects may change between ticks.
45

56
There is a central server that stores the game state. Each bot sends packets back and forth with the server.\
67
Once per tick each clients local game state is updated.

wiki/documentation/cooldowns.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,17 @@ e.g.:
2222
## Core Spawn Cooldown
2323

2424
The core spawn cooldown is more straightforward, after a new unit was spawned, it is simply reset to a static config-defined value.
25+
26+
## Examples
27+
28+
```c
29+
int ft_util_actionCooldown(t_obj *unit)
30+
{
31+
t_unit_config *uconf = core_get_unitConfig(unit->s_unit.unit_type);
32+
unsigned int gems = max(unit->s_unit.gems, 1);
33+
unsigned int ac = uconf->baseActionCooldown + gems / uconf->balancePerCooldownStep;
34+
if (ac > uconf->maxActionCooldown) ac = uconf->maxActionCooldown;
35+
if (ac < 1) ac = 1;
36+
return (ac);
37+
}
38+
```
Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,22 @@
1-
// TODO
1+
## Playing against others locally
2+
3+
Have the person you want to play against send them their executable. In their cloned git repo, it will be created under `my-core-bot/bot`.
4+
5+
```bash
6+
/core/server /workspace/configs/server.config.json /workspace/configs/game.config.json /core/data 42 43 > /dev/null &
7+
./PATH_TO_PLAYER_1_EXECUTABLE 42 > /dev/null &
8+
./PATH_TO_PLAYER_2_EXECUTABLE 43
9+
```
10+
11+
Running the following code will start a game of the player 1 executable against the player 2 executable.
12+
13+
## Playing against others online
14+
15+
Once you have pushed some code, you can compete on the website in the queue or tournament.
16+
17+
The queue will pit random people that join the queue at a similar time against each other.\
18+
The tournament will at the end determine the winner of your event.
19+
20+
Using the queue often is a great idea to see how good your bot is in what aspects of Core Game.
21+
22+
If your code runs locally but not on the website, you may want to have a look at the [website setup guide](website_setup).

wiki/documentation/website_setup.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ This page is focused around making sure your bot can properly run on the website
22

33
> Generally, you don't need to worry about going through this page, just test that your bot runs on the website once and you'll be fine. As long as you keep the folder name `my-core-bot` and not modify the `my-core-bot/Makefile`, your bot will run fine on the website. If your bot doesn't run on the website though, this is the page for you.
44
5-
> For more details read this. Website runs are stricter than local.
6-
75
# What the Website Expects
86

97
- **Repository layout**: Your bot source must live at `my-core-bot/` at the repo root.

wiki/reference/config/function core_get_unitConfig(...).md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,12 @@ t_unit_config *core_get_unitConfig(t_unit_type type);
2222
2323
## Examples
2424
25+
```c
26+
t_unit_config *uconf = core_get_unitConfig(UNIT_MINER);
27+
if (ft_get_core_own()->s_core.gems >= uconf->cost)
28+
{
29+
core_action_createUnit(UNIT_MINER);
30+
}
31+
```
32+
2533
## Related

wiki/reference/config/function core_print_config().md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,15 @@ void
2222
2323
## Examples
2424
25+
```c
26+
void ft_on_tick(unsigned long tick)
27+
{
28+
if (tick == 0)
29+
{
30+
core_print_config();
31+
}
32+
// ...
33+
```
34+
35+
2536
## Related

wiki/reference/config/function core_print_config_game().md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,14 @@ void
2222
2323
## Examples
2424
25+
```c
26+
void ft_on_tick(unsigned long tick)
27+
{
28+
if (tick == 0)
29+
{
30+
core_print_config_game();
31+
}
32+
// ...
33+
```
34+
2535
## Related

wiki/reference/config/function core_print_config_unit(...).md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,13 @@ void
2222
2323
## Examples
2424
25+
```c
26+
printf("Warrior Config: \n");
27+
core_print_config_unit(UNIT_WARRIOR);
28+
printf("Miner Config: \n");
29+
core_print_config_unit(UNIT_MINER);
30+
printf("Carrier Config: \n");
31+
core_print_config_unit(UNIT_CARRIER);
32+
```
33+
2534
## Related

wiki/reference/config/struct t_config.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,13 @@ typedef struct s_config
5353

5454
## Examples
5555

56+
```c
57+
void ft_on_tick(unsigned long tick)
58+
{
59+
if (tick < game.config.idle_income_timeout)
60+
{
61+
// focus less on miner & carrier spawning
62+
// ...
63+
```
64+
5665
## Related

0 commit comments

Comments
 (0)