README.md

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

# A self-contained C# game in 8 kB

This repo is a complement to my [article on building an 8 kB self-contained game in C#](https://medium.com/@MStrehovsky/building-a-self-contained-game-in-c-under-8-kilobytes-74c3cf60ea04?sk=334b06f72dad47f15d0ba0cc6a502487). By self-contained I mean _this 8 kB C# game binary doesn't need a .NET runtime to work_. See the article on how that's done.

The project files and scripts in this repo build the same game (Snake clone) in several different configurations, each with a different size of the output.

😱 Scroll all the way down for instructions on how to run this on DOS.

![Snake game](SeeSharpSnake.gif)

## Building

### To build the 65 MB version of the game

```
dotnet publish -r win-x64 -c Release
```

### To build the 25 MB version of the game

```
dotnet publish -r win-x64 -c Release /p:PublishTrimmed=true
```

### ⚠️ WARNING: additional requirements needed for the below configuration

Make sure you have Visual Studio 2019 installed (Community edition is free) and include C/C++ development tools with Windows SDK (we need a tiny fraction of that - the platform linker and Win32 import libraries).

### To build the 4.7 MB version of the game

```
dotnet publish -r win-x64 -c Release /p:Mode=CoreRT
```

### To build the 4.3 MB version of the game

```
dotnet publish -r win-x64 -c Release /p:Mode=CoreRT-Moderate
```

### To build the 3.0 MB version of the game

```
dotnet publish -r win-x64 -c Release /p:Mode=CoreRT-High
```

### To build the 1.2 MB version of the game

```
dotnet publish -r win-x64 -c Release /p:Mode=CoreRT-ReflectionFree
```

### To build the 10 kB version of the game

```
dotnet publish -r win-x64 -c Release /p:Mode=CoreRT-NoRuntime
```

### To build the 8 kB version of the game

后面还有 72 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。