Update
This commit is contained in:
parent
39b1169fbf
commit
477726aee2
5 changed files with 36 additions and 6 deletions
4
cache.md
4
cache.md
|
@ -23,4 +23,6 @@ fast access.
|
||||||
fast slowish super slow extremely slow
|
fast slowish super slow extremely slow
|
||||||
```
|
```
|
||||||
|
|
||||||
*Cache resides very close to the CPU within the memory hierarchy.*
|
*Cache resides very close to the CPU within the memory hierarchy.*
|
||||||
|
|
||||||
|
TODO: code
|
2
game.md
2
game.md
|
@ -107,7 +107,7 @@ Some games are pretty based as they don't even require [GUI](gui.md) and are onl
|
||||||
|
|
||||||
Another kind of cool games are computer implementations of non-computer games, for example [chess](chess.md), [backgammon](backgammon.md), [go](go.md) or various card games. Such games are very often well tested and fine-tuned gameplay-wise, popular with active communities and therefore [fun](fun.md), yet simple to program with many existing free implementations and good AIs (e.g. GNU chess, GNU go or [Stockfish](stockfish.md)). What's more, they are also many times completely [public domain](public_domain.md)!
|
Another kind of cool games are computer implementations of non-computer games, for example [chess](chess.md), [backgammon](backgammon.md), [go](go.md) or various card games. Such games are very often well tested and fine-tuned gameplay-wise, popular with active communities and therefore [fun](fun.md), yet simple to program with many existing free implementations and good AIs (e.g. GNU chess, GNU go or [Stockfish](stockfish.md)). What's more, they are also many times completely [public domain](public_domain.md)!
|
||||||
|
|
||||||
{ There is a great lost world of nice old-style games that used to be made for old dumb phones with [Java](java.md) (J2ME) -- between about 2000 and 2010 there were tons and tons of quality Java mobile games that had e.g. entire magazines dedicated solely to them. These games are mostly lost and impossible to find, even videos of them, but if you can somehow get your hands on some of those old magazines, you're in for a great nostalgia trip. ~drummyfish }
|
{ There is a great lost world of nice old-style games that used to be made for old dumb phones with [Java](java.md) (J2ME) -- between about 2000 and 2010 there were tons and tons of quality Java mobile games that had e.g. entire magazines dedicated solely to them. These games are mostly lost and impossible to find, even videos of them, but if you can somehow get your hands on some of those old magazines, you're in for a great nostalgia trip. Check out e.g. *Stolen in 60 seconds*, *Alien Shooter 3D*, *Gangstar* ([GTA](gta.md) clone), *Playman World Soccer*, *Paid to Kill*, *Tibia Online*, *Ancient Empires*, *Legacy* (dungeon crawler), *Townsmen*, *Juiced 3D*, *Midtown Madness* and myriad of others. ~drummyfish }
|
||||||
|
|
||||||
### Games As LRS
|
### Games As LRS
|
||||||
|
|
||||||
|
|
|
@ -51,6 +51,7 @@ These are mainly for [C](c.md), but may be usable in other languages as well.
|
||||||
- **You can optimize critical parts of code in [assembly](assembly.md)**, i.e. manually write the assembly code that takes most of the running time of the program, with as few and as inexpensive instructions as possible (but beware, popular compilers are very smart and it's often hard to beat them). But note that such code loses [portability](portability.md)! So ALWAYS have a C (or whatever language you are using) [fallback](fallback.md) code for other platforms, use [ifdefs](ifdef.md) to switch to the fallback version on platforms running on different assembly languages.
|
- **You can optimize critical parts of code in [assembly](assembly.md)**, i.e. manually write the assembly code that takes most of the running time of the program, with as few and as inexpensive instructions as possible (but beware, popular compilers are very smart and it's often hard to beat them). But note that such code loses [portability](portability.md)! So ALWAYS have a C (or whatever language you are using) [fallback](fallback.md) code for other platforms, use [ifdefs](ifdef.md) to switch to the fallback version on platforms running on different assembly languages.
|
||||||
- **Loop unrolling/splitting/fusion, function inlining etc.**: there are optimizations that are usually done by high level languages at [assembly](assembly.md) level (e.g. loop unrolling physically replaces a loop by repeated commands which gains speed but also makes the program bigger). However if you're writing in assembly or have a dumb compiler (or are even writing your own) you may do these manually, e.g. with macros/templates etc. Sometimes you can hint a compiler to perform these optimizations, so look this up.
|
- **Loop unrolling/splitting/fusion, function inlining etc.**: there are optimizations that are usually done by high level languages at [assembly](assembly.md) level (e.g. loop unrolling physically replaces a loop by repeated commands which gains speed but also makes the program bigger). However if you're writing in assembly or have a dumb compiler (or are even writing your own) you may do these manually, e.g. with macros/templates etc. Sometimes you can hint a compiler to perform these optimizations, so look this up.
|
||||||
- **[Parallelism](parallelism.md) ([multithreading](multithreading.md), [compute shaders](compute_shader.md), ...) can astronomically accelerate many programs**, it is one of the most effective techniques of speeding up programs -- we can simply perform several computations at once and save a lot of time -- but there are a few notes. Firstly not all problems can be parallelized, some problem are sequential in nature, even though most problems can probably be parallelized to some degree. Secondly it is hard to do, opens the door for many new types of bugs, requires hardware support (software simulated parallelism can't work here of course) and introduces [dependencies](dependency.md); in other words it is huge [bloat](bloat.md), we don't recommend parallelization unless a very, very good reason is given. Optional use of [SIMD](simd.md) instructions can be a reasonable midway to going full parallel computation.
|
- **[Parallelism](parallelism.md) ([multithreading](multithreading.md), [compute shaders](compute_shader.md), ...) can astronomically accelerate many programs**, it is one of the most effective techniques of speeding up programs -- we can simply perform several computations at once and save a lot of time -- but there are a few notes. Firstly not all problems can be parallelized, some problem are sequential in nature, even though most problems can probably be parallelized to some degree. Secondly it is hard to do, opens the door for many new types of bugs, requires hardware support (software simulated parallelism can't work here of course) and introduces [dependencies](dependency.md); in other words it is huge [bloat](bloat.md), we don't recommend parallelization unless a very, very good reason is given. Optional use of [SIMD](simd.md) instructions can be a reasonable midway to going full parallel computation.
|
||||||
|
- **Optimizing [data](data.md)**: it's important to remember we can optimize both algorithm AND data, for example in a 3D game we may simplify our 3D models, remove parts of a level that will never be seen etc.
|
||||||
- **Specialized hardware (e.g. a [GPU](gpu.md)) astronomically accelerates programs**, but as with the previous point, portablity and simplicity greatly suffers, your program becomes bloated and gains dependencies, always consider using specialized hardware and offer software fallbacks.
|
- **Specialized hardware (e.g. a [GPU](gpu.md)) astronomically accelerates programs**, but as with the previous point, portablity and simplicity greatly suffers, your program becomes bloated and gains dependencies, always consider using specialized hardware and offer software fallbacks.
|
||||||
- **Smaller code may also be faster** as it allows to fit more instructions into [cache](cache.md).
|
- **Smaller code may also be faster** as it allows to fit more instructions into [cache](cache.md).
|
||||||
- Do not optimize everything and for any cost: optimization often makes the code more cryptic, it may [bloat](bloat.md) it, bring in more bugs etc. Only optimize if it is worth the prize. { from *Game Programming Gurus* -drummyfish }
|
- Do not optimize everything and for any cost: optimization often makes the code more cryptic, it may [bloat](bloat.md) it, bring in more bugs etc. Only optimize if it is worth the prize. { from *Game Programming Gurus* -drummyfish }
|
||||||
|
|
|
@ -1,5 +1,31 @@
|
||||||
# Raycastlib
|
# Raycastlib
|
||||||
|
|
||||||
TODO
|
Raycastlib (RCL) is a [public domain](public_domain.md) ([CC0](cc0.md)) [LRS](lrs.md) [C](c.md) [library](library.md) for advanced 2D [raycasting](raycasting.md), i.e. ["2.5D/pseudo3D"](pseudo3d.md) [rendering](3d_rendering.md). It was made by [drummyfish](drummyfish.md), initially as an experiment for [Pokitto](pokitto.md) -- later he utilized the library in his game [Anarch](anarch.md). It is in spirit similar to his other LRS libraries such as [small3dlib](small3dlib.md) and [tinyphysicsengine](tinyphysicsengine.md); just as those raycastlib is [kept extremely simple](KISS.md), it is written in pure C99, with zero dependencies (not even [standard library](stdlib.md)), it's written as a single file single header library, using no [floating point](float.md) and tested to run interactively even on very weak devices (simplified version was made run on [Arduboy](arduboy.md) with some 2 KiB of RAM). It is very flexible thanks to use of [callbacks](callback.md) for communication, allowing e.g. programming arbitrary "[shader](shader.md)" code to implement all kinds of effects the user desires or using [procedurally generated](procgen.md) environments without having to store any data. The library implements advanced features such as floor and ceiling with different heights, textured floor, opening door, simple [collision detection](collision_detection.md) etc.
|
||||||
|
|
||||||
The repository is available at https://codeberg.org/drummyfish/raycastlib.
|
The repository is available at https://codeberg.org/drummyfish/raycastlib.
|
||||||
|
|
||||||
|
```
|
||||||
|
................................................................................
|
||||||
|
................................................................................
|
||||||
|
................................................................................
|
||||||
|
................................................................................
|
||||||
|
................................................................................
|
||||||
|
................................................................................
|
||||||
|
...........XXXXXXXXXXXX/..........XXXXXXXXXXXXXXXXXXXXXX.......................o
|
||||||
|
...........XXXXXXXXXXXX////.......XXXXXXXXXXXXXXXXXXXXXX......................oo
|
||||||
|
XXXXXXXXXXXXXXXXXXXXXXX//////.....XXXXXXXXXXXXXXXXXXXXXX...............ooooooooo
|
||||||
|
XXXXXXXXXXXXXXXXXXXXXXX/////////..XXXXXXXXXXXXXXXXXXXXXX........oooooooooooooooo
|
||||||
|
XXXXXXXXXXXXXXXXXXXXXXX//////////.XXXXXXXXXXXXXXXXXXXXXXXXXXXooooooooooooooooooo
|
||||||
|
XXXXXXXXXXXXXXXXXXXXXXX//////////XXXXXXXXXXXXXXXXXXXXXXXXXXXXooooooooooooooooooo
|
||||||
|
XXXXXXXXXXXXXXXXXXXXXXX//////////.XXXXXXXXXXXXXXXXXXXXXXXXXXXooooooooooooooooooo
|
||||||
|
XXXXXXXXXXXXXXXXXXXXXXX/////////..XXXXXXXXXXXXXXXXXXXXXX........oooooooooooooooo
|
||||||
|
XXXXXXXXXXXXXXXXXXXXXXX//////.....XXXXXXXXXXXXXXXXXXXXXX...............ooooooooo
|
||||||
|
...........XXXXXXXXXXXX////.......XXXXXXXXXXXXXXXXXXXXXX......................oo
|
||||||
|
...........XXXXXXXXXXXX/..........XXXXXXXXXXXXXXXXXXXXXX.......................o
|
||||||
|
................................................................................
|
||||||
|
................................................................................
|
||||||
|
................................................................................
|
||||||
|
................................................................................
|
||||||
|
```
|
||||||
|
|
||||||
|
*Simple rendering made with raycastlib.*
|
|
@ -47,11 +47,12 @@ These are some notable software renderers:
|
||||||
- **[Irrlich](irrlicht.md)**: [FOSS](foss.md) game engine including a software renderer as one of its [backends](backend.md).
|
- **[Irrlich](irrlicht.md)**: [FOSS](foss.md) game engine including a software renderer as one of its [backends](backend.md).
|
||||||
- **[Jedi](jedi_engine.md)**: Old proprietary "pseudo3D" engine.
|
- **[Jedi](jedi_engine.md)**: Old proprietary "pseudo3D" engine.
|
||||||
- **[Mesa](mesa.md)**: [FOSS](foss.md) implementation of [OpenGL](opengl.md) that includes a software rasterizer.
|
- **[Mesa](mesa.md)**: [FOSS](foss.md) implementation of [OpenGL](opengl.md) that includes a software rasterizer.
|
||||||
- **[raycastlib](raycastlib.md)**: [LRS](lrs.md) [C](c.md) 2D raycasting ("2.5D") engine most notably used in [Anarch](anarch.md).
|
- **[raycastlib](raycastlib.md)**: [LRS](lrs.md), free [C](c.md) 2D raycasting ("2.5D") engine most notably used in [Anarch](anarch.md).
|
||||||
- **[small3dlib](small3dlib.md)**: [LRS](lrs.md) pure [C](c.md) "true 3D" rasterizer, very simple but flexible and coming with all the high level features (textures, perspective correction etc.).
|
- **[small3dlib](small3dlib.md)**: [LRS](lrs.md), free pure [C](c.md) "true 3D" rasterizer, very simple but flexible and coming with all the high level features (textures, perspective correction etc.).
|
||||||
- **[SSRE](ssre.md)**: The guy who wrote [LIL](lil.md) also made this renderer named Shitty Software Rendering Engine, accessible [here](http://runtimeterror.com/tech/ssre/).
|
- **[SSRE](ssre.md)**: The guy who wrote [LIL](lil.md) also made this renderer named Shitty Software Rendering Engine, accessible [here](http://runtimeterror.com/tech/ssre/).
|
||||||
- **[System Shock](system_shock.md) engine**: Old proprietary game engine.
|
- **[System Shock](system_shock.md) engine**: Old proprietary game engine.
|
||||||
- **[TinyGL](tinygl.md)**: Implements a subset of [OpenGL](opengl.md).
|
- **[TinyGL](tinygl.md)**: Implements a subset of [OpenGL](opengl.md).
|
||||||
|
- **[Tomb Raider](tomb_raider.md)**: Famous 90s game with custom software 3D renderer.
|
||||||
- **[Ultima underworld](ultima_underworld.md)**: Proprietary game featuring a very early (1992) texture mapped software 3D renderer.
|
- **[Ultima underworld](ultima_underworld.md)**: Proprietary game featuring a very early (1992) texture mapped software 3D renderer.
|
||||||
- **old [Unreal Engine](unreal_engine.md)**: One of the most mainstream popular proprietary engines nowadays featured software rendering fallbacks in early versions.
|
- **old [Unreal Engine](unreal_engine.md)**: One of the most mainstream popular proprietary engines nowadays featured software rendering fallbacks in early versions.
|
||||||
- In general many old [games](game.md) in the 90s implemented their own software renderers. Also games on non-3D consoles such as [Gameboy Advance](gba.md) sometimes attempted simple software rendering 3D. These are the places where you can look for interesting renderers of this kind.
|
- In general many old [games](game.md) in the 90s implemented their own software renderers. Also games on non-3D consoles such as [Gameboy Advance](gba.md) sometimes attempted simple software rendering 3D. These are the places where you can look for interesting renderers of this kind.
|
||||||
|
|
Loading…
Reference in a new issue