summaryrefslogtreecommitdiff
path: root/README.md
blob: e094da756f448f2034ca81c87a90b0e46558c82e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
Daw
===

This branch contains the work of moving the engine to OpenGL, using GLFW & GLAD.

Everything is getting rewritten.

---

Daw is yet another hobby WIP game engine.

It is written in C99 and can be compiled and linked to easily in any CMake
project.

Currently it supports a very limited set of features:

* Layer based input handling,
* Window creation & 3D rendering,
* Hot reloading
* Resource handling
* Memory handling
* ~~UI~~
* Logging

As well as a limited set of 2D grid-based game utilities:
* Pathfinding
* FOV calculations using shadowcasting

The engine is build around states. This means the developer needs to provide
initialize, update, and cleanup functions for each game state (states such as
"title screen", "game running", and such).
The whole project is made to be easily managed using CMake (yes, I too wonder
why sometimes).

Currently the only "supported" platform is linux. I do plan on adding windows
support in the future.

I plan on documenting how to use the engine as soon as I stop modifying the API,
and plan out a more solid organizational strategy for the project as a whole.

See [this CMakeLists.txt][0] to get an idea of how to use this project.

## Building

_At the moment building with statically linking is borked._

### Dependencies

These are the dependencies that you likely need to install yourself.

* assimp
* glad
* glfw
* stb

Other dependencies are pulled automatically.


### Building fr

Generate the build files using
```
cmake -S . -B build
```

And build the project with
```
cmake --build build
```

This should, in theory, build the engine as a shared library and run without any
warnings nor errors.

The way the engine is designed, it is very useless as a shared library, and does
nothing if it is not configured as a subproject of the "game" itself.
See [tools/cmake/DawAddState.cmake](tools/cmake/DawAddState.cmake) for more information.

## Planned features

This is an incomplete list of features that are either under development or
planned to implement.

* Audio
* GLFW & OpenGL
* Better cross platform support (ie. windows)

## Remaining work before mergin this branch
This section exists to provide an overview of the tasks that needs to be done
before merging the glfw branch back into master.
* [x] Batch rendering
  + Adding models now requires a transform.
  + We require `renderbatch_refresh` to finalize the renderobj buffer.
  + Still require `RenderObject_new` in the end, to make the buffers.
  + [ ] We also want enable the user to automatically generate IBO, by exposing
    some API call.
  + [ ] Should make a "`renderbatch_update_renderobject`" API, that uploads
    all the changed vertex data, possibly by using a `.dirty` flag.
  + [ ] Merge textures from RenderObjects into texture atlas
* [ ] (auto?) Index buffers
  + [ ] Missing IBO generation, should be easy,
    ```
    vertices[n][3]f32 |> sort (
      \original_idx pos_vec3 -> ({x,y,z}, original_idx) /* or possibly by morton codes/z-ordering */
    ) vertices |> sort-by-original_idx
    ```
  + [ ] Should also be possible with `assimp`
* [ ] Model loading of some sort
  + [ ] Should also be possible with `assimp`
* Revise rendering pipeline.
  + [ ] We should not rely on a single global `drawcalls` variable, instead we
    should render to textures and present those instead.
    - [ ] These should be resized with the window
  + [ ] Should be passed as parameter. _we want to completely get rid of
    `GLOBAL_PLATFORM`_


[0]: https://github.com/0undefined/rogue/blob/a947b0092d91920d56eb9af6a39bd1bd05e145fc/CMakeLists.txt