GithubHelp home page GithubHelp logo

reactiion1337 / valve-bsp-parser Goto Github PK

View Code? Open in Web Editor NEW
101.0 7.0 30.0 238 KB

Valve BSP-file parser, written in modern C++

License: MIT License

C++ 97.14% CMake 2.86%
bsp bsp-parser valve-bsp valve-bsp-parser cpp parser

valve-bsp-parser's Introduction

valve-bsp-parser

Valve BSP-file parser, written in modern C++. This parser does only parse the basic .bsp tree and doesn't include a .vpk/.mdl parser/reader. Feel free to contribute ๐Ÿ˜Š

Requirements

  • C++ compiler with support for C++ 17
    • Tested with Visual Studio 2019 v16.0 + MSVC compiler

Installation

I'm using /MT in release and /MTd in debug as runtime library. So either adjust your project settings to mine or vice versa!

  • Clone the repository into your solution directory (I alway do this in contrib)
  • Right click on your solution
  • Add > Existing Project ... > and select the valve-bsp-parser.vcxproj
  • Right click on your project in your solution
  • Add > Reference... > and select valve-bsp-parser
  • Right click on your project in your solution > Properties
  • C/C++ > General > Additional Include Directories and add the include directory of this repository!

Usage

All you need to parse a .bsp file is the path of the game- and map-directory. There's a short example code for Counter-Strike: Global Offensive

// in your update routine

_parsed_map = _bsp_parser->load_map(
  _engine->get_game_directory(),
  _client_state->get_map_directory()
);

// your sdk helper or wrapper function ... w/e
bool sdk_helper::is_visible(
  const rn::vector3& origin,
  const rn::vector3& destination
) const
{
    return _parsed_map
        ? _bsp_parser->is_visible( origin, destination )
        : false;
}

valve-bsp-parser's People

Contributors

frk1 avatar mikilian avatar reactiion1337 avatar slawekwaga 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

valve-bsp-parser's Issues

Unable to compile develop branch

#3 added support for compressed lumps and this might work via the cmake but not in Visual Studio. We should add the directory to the additional include directories.

Migrato to VS 2022

The library is currently limited to C++ 17, but we need a few things from C++ 20 such as std::endian for #7.

Is it viable to list map entities?

Hello.
Im trying to list all entities on the map (player_spawn, teleport_target, light sources, etc).

Id love to contribute with this repo, is there a starting point or any kind of guidance to what should I do to archive that?

Project Structure

Rename root namespace rn into mkrn and change the folder structure into something based on the following list:

  • contrib (for third-party libraries such as liblzma)
  • src
  • include
    • mkrn
      • core
      • math
      • valve
        • bsp
          • file-format
        • vpk
          • file-format

Endianness

Windows, macOS (Intel and m1/m2) and a lot of UNIX based systems use little endian byte order. However, not all of them do, so support for such architectures would be nice.

Could be done using a data_view class which wrapps std::ifstream.

Linker error

I have this error that I cannot seem to get rid of, I don't know if its my visual studios fault or the code itself.

"unresolved external symbol WinMain referenced in function "int __cdecl invoke_main(void)" (?invoke_main@@yahxz)"

CS 2

Will you update it for cs2?

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.