-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplanning.txt
134 lines (121 loc) · 8.93 KB
/
planning.txt
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
Levels:
- Final touches on the fortress map
- A castle level that's crazy high in the sky, where you can look down really far; and a mountain level, like Mount Fuji - running along the mountainside
- A level based on the Zhangjiajie region
- A map like this one: https://www.planetminecraft.com/project/the-sultans-palace-3351849/ (can look up similar Sultan maps for Minecraft)
- Maybe a level based in a lost city of gold
- A level with a Ziggurat in it somewhere (perhaps that'll be the pyramid level?)
Final lighting model:
- Note: too many fancy lighting effects may make the game look less retro, so set some hard limit to that.
- Ambient, diffuse, specular (with procedural specular mapping), HDR, banding removal, light color - done
- Perhaps make the shadows contact-hardening
- If I instance the texture ID across a whole sector, I can get 256 different textures per level
- A 3D texture with raytraced brightness values that range from 0 to 255, that then points in world-space can read from.
Then, the max size of that texture will be 16,581,375 for a 255x255x255 level. This will act as high-quality raytraced ambient occlusion. Optimization
note: I can skip tracing from points that are under the heightmap. Also, I should only trace upwards around a hemisphere, only darkening a point if it
hits another map point. I'll use DDA for this.
Shadow mapping:
- The glDrawArrays call in shadow mapping uses around 30% of my GPU time mostly because of the shadow map size
- ESM logarithmic space filtering: https://advances.realtimerendering.com/s2009/SIGGRAPH%202009%20-%20Lighting%20Research%20at%20Bungie.pdf
- Rescale the ESM constant based on the distance between the occluder and the receiver, maybe
- Filtering in exp(gl_FragCoord.z) may remove some shadow acne
- Make the billboards + a 2D character sprite cast shadows
Ideal CSM:
- Sector mesh optimization:
1. In high-speed memory. 2. Front faces pre-culled (result is half the size?).
3. Face info bits removed. 4. Additional faces added for external map edges.
- ESM.
Architectural/code design ideas:
- Catch more warnings with -Weverything
- File paths may not work on Windows
- Pass in texture parameters through a bitmask
- Tell if a level was just initialized through the Event struct
- Can store one more byte in a sector with it staying 16 bytes - maybe do something more with that? Perhaps store its texture id there?
- Perhaps use the texture id map as a texture, and use the other 5 bits in the face info bitset for something else (lighting params, if there's enough precision?)
- Define the constants in constants.h in constants.c, and make the constants.h struct extern
- Three classes of settings: hardcoded in the `constants` struct, configurable via a level file, and configurable by the player
- Some library memory leaks; this should be fixed in some way, if possible (figure out why `SDL_GetNumAllocations` is above zero after `deinit_screen`; even happens with a simple test app)
- Use more of the cglm functions in `update_camera`
- Possibly in the end, map representations: heightmap + texture id map, cpu mesh, gpu mesh, and culled mesh for shadow map
- Perhaps use just OpenGL + ImGUI for the editor
- Make all static billboards to animated (to simplify the code), if complexity doesn't increase too much because of that
- Use a compressed audio format in the end, instead of WAV (probably FLAC)
- Make `map_size_t` an alias for `byte` or `GLubyte`, and make an alias for `map_value_t` too
- Alpha to coverage with the title screen becomes really glitchy (perhaps need a VAO bound?)
- Jump heights with a lower framerate seems to be framerate-dependent (sometimes can jump a ton, and other times not so much)
- Texture compression as an option
- Figure out how to make spherically distorted skyboxes in Blender from cube-like ones made in an image editor
- A shader cache
- Specular antialiasing
- Allow for usage of a debug output context, if desired
- For constants in the `constants` struct, perhaps test their validity through some static assertions?
Or is that too much - checks for limits, which are used for checks for runtime constants?
- Perhaps build a level file system like this: a program that compiles a level json file into a binary file, that can then be cast as a pointer to a struct directly
- After the title screen init, there's some slowdown (much more with debug mode on)
- Perhaps some level file versions for different rendering quality settings
- Change uint8_t and byte to u8, and the same for uint16_t to u16 (same for all uint*_t types!)
- For range limiting in the json struct, perhaps keep a secondary layout struct that checks the corresponding range for the value, if applicable
Miscellaneous problems:
- The checker heightmap has faster pacing sometimes
- On the bigger laptop, changing the screen size leads to the player's head tilting briefly
- Changing the pyramid track `pyramid.wav` to any other filename removes its two stutters
- Using the raytraced AO map results in little white flickering dots
- It's slow up close for many objects like sectors and billboards (even without parallax mapping)
- See if a Z-prepass could lead to an increase in speed by rendering just one face at full resolution, up close
- Make the speed of mouse movement slower on Linux (it most likely has to do with high-DPI scaling, or something like that)
Object rendering:
- Up-and-down moving platforms that can also work as doors (continually up-and-down moving, down if player close, or down if action fulfilled)
- Some type of bridge object (perhaps not axis-aligned; just an arbitrary plane)
- A sector BVH, through metasector trees, also called binary r-trees (alloc through node pool).
Note: if these are also used for billboard frustum culling, they can be used for billboard collision detection as well.
Random feature ideas:
- A map editor that reads in a level file
Choose texture or height through number keys (done), draw/move/erase modes (done), line mode, save button, zoom in/out, scroll with the mouse.
- Can't use red cross for health since it's copyrighted
- Find a tighter far plane distance by finding the diameter of the sector convex hull
- The map editor should be called Dungeon Painter
- Perhaps build levels on top of cool terrain heightmaps, for a good surrounding environment + a level path through the terrain
- I can port the game to many more platforms if I reduce the graphics quality - which is the biggest bottleneck
Normal mapping:
- Improper shadow coverage at edges of objects leads to some in-shadow areas having normal map details shown
- Mipmaps of normal maps are not normalized, and they disappear at lower mip levels
(Generate mipmaps on the CPU, and verify that they can mipmap plain textures like glGenerateMipmap)
- Perhaps blur the surfaces on the GPU
- Share some of the looping logic for the Gaussian blur and the normal map generation
- Little odd rectangles exist in the marble texture (due to compression)? This shows up in the normal map
- Vary the normal map generation parameters based on the output texture size
- Define normal map settings for each wall texture (only useful at normal map generation time).
Choose a hash map or an array for association between path and settings
- Note: normal maps calculated via dFdx/y won't work because 1. derivatives are in screen space and 2. normals can then not be filtered
- Test a Minecraft parallax mapping shader, and see if it has any swimming - if not, then figure out what they're doing
Physics:
Features:
- Sliding across the floor (with the head tilted up), or crouching (either for avoiding enemy projectiles)
- If hitting a wall, base the player's speed on the dot product of your 2D direction vector
and the wall's normal vector (perhaps find the wall vector from my movement delta). Axis where
no moving happened indicates normal vector orientation. If below tile pos, bottom tile; otherwise, top tile.
Same idea for side tiles.
Problems:
- Pressing left + forward and backward doesn't stop moving on the X axis
- A half-stutter when pressing towards a wall and then letting go of a movement key
- The first few position deltas are 0 for x and z, for some reason
The title screen:
- Only go to the next window once the mouse is raised (this should also stop the weapon usage from carrying over)
Other:
- Sultan or vizier?
- Set up a little website for the game, with various video clips of gameplay
- Perhaps the Shabti should blink
- A 3D character model that casts a shadow (or a flat one, like the weapon - like paper Mario?)
- Very short, but memorable little audio tracks that play for the cutscenes
- The player's shadow billboard should have idle, run, jump, and attack animations
- Documentation for the fields of the level file format (output a HTML file)
End components:
- Static sectors
- Dynamic sectors
- Bridges (perhaps instead of dynamic sectors)
- Billboards (unanimated and animated)
- Skybox
- Weapon
- Billboard subbatches that all have the same texture id and size; intended for repeats like grass or particles. Should they share a bounding box?
- HUD
- UI