Giter Club home page Giter Club logo

opensource's Introduction

Github build status Build Status Build status

OpenSource

A utility for loading and rendering many Source VBSP maps together as a single giant mesh. It can be used to see how big the game world is, just for amusement.

Current status

It is not production quality and is not ready for any professional and/or unsupervised use. It still has a lot of visual and other glitches. See issues. However, it should be generally stable. It does run on Raspberry Pi. The entire Half-Life 2 fits into < 512MiB video memory and renders ~1.5 million triangles at about 10fps.

If you wish, you could check out the old branch for a version from 2012 that was used for this video of entire Half-Life 1 world: https://www.youtube.com/watch?v=-SaRdQdW-Ik

What works

  • It builds and runs on Windows, Linux/X11 and Raspberry Pi (bare VideoCore libs, w/o X11); No macOS support yet, stay tuned.
  • VBSP format version 19 and 20, most of the maps from these games:
    • Half-Life: Source
    • Half-Life 2
    • Half-Life 2: Episode One
    • Half-Life 2: Episode Two
    • Portal
    • Portal 2. Well, somewhat. Its levels are not positioned correctly, requiring a lot of manual config patching, which has not been done.
  • Basic support for the following map features:
    • Face geometry
    • Displacements
    • Base[0] textures
    • DXT1/3/5 textures
    • Reading VPK2 files
    • Reading materials from pakfile lumps
    • Packing textures with ETC1 on Raspberry Pi (packer is very naive and probably broken)

Building

Requires CMake. Something like this:

cmake -E make_directory build
cmake . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

Getting binaries

If you don't want to build it yourself, you can find some pre-built Windows binaries in Releases

Running

Basically you point OpenSource binary to a cfg file. It should automatically load game resources from default Steam install directory. There is a couple of pre-made cfg files for a few games. You can find them in pre-built archives, or in misc/ directory of this repo.

Preconfigured games are:

  • hl1.cfg: Half-Life 1. For this you need to install "Half-Life: Source" game from Steam. Regular Half-Life won't work.
  • hl2.cfg: Half-Life 2.
  • hl2eps.cfg: Half-Life 2, including Episode One, and Episode Two. You need them to be installed from Steam.

Additional options:

  • -s -- specify Steam install directory if it's different from the default one.
  • -m -- add additional map to load at origin
  • -p -- add a custom VPK file to load resources from
  • -d -- add a custom directory to load resources from
  • -n -- specify a limit to number of maps to load

Notes:

  • Arguments order matters: options only apply to what follows them. E.g. ./OpenSource hl1.cfg -s <custom_steam_path> will not use <custom_steam_path> for loading resources for hl1.cfg, but ./OpenSource -s <custom_steam_path> hl1.cfg will.
  • cfg files are not strictly necessary, it is possible to load maps only using arguments. However, landmark patching functionality is only supported via cfg files.

Streaming (ON HOLD)

Development was done almost entirely live.

Stream links:

You can also check out previous streams recordings and stuff planned for next streams.

opensource's People

Contributors

mcmihai avatar phi-line avatar ptruser avatar w23 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

opensource's Issues

macOS support

Atto doesn't have proper support for macOS yet. Do it.

Multithreaded loader

  • load maps in parallel
  • load assets in parallel
  • convert textures to ETC in parallel

Read pakfile lump

There are a lot of materials that aren't found on loading. I expect that these are stored within bsp files themselves.
Pakfile lumps are zipped or something, so will have to figure that out too.

An idea how to remove skybox

I have an idea how to remove the skybox areas.

First, find the leaf in which info_player_start's "eyes" are placed. Push this leaf to the stack.

Then, until the stack is empty, repeat:

  1. Pop leaf from the stack.
  2. Mark popped leaf.
  3. For each visible leaf of that leaf:
    3.1) Check if it's not already marked. Proceed to 3.2 if it's not.
    3.2) Push the visible leaf to the stack.

Then, make a mesh containing only polygons from the marked leaves.

What do you think?


У меня есть идея, как убрать скайбоксы.

Сначала, найди тот лист, в котором находятся "глаза" info_player_start'а. Положи его на стек.

Затем, пока стек не стал пустым, выполняй следующие действия:

  1. Возьми лист со стека.
  2. Отметь его.
  3. С каждым видимым листом у этого листа:
    3.1) Проверь, не был ли он отмечен ранее. Если нет, переходи к 3.2.
    3.2) Положи этот лист на стек.

Потом, сделай меш, содержащий только полигоны из отмеченных листьев.

Как тебе идея?

Resources streaming

Load one map per frame. Don't make user wait ALMOST 4 SECONDS to load the entire HL2 world.

Missing textures

Some textures are visually missing, although loading log reports no missing materials or textures. Primary hypothesis is that I'm missing something important from Patch materials, because their supports is a hack even compared to other materials support.

Visible skybox seams

GL_CLAMP_TO_EDGE doesn't help.
Valve wiki suggests that it's a DXT issue (?).

Read VPK files directly

Currently for development vpk files contents are mounted using vpk_fuse. This is not cool. I cannot release like this.

  • read directory
  • sort entries
  • open archive fds
  • ICollection interface to alloc IFiles

Models support

Later Valve games like Episode One have larger part of maps made out of models rather than bsp geometry. Without models these maps look unnatural and empty.

Windows support

Probably limited to this:

  • file reader
  • file mmapper
  • gl function loader
  • make sure that atto doesn't have any obvious bugs on windows
  • grab mouse + WM_INPUT

d1_eli_01 map doesn't load

src/bsp.c:263: Error: no visible faces found
src/bsp.c:646: Error: bspLoadModelPreloadFaces() => BSPLoadResult_ErrorFileFormat
src/bsp.c:912: Error: bspLoadModel() => BSPLoadResult_ErrorFileFormat
src/OpenSource.c:275: Cannot load map "d1_eli_01": 2

Portal 2: support info_landmark_entry/exit mechanism

Portal 2 doesn't use neither named landmarks nor changelevel triggers with explicit next map name.
Instead, being completely linear, it uses global ordered map list with each map having info_landmark_entry and info_landmark_exit entities to stitch consecutive maps.

Make public release pipeline

There are people who want to run this on their machines.
Figure out how best to make release binaries for this project for at least Windows.

Load and render skyboxes

Current orange-brown background color is sad.

  • BGRA8 d2_coast_11
  • BGRX8 d1_canals_13
  • RGBA16F d2_prison_01
  • Texture "skybox/sky_day03_06Brt" not found d3_citadel_05

skybox/sky_day03_06B not found

In map d3_citadel_05

Apparently skyboxes are materials. And it is purely accidental that their textures can be loaded directly by concatenating bk.vtf or alike to material name.
This material is different. Need to load its material properly

Optimize renderer

The entire Half-Life 2 mesh is like 5fps on AMD Radeon FURY X. This is unacceptable.

Things to try in no particular order:

  • map frustum culling
  • face frustum culling
  • bsp node frustum or pvs culling
  • dynamic per-material batching of visible faces
  • pre-sort vertices by material for VBO offset 64k splitting
  • one giant VBO for the entire mesh
  • skip material and lightmap textures for distant maps, do baked color instead
  • combine most popular regular material textures into atlases to avoid splitting draw calls

Corrupted textures

Some textures look corrupted. Don't know why.
I mess up DXT reading?
I mess up calculating VTF offsets for DXT data?

Make a fly-by based on a speedrun

To achieve that one would need to parse *.dem files, extract player positions and play them.
Some sad facts:

  1. There is no publicly available specs on GoldSrc (most speedruns are made playing original HL, not Source) *.dem format that look legit.
  2. Source *.dem format (https://developer.valvesoftware.com/wiki/DEM_Format) suggests that the file itself contains just network packets, and common sense tells me that those should contain only player commands (input) and not much else. If this is right, then there's no way to extract player position without implementing the rest of the engine. Oh my!
    (However, Source SDK sources contain DEM parser that suggests that there really is a way to extract just a player position without processing actual input, but I went no further in my preliminary investigation)

doesn't build in VS2017

The code doesn't build in VS2017 on Windows 10 Home. This is quite odd, the project should have been easy to migrate.

the include paths are not set up right (so it cant find the headers), and app_windows.c/.h are missing.

I can't wait to get this working though!

VR

It is trivial to do, but still somewhat time-consuming.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.