Giter VIP home page Giter VIP logo

openprefireprac-1's Introduction

OpenPrefirePrac (WIP)

An open-source CounterStrikeSharp powered server-side practicing plugin for CS2. It provides multiple prefire practices on competitive map pool maps and support multiplayer practicing concurrently.

Get started

Requirement

  • CounterStrikeSharp

Installation

Download the latest release files and extract all files into "game/csgo/addons/counterstrikesharp/plugins/OpenPrefirePrac/".

To install the latest version of CounterStrikeSharp, please refer to this guide.

How to use

Tips on operating a practice server

When starting a server, I recommend using these parameters.

[CS2 Installation Directory]/game/bin/linuxsteamrt64/cs2 -dedicated -insecure +map de_inferno -maxplayers_override 64 +game_alias competitive +sv_hibernate_when_empty 0

Note: "-maxplayers_override 64" is the most important one. It allows the server to add more than 5 bots on one team, which is crucial to achieve the goal of allowing multiplayer training simultaneously.

Start prefire practice in game

Send "!prefire" in chatbox or use command "css_prefire" in console. This will bring up the main menu.

There are also some shortcut commands you can use.

  • !prefire prac [number]: Start practicing on a selected route.
  • !prefire map [map name]: Switch to another map.
  • !prefire df [1-5]: Set the difficulty.
  • !prefire mode [rand/full]: Set training mode.
  • !prefire bw [rand/ump/ak/sct/awp]: Set weapons for bots.
  • !prefire lang [en/pt/zh]: Set language. en for English, pt para português, 中文选择 zh。
  • !prefire exit: Stop practicing.

You can always use !prefire help to see how to use them.

Adjust default settings

Now the plugin supports loading default settings of difficulty and training mode from a json file. You can rename default_cfg.json.example to default_cfg.json and modify the value as you like.

Explanation of values:

  • Difficulty
    • 0: No healing.
    • 1: Init hp 500 with no healing.
    • 2: +25hp for each kill.
    • 3: +100hp for each kill.
    • 4: +500hp for each kill.
  • Training Mode
    • 0: Random mode, randomly spawn some targets.
    • 1: Full mode, all targets.
  • Bot Weapon
    • 0: Bots buy weapons randomly.
    • 1: Bots use UMP45.
    • 2: Bots use AK47.
    • 3: Bots use Scout.
    • 4: Bots use AWP.
  • Aim lock for bots
    • true: Bots always aim at players' heads. But this may conflict with CS2's native bot logic, causing bots to not react under certain circumstances.
    • false: CS2's native bot behavior. It works in a consistant manner but is less powerful.

To customize bot difficulty, please refer to this issue.

Development

Provide translation

First you can make a copy of an existing translation profile from the lang folder and start translate the sentences into your language.

Then you might want to create a pull request. Because the plugin uses player's IP to decide the language shown to each player, a mapping from country to language needs to be hard coded into the translator module.

How to customize a practice profile?

The folder "maps" is organized as follows: Each sub-folder in "maps" contains practice profiles for the corresponding map. Each text file in that sub-folder is a practice profile.

A practice profile consists of five parts:

The first line contains the name of incompatible practices, separated by spaces.

The second line indicates how many bots are needed in this practice.

The third line instructs the place and facing direction of the player. The first 3 floating numbers are the position and the other 3 are the rotation.

pos_x pos_y pos_z ang_x ang_y ang_z

The fourth part with an arbitrary number of lines describes how to place bots. The first 3 numbers is position, following 3 numbers of the rotation. The 7th value is either True of False indicating whether the bot is crouching.

pos_x pos_y pos_z ang_x ang_y ang_z is_crouching

The positions and facing rotations can be retrieved from in-game get_pos command. But please notice that, the height values used in profiles should be the values returned by get_pos minus 65. I made a python script that does this calculation for you. You can stack the strings returned by get_pos and put them in a txt file, and pass the file to the python script as described below and the script will automatically print out the formatted bot positions.

python3 calculate_height.py [PATH TO YOUR FILE]

The fifth part with an arbitrary number of lines describes joint points of a guiding line. The guiding line is used to provide a better narration of how the practice is designed to be played.

pos_x pos_y pos_z

This can also be extracted from get_pos using the python script. It will read in lines composed of 4 parts (e.g. "setpos 1348.844727 -989.403198 -103.968750") and calculate the height values for you.

python3 calculate_height.py [PATH TO YOUR FILE]

Current development progress

Currently it's still under active developing.

Finished practices:

  • de_inferno
    • A short to A site
    • A long to A site
    • A apartments to A site
    • Banana to B site
    • Retake B from CT spawn
  • de_ancient
    • B ramp to B site
    • B house to B site
    • Mid to A site
    • A main to A site
    • Retake A from CT spawn
  • de_mirage
    • Attack A site from A ramp (to CT spawn)
    • Attack B site from B apartments
    • Attack A site from A palace (to jungle)
    • Attack B site from mid
    • Attack A site from underpass
    • Retake B site from CT spawn
  • de_overpass
    • Attack B site from B long
    • Attack B site from B short
    • Clear underpass and go upwards to mid
    • Clear underpass and go towards B short
    • Attack A site from A long
    • Attack A site from A short (mid)
  • de_anubis
    • Attack B site from B main
    • Attack B site from mid (B palace)
    • Attack B site from water (B connector/E-Box)
    • Attack A site from mid (A connector)
    • Attack A site from A main
    • CT aggressively pushing from A main
    • CT aggressively pushing from B main
  • de_dust2
    • Attack A site from A long
    • Attack A site from A short
    • Attack B site from tunnel
    • Attack B site from mid
  • de_nuke
    • Attack A site from hut
    • Attack B site from ramp
    • Entrance of lobby (T side)

TODO:

  1. Create prefire profiles for all maps.
  2. Improve bot logic.
  3. Improve localization support (The supporting framework is done. Submitting translations is warmly welcomed.).
  4. Reorganize the files and code structure. Try to put code into submodules to improve readability.
  5. Reroute separate logs into one gathered place for better debug experience.

Reference

I have referred these open-source projects during the development.

This project is inspired by a close-source prefire plugin developed by https://space.bilibili.com/283758782.

Huge thanks.

openprefireprac-1's People

Contributors

lengran avatar b3none avatar clementcariou avatar mavproductions avatar renerebsdorf avatar crashzk avatar

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.