├── .github ├── FUNDING.yml ├── dependabot.yml └── workflows │ ├── codeql-analysis.yml │ ├── greetings.yml │ └── stale.yml ├── .gitignore ├── LICENSE ├── README.md ├── SECURITY.md ├── build.py ├── data ├── linux │ ├── multiplayer.sh │ ├── singleplayer.sh │ └── vitrix.sh └── windows │ ├── multiplayer.bat │ ├── python-windows.zip │ ├── singleplayer.bat │ └── vitrix.bat ├── logo.png ├── requirements.txt ├── server └── server.py └── vitrix ├── .unbuilt ├── assets ├── models │ ├── K47.mtl │ ├── K47.obj │ ├── ammo.mtl │ ├── ammo.obj │ ├── battleaxe.mtl │ ├── battleaxe.obj │ ├── box.png │ ├── bullet.obj │ ├── bulletUVmap_Paint.png │ ├── bullet_UVmap.png │ ├── cube.obj │ ├── first_aid_kit.mtl │ ├── first_aid_kit.obj │ ├── first_aid_kit.obj_UVmap.png │ ├── first_aid_kit.obj_UVmap_Paint.png │ ├── glock.mtl │ ├── glock.obj │ ├── hammer.mtl │ ├── hammer.obj │ ├── hammer_UVmap.png │ ├── map1.mtl │ ├── map1.obj │ ├── pistol.mtl │ ├── pistol.obj │ ├── pistol_UVmap.png │ ├── quad.obj │ ├── sphere.obj │ ├── sword.mtl │ └── sword.obj ├── sounds │ ├── background-music.wav │ ├── death.wav │ ├── hurt.wav │ ├── pew.wav │ ├── reload.wav │ ├── splat.wav │ ├── swing.wav │ └── zombie_growl.wav ├── static │ ├── font.ttf │ ├── logo.ico │ └── text-licence.txt └── textures │ ├── Inventory │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── base template.psd │ ├── batleaxe.png │ ├── glock.png │ ├── hammer.png │ └── sword.png │ ├── ammo.png │ ├── background.png │ ├── bullet.png │ ├── bullet_2.png │ ├── bullet_test.png │ ├── crate.png │ ├── extra.png │ ├── first_aid_kit.png │ ├── floor.png │ ├── hammer.png │ ├── healthbar │ ├── 0.png │ ├── 1.png │ ├── 10.png │ ├── 11.png │ ├── 12.png │ ├── 13.png │ ├── 14.png │ ├── 15.png │ ├── 2.png │ ├── 3.png │ ├── 4.png │ ├── 5.png │ ├── 6.png │ ├── 7.png │ ├── 8.png │ └── 9.png │ ├── heart.png │ ├── melee-crosshair.png │ ├── pistol.png │ ├── ranged-crosshair.png │ └── sky.png ├── lib ├── UI │ ├── chat.py │ ├── crosshair.py │ ├── healthbar.py │ ├── inventory.py │ ├── notification.py │ └── server_chooser.py ├── classes │ ├── anticheat.py │ ├── network.py │ └── settings.py ├── entities │ ├── bullet.py │ ├── crate.py │ ├── enemy.py │ ├── map.py │ └── player.py ├── items │ ├── aid_kit.py │ └── ammo.py ├── paths.py └── weapons │ ├── battleaxe.py │ ├── glock.py │ ├── hammer.py │ ├── k47.py │ ├── pistol.py │ └── sword.py ├── menu.py ├── multiplayer.py ├── singleplayer.py └── user └── settings.json /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: ShadityZ 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry 13 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 14 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "pip" 9 | directory: "/" 10 | schedule: 11 | interval: "daily" 12 | target-branch: "dev" 13 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | push: 5 | branches: [ master, dev ] 6 | pull_request: 7 | # The branches below must be a subset of the branches above 8 | branches: [ master, dev ] 9 | schedule: 10 | - cron: '19 2 * * 3' 11 | 12 | jobs: 13 | analyze: 14 | name: Analyze 15 | runs-on: ubuntu-latest 16 | permissions: 17 | actions: read 18 | contents: read 19 | security-events: write 20 | 21 | strategy: 22 | fail-fast: false 23 | matrix: 24 | language: [ 'python' ] 25 | 26 | steps: 27 | - name: Checkout repository 28 | uses: actions/checkout@v2 29 | 30 | # Initializes the CodeQL tools for scanning. 31 | - name: Initialize CodeQL 32 | uses: github/codeql-action/init@v1 33 | with: 34 | languages: ${{ matrix.language }} 35 | 36 | - name: Autobuild 37 | uses: github/codeql-action/autobuild@v1 38 | 39 | - name: Perform CodeQL Analysis 40 | uses: github/codeql-action/analyze@v1 41 | -------------------------------------------------------------------------------- /.github/workflows/greetings.yml: -------------------------------------------------------------------------------- 1 | name: Greetings 2 | 3 | on: [pull_request, issues] 4 | 5 | jobs: 6 | greeting: 7 | runs-on: ubuntu-latest 8 | permissions: 9 | issues: write 10 | pull-requests: write 11 | steps: 12 | - uses: actions/first-interaction@v1 13 | with: 14 | repo-token: ${{ secrets.GITHUB_TOKEN }} 15 | issue-message: 'Thanks for reporting your first bug! All help is appreciated!' 16 | pr-message: 'Thanks for making your first contribution to Vitrix! Your help is appreciated!' 17 | -------------------------------------------------------------------------------- /.github/workflows/stale.yml: -------------------------------------------------------------------------------- 1 | # This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. 2 | # 3 | # You can adjust the behavior by modifying this file. 4 | # For more information, see: 5 | # https://github.com/actions/stale 6 | name: Mark stale issues and pull requests 7 | 8 | on: 9 | schedule: 10 | - cron: '40 23 * * *' 11 | 12 | jobs: 13 | stale: 14 | 15 | runs-on: ubuntu-latest 16 | permissions: 17 | issues: write 18 | pull-requests: write 19 | 20 | steps: 21 | - uses: actions/stale@v3 22 | with: 23 | repo-token: ${{ secrets.GITHUB_TOKEN }} 24 | stale-issue-message: 'This issue looks stale.' 25 | stale-pr-message: 'This PR looks stale.' 26 | stale-issue-label: 'stale-issue' 27 | stale-pr-label: 'nstale-pr' 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | vitrix/lib/__pycache__/ 2 | vitrix/__pycache__/ 3 | vitrix/lib/__pycache__/ 4 | vitrix/lib/weapons/__pycache__/ 5 | vitrix/lib/items/__pycache__/ 6 | vitrix/lib/UI/__pycache__/ 7 | vitrix/lib/entities/__pycache__/ 8 | vitrix/lib/classes/__pycache__/ 9 | vitrix/test.py 10 | vitrix_engine.egg-info/ 11 | venvs-config/ 12 | data.txt 13 | build/ 14 | dist/ 15 | test/ 16 | ib.cfg 17 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | Vitrix logo 4 | 5 |

6 |

Vitrix is an open-source FPS video game coded in ! 7 |

8 | 9 | 📣 Discussions 10 | | 11 | 12 | ❗ Report an error 13 | | 14 | 15 | 🎁 Submit a feature 16 | | 17 | 18 | 📈 Community Insights 19 | 20 |

21 | stars 22 | forks 23 | contributors 24 | prs 25 | issues 26 | license 27 |
Check out the Vitrix: 28 | 29 |

Made with :heart: by ShadityZ and contributors 30 | 31 | 32 |

33 | 34 | 35 | 36 |
37 | Everybody knows lots of diffent FPS shooter games, from Fortnite to CS:GO, the list is longly tiresome. So, what's any different about Vitrix? Well first of all, it has a really cool name. Second of all, it is open-source! No more sneaky malware in your closed-source applications, because the code of Vitrix is fully open and accessible to the community! Well? What are you waiting for? Go ahead and download it if you haven't already, and dive into a world of Vitrix fun! 38 | 39 | Frequently Asked Questions (FAQ): 40 | 41 | Game Video/Screen Settings: 42 | 43 | Q: Is there a way to change the screen’s dimensions i.e. width and height? 44 | A: Yes! Post-cloning the repository, navigate to the /Vitrix/vitrix/menu.py file. Upon inspecting the code, the “window” object has its attribute size set to two parameters (“default_width” and “default_height”). Initializing these to different integer values will alter the game’s screen dimensions. 45 | 46 | Q: Is there a way to toggle whether the screen is borderless or whether it displays in a windowed format? 47 | A: Yes! Post-cloning the repository, navigate to the /Vitrix/vitrix/menu.py file. Upon inspecting the code, the “window” object has its attribute borderless which is a boolean toggle for whether the screen is windowed or borderless. As of 2/12/2023, the default setting in the source code is borderless. 48 | 49 | Q: Is there a way to toggle whether the screen fullscreen? 50 | A: Yes! Post-cloning the repository, navigate to the /Vitrix/vitrix/menu.py file. Upon inspecting the code, the “window” object has its attribute fullscreen which is a boolean toggle for whether the game’s contents are shown as fullscreen or not. 51 | 52 | In Game Weapons: 53 | 54 | Q: Where can I access source code for the weapons used in game? 55 | A: Navigate to the directory “/Vitrix/vitrix/lib/weapons” to find the python source code for each item and its in game statistics/specifications. 56 | 57 | Q: I see that within each weapon’s class source code that there is a texture variable being initialized to an image path? Where are these images in the repository? 58 | A: Navigate to the directory “/Vitrix/vitrix/assets/textures” to find the images loaded into the game. 59 | 60 | Anticheat/Multiplayer Auditing: 61 | 62 | Q: Does Vitrix have anitcheat functionality implemented for its multiplayer gameplay? 63 | A: Indeed! Navigate to the directory “/Vitrix/vitrix/lib/classes” and access the “anticheat.py” file to see built in precautionary user metric audits to see if gameplay is genuine in its origin. 64 | 65 | Q: What are the metrics that Vitrix uses to access whether a player is cheating or not? 66 | A: If user speed within the game is not within a deemed “normal” range, they will be kicked out of the game’s multiplayer session by a function call named “perform_quit()”. If the jump height integer wise does not match up with the original source code’s jump height, they will also be removed from the game. Artificial manipulated levels of player health exceeding 150 also indicate that the player is cheating which results in an automatic disconnect for the game. 67 | 68 | Q: What are the consequences of a player cheating/how does the anticheat python script handle improper/irregular user behavior 69 | A: Through the invocation of the "perform_quit()" function, the player is disconnected from the sever. 70 | 71 | Item Functionality: 72 | 73 | Q: What does the first aid kit do/how does it function within the game? 74 | A: The first aid kit randomly restorces between 50 to 80 health. This is represented in the aid_kit.py file found in the directory "Vitrix/vitrix/lib/items/aid_kit.py" where the class attribute "health_restore" is initlized to a random value between 50 and 80 through the "random.randint(50, 80)" function which is derriven from the random library in python. 75 | 76 | User Interface: 77 | 78 | Q: Where are U.I. related scripts located? 79 | A: Within the directory "Vitrix/vitrix/lib/UI/" 80 | 81 |
82 |

You can find out everything you else you need to know in the Official Vitrix Documentation!

83 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions / Release Cycle 4 | 5 | A version of prebuilts is released every month. They are labeled as either ```Monthly``` or ```LTS```. Monthly releases are supported until the 6 | next Monthly release comes out. LTS releases are supported for the next 3 months after its release date. 7 | 8 | | Version | Supported | 9 | | --------- | ------------------ | 10 | | Regular | Until next Regular | 11 | | LTS | 3 Months | 12 | 13 | 14 | ## Reporting a Vulnerability 15 | To report a security vulnerability, open an issue on our ![issues page](https://github.com/ShadityZ/Vitrix/issues). Please label it as ```Vulnerability``` to 16 | make sure we know what it is. Thank you for your contribution! 17 | -------------------------------------------------------------------------------- /build.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | import shutil 4 | import datetime 5 | import platform 6 | import subprocess 7 | 8 | from os.path import join 9 | 10 | sep = os.path.sep 11 | 12 | def run(command, output=1): 13 | proc = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, 14 | stderr=subprocess.STDOUT) 15 | if output == 1: 16 | while proc.poll() is None: 17 | temp = str(proc.stdout.readline()).split("'") 18 | temp = temp[1].split(sep) 19 | print(temp[0]) 20 | commandResult = proc.wait() 21 | if commandResult == 0: 22 | return True 23 | else: 24 | print("\nERROR") 25 | exit() 26 | 27 | 28 | def print_seperator(): 29 | columns = str(os.get_terminal_size()).split("=")[1].split(",")[0] 30 | print() 31 | print("-" * int(columns)) 32 | print() 33 | 34 | 35 | 36 | dir_path = os.path.dirname(os.path.realpath(__file__)) 37 | build_path = join(dir_path, "build") 38 | d = datetime.datetime.now() 39 | 40 | if platform.system() == "Linux": 41 | operating_sys = "linux" 42 | elif platform.system() == "Windows": 43 | operating_sys = "windows" 44 | else: 45 | print("Sorry, Vitrix doesn't support your platform just yet. :(") 46 | 47 | print("\nBuild Path: " + build_path) 48 | print_seperator() 49 | 50 | 51 | 52 | print("Preparing...\n") 53 | try: 54 | shutil.rmtree(build_path) 55 | except: 56 | os.mkdir(build_path) 57 | os.chdir(dir_path) 58 | 59 | print("Done!") 60 | 61 | print_seperator() 62 | 63 | 64 | 65 | start_time = time.time() 66 | print("Building...\n\n") 67 | 68 | with open(join(dir_path, "requirements.txt")) as file: 69 | packages = file.readlines() 70 | 71 | if operating_sys == "linux": 72 | from venvctl import VenvCtl 73 | 74 | VenvCtl.create_venv(name="python-env", packages=packages, 75 | output_dir=build_path) 76 | shutil.rmtree(join(build_path, "builds")) 77 | shutil.rmtree(join(build_path, "reports")) 78 | shutil.copy(join("data", "linux", "vitrix.sh"), "build") 79 | shutil.copy(join("data", "linux", "singleplayer.sh"), "build") 80 | shutil.copy(join("data", "linux", "multiplayer.sh"), "build") 81 | 82 | 83 | if operating_sys == "windows": 84 | from zipfile import ZipFile 85 | 86 | with ZipFile(join(dir_path, "data", "windows", "python-windows.zip"), "r") as zip: 87 | zip.extractall(build_path) 88 | 89 | 90 | shutil.copy(join("data", "windows", "vitrix.bat"), "build") 91 | shutil.copy(join("data", "windows", "singleplayer.bat"), "build") 92 | shutil.copy(join("data", "windows", "multiplayer.bat"), "build") 93 | 94 | 95 | shutil.copytree(join(dir_path, "vitrix"), join(build_path, "vitrix"), 96 | ignore=shutil.ignore_patterns("__pycache__")) 97 | os.remove(f"{build_path}{sep}vitrix{sep}.unbuilt") 98 | 99 | pkg_name = f"Vitrix-vX.X.X-{operating_sys}" 100 | 101 | 102 | shutil.make_archive(pkg_name, "zip", build_path) 103 | 104 | 105 | 106 | d = datetime.datetime.now() 107 | 108 | print_seperator() 109 | print("Build Successfully Completed!") 110 | print("Finished On: " + d.strftime("%I:%M %p %A %B %Y")) 111 | print(f"\nTotal Build Time: {str(time.time() - start_time)} seconds") 112 | -------------------------------------------------------------------------------- /data/linux/multiplayer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DIR=$(dirname "$0") 4 | 5 | $DIR/python-env/bin/python3 $DIR/vitrix/multiplayer.py 6 | -------------------------------------------------------------------------------- /data/linux/singleplayer.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DIR=$(dirname "$0") 4 | 5 | $DIR/python-env/bin/python3 $DIR/vitrix/singleplayer.py 6 | -------------------------------------------------------------------------------- /data/linux/vitrix.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DIR=$(dirname "$0") 4 | 5 | $DIR/python-env/bin/python3 $DIR/vitrix/menu.py > log.txt 6 | -------------------------------------------------------------------------------- /data/windows/multiplayer.bat: -------------------------------------------------------------------------------- 1 | chcp 65001 2 | set PYTHONIOENCODING=utf-8 3 | 4 | call "python\python.exe" "vitrix\multiplayer.py" 5 | -------------------------------------------------------------------------------- /data/windows/python-windows.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/data/windows/python-windows.zip -------------------------------------------------------------------------------- /data/windows/singleplayer.bat: -------------------------------------------------------------------------------- 1 | chcp 65001 2 | set PYTHONIOENCODING=utf-8 3 | 4 | call "python\python.exe" "vitrix\singleplayer.py" -------------------------------------------------------------------------------- /data/windows/vitrix.bat: -------------------------------------------------------------------------------- 1 | chcp 65001 2 | set PYTHONIOENCODING=utf-8 3 | title Vitrix 4 | 5 | call "python\python.exe" "vitrix\menu.py" > "log.txt" 2>&1 6 | -------------------------------------------------------------------------------- /logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/logo.png -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | git+https://github.com/ShadityZ/Vitrix-Engine.git@v1.0#egg=vitrix_engine 2 | venvctl==1.4.12 -------------------------------------------------------------------------------- /server/server.py: -------------------------------------------------------------------------------- 1 | """ 2 | Server version: v1.0.0 3 | """ 4 | 5 | import os 6 | import sys 7 | import socket 8 | import json 9 | import time 10 | import random 11 | import threading 12 | 13 | sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) 14 | 15 | from vitrix.lib.classes.anticheat import * 16 | #from vitrix.lib.player import Player 17 | 18 | ADDR = "0.0.0.0" 19 | PORT = 26822 20 | MAX_PLAYERS = 10 21 | MSG_SIZE = 2048 22 | 23 | 24 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 25 | s.bind((ADDR, PORT)) 26 | s.listen(MAX_PLAYERS) 27 | 28 | 29 | players = {} 30 | 31 | 32 | def generate_id(player_list: dict, max_players: int): 33 | """ 34 | Generate a unique identifier 35 | 36 | Args: 37 | player_list (dict): dictionary of existing players 38 | max_players (int): maximum number of players allowed 39 | 40 | Returns: 41 | str: the unique identifier 42 | """ 43 | 44 | while True: 45 | unique_id = str(random.randint(1, max_players)) 46 | if unique_id not in player_list: 47 | return unique_id 48 | 49 | 50 | def handle_messages(identifier: str): 51 | client_info = players[identifier] 52 | conn: socket.socket = client_info["socket"] 53 | username = client_info["username"] 54 | 55 | while True: 56 | try: 57 | msg = conn.recv(MSG_SIZE) 58 | except ConnectionResetError: 59 | break 60 | 61 | if not msg: 62 | break 63 | 64 | msg_decoded = msg.decode("utf8") 65 | 66 | try: 67 | left_bracket_index = msg_decoded.index("{") 68 | right_bracket_index = msg_decoded.index("}") + 1 69 | msg_decoded = msg_decoded[left_bracket_index:right_bracket_index] 70 | except ValueError: 71 | continue 72 | 73 | try: 74 | msg_json = json.loads(msg_decoded) 75 | except Exception as e: 76 | print(e) 77 | continue 78 | 79 | print(f"Received message from player {username} with ID {identifier}") 80 | 81 | if msg_json["object"] == "player": 82 | players[identifier]["position"] = msg_json["position"] 83 | players[identifier]["rotation"] = msg_json["rotation"] 84 | players[identifier]["health"] = msg_json["health"] 85 | 86 | for player_id in players: 87 | if player_id != identifier: 88 | player_info = players[player_id] 89 | player_conn: socket.socket = player_info["socket"] 90 | try: 91 | player_conn.sendall(msg_decoded.encode("utf8")) 92 | except OSError: 93 | pass 94 | 95 | for player_id in players: 96 | if player_id != identifier: 97 | player_info = players[player_id] 98 | player_conn: socket.socket = player_info["socket"] 99 | try: 100 | player_conn.send(json.dumps({"id": identifier, "object": "player", "joined": False, "left": True}).encode("utf8")) 101 | except OSError: 102 | pass 103 | 104 | print(f"Player {username} with ID {identifier} has left the game...") 105 | del players[identifier] 106 | conn.close() 107 | 108 | 109 | def main(): 110 | print("Server started, listening for new connections...") 111 | 112 | while True: 113 | conn, addr = s.accept() 114 | new_id = generate_id(players, MAX_PLAYERS) 115 | conn.send(new_id.encode("utf8")) 116 | username = conn.recv(MSG_SIZE).decode("utf8") 117 | new_player_info = {"socket": conn, "username": username, "position": (0, 1, 0), "rotation": 0, "health": 150} 118 | 119 | 120 | for player_id in players: 121 | if player_id != new_id: 122 | player_info = players[player_id] 123 | player_conn: socket.socket = player_info["socket"] 124 | try: 125 | player_conn.send(json.dumps({ 126 | "id": new_id, 127 | "object": "player", 128 | "username": new_player_info["username"], 129 | "position": new_player_info["position"], 130 | "health": new_player_info["health"], 131 | "joined": True, 132 | "left": False 133 | }).encode("utf8")) 134 | except OSError: 135 | pass 136 | 137 | for player_id in players: 138 | if player_id != new_id: 139 | player_info = players[player_id] 140 | try: 141 | conn.send(json.dumps({ 142 | "id": player_id, 143 | "object": "player", 144 | "username": player_info["username"], 145 | "position": player_info["position"], 146 | "health": player_info["health"], 147 | "joined": True, 148 | "left": False 149 | }).encode("utf8")) 150 | time.sleep(0.1) 151 | except OSError: 152 | pass 153 | 154 | players[new_id] = new_player_info 155 | 156 | msg_thread = threading.Thread(target=handle_messages, args=(new_id,), daemon=True) 157 | msg_thread.start() 158 | 159 | print(f"New connection from {addr}, assigned ID: {new_id}...") 160 | 161 | #check_speed(Player.speed) 162 | #check_jump_height(Player.jump_height, 2.5) 163 | 164 | 165 | if __name__ == "__main__": 166 | try: 167 | main() 168 | 169 | except KeyboardInterrupt: 170 | pass 171 | 172 | except SystemExit: 173 | pass 174 | 175 | finally: 176 | print("Exiting") 177 | 178 | s.close() 179 | -------------------------------------------------------------------------------- /vitrix/.unbuilt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/.unbuilt -------------------------------------------------------------------------------- /vitrix/assets/models/K47.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl None 5 | Ns 500 6 | Ka 0.8 0.8 0.8 7 | Kd 0.8 0.8 0.8 8 | Ks 0.8 0.8 0.8 9 | d 1 10 | illum 2 11 | -------------------------------------------------------------------------------- /vitrix/assets/models/ammo.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'ammo_pack.blend' 2 | # Material Count: 1 3 | 4 | newmtl Material 5 | Ns 225.000000 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.800000 0.800000 0.800000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.000000 11 | d 1.000000 12 | illum 2 13 | -------------------------------------------------------------------------------- /vitrix/assets/models/ammo.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.93.3 OBJ File: 'ammo_pack.blend' 2 | # www.blender.org 3 | mtllib ammo_pack.mtl 4 | o Cube 5 | v 1.000000 -0.000000 -1.308975 6 | v 1.000000 -0.000000 1.308975 7 | v -1.000000 -0.000000 1.308975 8 | v -1.000000 -0.000000 -1.308975 9 | v 1.000000 2.000000 -1.308974 10 | v 0.999999 2.000000 1.308976 11 | v -1.000000 2.000000 1.308974 12 | v -1.000000 2.000000 -1.308975 13 | v 0.999999 3.410614 1.308976 14 | v 1.000000 3.410614 -1.308974 15 | vt 0.409310 0.440560 16 | vt 0.218327 0.440560 17 | vt 0.218326 0.249577 18 | vt 0.409309 0.249577 19 | vt 0.409310 0.631543 20 | vt 0.218327 0.631543 21 | vt 0.027344 0.631543 22 | vt 0.027344 0.440560 23 | vt 0.218326 0.058594 24 | vt 0.409309 0.058594 25 | vt 0.600292 0.440560 26 | vt 0.600293 0.631543 27 | vt 0.214750 0.628797 28 | vt 0.214750 0.818949 29 | vt 0.030090 0.818949 30 | vt 0.030090 0.628797 31 | vt 0.987129 0.078327 32 | vt 0.987130 0.398861 33 | vt 0.567558 0.398861 34 | vt 0.567558 0.078327 35 | vn 0.0000 -1.0000 0.0000 36 | vn 1.0000 0.0000 0.0000 37 | vn -0.0000 -0.0000 1.0000 38 | vn -1.0000 -0.0000 -0.0000 39 | vn 0.0000 0.0000 -1.0000 40 | vn -0.5764 0.8172 -0.0000 41 | vn 0.0000 1.0000 0.0000 42 | usemtl Material 43 | s off 44 | f 1/1/1 2/2/1 3/3/1 4/4/1 45 | f 1/1/2 5/5/2 6/6/2 2/2/2 46 | f 2/2/3 6/6/3 7/7/3 3/8/3 47 | f 3/3/4 7/9/4 8/10/4 4/4/4 48 | f 5/5/5 1/1/5 4/11/5 8/12/5 49 | f 10/13/6 8/14/6 7/15/6 9/16/6 50 | f 5/17/7 8/18/7 7/19/7 6/20/7 51 | -------------------------------------------------------------------------------- /vitrix/assets/models/battleaxe.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 3 3 | 4 | newmtl Material.001 5 | Ns 323.999994 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.800000 0.800000 0.800000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.450000 11 | d 1.000000 12 | illum 2 13 | 14 | newmtl None 15 | Ns 500.000001 16 | Ka 1.000000 1.000000 1.000000 17 | Kd 0.800000 0.800000 0.800000 18 | Ks 0.800000 0.800000 0.800000 19 | Ke 0.000000 0.000000 0.000000 20 | Ni 1.450000 21 | d 1.000000 22 | illum 2 23 | 24 | newmtl None.001 25 | Ns 500.000001 26 | Ka 1.000000 1.000000 1.000000 27 | Kd 0.800000 0.800000 0.800000 28 | Ks 0.800000 0.800000 0.800000 29 | Ke 0.000000 0.000000 0.000000 30 | Ni 1.450000 31 | d 1.000000 32 | illum 2 33 | -------------------------------------------------------------------------------- /vitrix/assets/models/box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/models/box.png -------------------------------------------------------------------------------- /vitrix/assets/models/bulletUVmap_Paint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/models/bulletUVmap_Paint.png -------------------------------------------------------------------------------- /vitrix/assets/models/bullet_UVmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/models/bullet_UVmap.png -------------------------------------------------------------------------------- /vitrix/assets/models/cube.obj: -------------------------------------------------------------------------------- 1 | # Blender v3.0.1 OBJ File: 'cube.blend' 2 | # www.blender.org 3 | mtllib cube.mtl 4 | o Cube 5 | v 0.500000 -0.500000 -0.500000 6 | v 0.500000 -0.500000 0.500000 7 | v -0.500000 -0.500000 0.500000 8 | v -0.500000 -0.500000 -0.500000 9 | v 0.500000 0.500000 -0.500000 10 | v 0.500000 0.500000 0.500000 11 | v -0.500000 0.500000 0.500000 12 | v -0.500000 0.500000 -0.500000 13 | vt 1.000000 1.000000 14 | vt 1.000000 0.000000 15 | vt -0.000000 0.000000 16 | vt 0.000000 1.000000 17 | vt 1.000000 1.000000 18 | vt 0.000000 1.000000 19 | vt -0.000000 0.000000 20 | vt 1.000000 -0.000000 21 | vt 1.000000 0.000000 22 | vt -0.000000 1.000000 23 | vt 0.000000 0.000000 24 | vt 1.000000 1.000000 25 | vt -0.000000 1.000000 26 | vt 1.000000 1.000000 27 | vt 1.000000 0.000000 28 | vt 0.000000 0.000000 29 | vn 0.0000 -1.0000 0.0000 30 | vn 0.0000 1.0000 0.0000 31 | vn 1.0000 0.0000 0.0000 32 | vn -0.0000 -0.0000 1.0000 33 | vn -1.0000 -0.0000 -0.0000 34 | vn 0.0000 0.0000 -1.0000 35 | usemtl Material 36 | s off 37 | f 1/1/1 2/2/1 3/3/1 4/4/1 38 | f 5/5/2 8/6/2 7/7/2 6/8/2 39 | f 1/9/3 5/5/3 6/10/3 2/11/3 40 | f 2/2/4 6/12/4 7/13/4 3/3/4 41 | f 3/3/5 7/13/5 8/14/5 4/15/5 42 | f 5/5/6 1/9/6 4/16/6 8/6/6 43 | -------------------------------------------------------------------------------- /vitrix/assets/models/first_aid_kit.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 2 3 | 4 | newmtl Material.001 5 | Ns 225.000000 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.800000 0.800000 0.800000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.450000 11 | d 1.000000 12 | illum 2 13 | refl . 14 | 15 | newmtl Material.002 16 | Ns 225.000000 17 | Ka 1.000000 1.000000 1.000000 18 | Kd 0.800000 0.800000 0.800000 19 | Ks 0.500000 0.500000 0.500000 20 | Ke 0.000000 0.000000 0.000000 21 | Ni 1.450000 22 | d 1.000000 23 | illum 2 24 | map_Kd . 25 | -------------------------------------------------------------------------------- /vitrix/assets/models/first_aid_kit.obj_UVmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/models/first_aid_kit.obj_UVmap.png -------------------------------------------------------------------------------- /vitrix/assets/models/first_aid_kit.obj_UVmap_Paint.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/models/first_aid_kit.obj_UVmap_Paint.png -------------------------------------------------------------------------------- /vitrix/assets/models/glock.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl None 5 | Ns 500 6 | Ka 0.8 0.8 0.8 7 | Kd 0.8 0.8 0.8 8 | Ks 0.8 0.8 0.8 9 | d 1 10 | illum 2 11 | -------------------------------------------------------------------------------- /vitrix/assets/models/hammer.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 2 3 | 4 | newmtl Material.001 5 | Ns 323.999994 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.800000 0.800000 0.800000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.450000 11 | d 1.000000 12 | illum 2 13 | map_Kd pistol_UVmap_Paint.png 14 | 15 | newmtl None 16 | Ns 500.000001 17 | Ka 1.000000 1.000000 1.000000 18 | Kd 0.800000 0.800000 0.800000 19 | Ks 0.800000 0.800000 0.800000 20 | Ke 0.000000 0.000000 0.000000 21 | Ni 1.450000 22 | d 1.000000 23 | illum 2 24 | -------------------------------------------------------------------------------- /vitrix/assets/models/hammer.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.93.6 OBJ File: '' 2 | # www.blender.org 3 | mtllib hammer.mtl 4 | o Cube.001 5 | v -1.016013 -0.983726 -1.000000 6 | v 0.983726 -1.016013 -1.000000 7 | v 0.983726 -1.016013 1.000000 8 | v -1.016013 -0.983726 1.000000 9 | v -0.983726 1.016013 1.000000 10 | v 1.016013 0.983726 1.000000 11 | v 1.016013 0.983726 -1.000000 12 | v -0.983726 1.016013 -1.000000 13 | v -1.012005 -0.735502 -0.751743 14 | v -1.012005 -0.735502 0.751743 15 | v -3.718941 -0.691796 0.751743 16 | v -3.718941 -0.691797 -0.751743 17 | v -0.987734 0.767789 -0.751743 18 | v -0.987734 0.767789 0.751743 19 | v -3.694669 0.811494 0.751743 20 | v -3.694669 0.811494 -0.751743 21 | v -4.409443 0.823034 -0.751743 22 | v -4.409443 0.823034 0.751743 23 | v -1.467904 -0.264639 -0.751743 24 | v -3.248080 -0.235897 -0.751743 25 | v -3.248080 -0.235897 -0.212589 26 | v -1.467904 -0.264639 -0.212589 27 | v -5.526704 0.361255 -1.004059 28 | v -5.882639 0.387459 1.047314 29 | v -1.458596 0.311889 -0.751743 30 | v -3.238771 0.340631 -0.751743 31 | v -3.175799 0.275593 -0.212589 32 | v -1.523634 0.248918 -0.212589 33 | v -1.750746 0.813774 -10.501792 34 | v -3.363140 1.119922 -11.250827 35 | v -1.458596 0.311889 -0.212589 36 | v -3.238771 0.340631 -0.212589 37 | v -1.530876 -0.199601 -0.212589 38 | v -3.183040 -0.172926 -0.212589 39 | v -1.778032 -0.275472 -10.598185 40 | v -3.465099 -0.149489 -11.270542 41 | vt 0.970296 0.329241 42 | vt 0.821547 0.329354 43 | vt 0.821547 0.179866 44 | vt 0.970296 0.179753 45 | vt 0.821512 0.551139 46 | vt 0.821512 0.401676 47 | vt 0.970880 0.401557 48 | vt 0.970880 0.551021 49 | vt 0.665009 0.788271 50 | vt 0.665011 0.937762 51 | vt 0.515524 0.937762 52 | vt 0.515522 0.788271 53 | vt 0.970881 0.159569 54 | vt 0.821547 0.159597 55 | vt 0.821547 0.010106 56 | vt 0.970881 0.010078 57 | vt 0.649676 0.381401 58 | vt 0.537300 0.381401 59 | vt 0.537147 0.180048 60 | vt 0.649523 0.180048 61 | vt 0.821512 0.720783 62 | vt 0.821512 0.571296 63 | vt 0.970835 0.571353 64 | vt 0.970835 0.720840 65 | vt 0.819929 0.806300 66 | vt 0.707553 0.806297 67 | vt 0.688997 0.787740 68 | vt 0.838485 0.787745 69 | vt 0.707553 0.918675 70 | vt 0.819929 0.918679 71 | vt 0.838485 0.937235 72 | vt 0.688997 0.937230 73 | vt 0.646639 0.565968 74 | vt 0.534260 0.565968 75 | vt 0.534250 0.512591 76 | vt 0.646629 0.512591 77 | vt 0.339075 0.856773 78 | vt 0.339075 0.989712 79 | vt 0.298776 0.989704 80 | vt 0.298776 0.856766 81 | vt 0.646677 0.768114 82 | vt 0.534298 0.768114 83 | vt 0.801356 0.767583 84 | vt 0.688998 0.767494 85 | vt 0.688998 0.565304 86 | vt 0.801356 0.565393 87 | vt 0.515522 0.428092 88 | vt 0.668841 0.401557 89 | vt 0.688998 0.511915 90 | vt 0.723751 0.401557 91 | vt 0.515522 0.010078 92 | vt 0.668857 0.036731 93 | vt 0.689014 0.212251 94 | vt 0.801390 0.212208 95 | vt 0.725024 0.349356 96 | vt 0.689014 0.265624 97 | vt 0.766751 0.044693 98 | vt 0.723653 0.044709 99 | vt 0.689014 0.010121 100 | vt 0.801390 0.010078 101 | vt 0.723653 0.177637 102 | vt 0.766751 0.177620 103 | vt 0.278619 0.835483 104 | vt 0.155254 0.837317 105 | vt 0.159669 0.067926 106 | vt 0.278619 0.010078 107 | vt 0.215709 0.900573 108 | vt 0.215709 0.857475 109 | vt 0.256008 0.857474 110 | vt 0.256008 0.900571 111 | vt 0.155254 0.989891 112 | vt 0.155254 0.857474 113 | vt 0.195552 0.857505 114 | vt 0.195552 0.989922 115 | vt 0.010078 0.903161 116 | vt 0.010078 0.860062 117 | vt 0.050377 0.860063 118 | vt 0.050377 0.903161 119 | vt 0.418768 0.935080 120 | vt 0.452296 0.935067 121 | vt 0.457080 0.939845 122 | vt 0.413983 0.939861 123 | vt 0.452296 0.811698 124 | vt 0.418768 0.811711 125 | vt 0.413983 0.806934 126 | vt 0.457080 0.806917 127 | vt 0.872405 0.791124 128 | vt 0.953836 0.787740 129 | vt 0.953836 0.916416 130 | vt 0.858641 0.915461 131 | vt 0.310530 0.010078 132 | vt 0.344054 0.010607 133 | vt 0.393826 0.836609 134 | vt 0.298776 0.836609 135 | vt 0.012240 0.010078 136 | vt 0.135097 0.013128 137 | vt 0.135097 0.839906 138 | vt 0.010078 0.786476 139 | vt 0.461837 0.010078 140 | vt 0.495365 0.010337 141 | vt 0.495365 0.786760 142 | vt 0.413983 0.778922 143 | vn -0.0161 -0.9999 -0.0000 144 | vn 0.0000 -0.0000 1.0000 145 | vn 0.9999 -0.0161 -0.0000 146 | vn 0.0161 0.9999 0.0000 147 | vn 0.0000 0.0000 -1.0000 148 | vn -0.9999 0.0161 0.0000 149 | vn -0.3277 0.9440 -0.0398 150 | vn 0.1230 0.0561 0.9908 151 | vn -0.4730 -0.8801 -0.0409 152 | vn 0.1227 0.0559 -0.9909 153 | vn 0.0867 0.9942 0.0640 154 | vn 0.3981 0.0233 -0.9170 155 | vn -0.9977 0.0631 0.0237 156 | vn -0.0464 -0.9989 0.0036 157 | vn 0.9995 -0.0210 -0.0234 158 | usemtl Material.001 159 | s 1 160 | f 1/1/1 2/2/1 3/3/1 4/4/1 161 | f 5/5/2 4/6/2 3/7/2 6/8/2 162 | f 6/9/3 3/10/3 2/11/3 7/12/3 163 | f 7/13/4 8/14/4 5/15/4 6/16/4 164 | f 9/17/1 10/18/1 11/19/1 12/20/1 165 | f 7/21/5 2/22/5 1/23/5 8/24/5 166 | f 9/25/6 13/26/6 8/27/6 1/28/6 167 | f 14/29/6 10/30/6 4/31/6 5/32/6 168 | f 10/30/6 9/25/6 1/28/6 4/31/6 169 | f 13/26/6 14/29/6 5/32/6 8/27/6 170 | f 15/33/4 16/34/4 17/35/4 18/36/4 171 | f 19/37/4 20/38/4 21/39/4 22/40/4 172 | f 14/41/4 13/42/4 16/34/4 15/33/4 173 | f 10/43/2 14/44/2 15/45/2 11/46/2 174 | f 17/35/7 23/47/7 24/48/7 18/36/7 175 | f 11/46/8 15/45/8 18/49/8 24/50/8 176 | f 12/20/9 11/19/9 24/51/9 23/52/9 177 | f 16/53/10 12/54/10 23/55/10 17/56/10 178 | f 19/57/5 25/58/5 13/59/5 9/60/5 179 | f 26/61/5 20/62/5 12/54/5 16/53/5 180 | f 20/62/5 19/57/5 9/60/5 12/54/5 181 | f 25/58/5 26/61/5 16/53/5 13/59/5 182 | f 27/63/11 28/64/11 29/65/11 30/66/11 183 | f 25/67/6 19/68/6 22/69/6 31/70/6 184 | f 26/71/1 25/72/1 31/73/1 32/74/1 185 | f 20/75/3 26/76/3 32/77/3 21/78/3 186 | f 33/79/5 28/80/5 31/81/5 22/82/5 187 | f 27/83/5 34/84/5 21/85/5 32/86/5 188 | f 34/84/5 33/79/5 22/82/5 21/85/5 189 | f 28/80/5 27/83/5 32/86/5 31/81/5 190 | f 29/87/12 35/88/12 36/89/12 30/90/12 191 | f 34/91/13 27/92/13 30/93/13 36/94/13 192 | f 33/95/14 34/96/14 36/97/14 35/98/14 193 | f 28/99/15 33/100/15 35/101/15 29/102/15 194 | -------------------------------------------------------------------------------- /vitrix/assets/models/hammer_UVmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/models/hammer_UVmap.png -------------------------------------------------------------------------------- /vitrix/assets/models/map1.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 2 3 | 4 | newmtl Material 5 | Ns 323.999994 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.800000 0.800000 0.800000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.450000 11 | d 1.000000 12 | illum 2 13 | 14 | newmtl None 15 | Ns 500 16 | Ka 0.8 0.8 0.8 17 | Kd 0.8 0.8 0.8 18 | Ks 0.8 0.8 0.8 19 | d 1 20 | illum 2 21 | -------------------------------------------------------------------------------- /vitrix/assets/models/pistol.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 2 3 | 4 | newmtl Material.001 5 | Ns 323.999994 6 | Ka 1.000000 1.000000 1.000000 7 | Kd 0.800000 0.800000 0.800000 8 | Ks 0.500000 0.500000 0.500000 9 | Ke 0.000000 0.000000 0.000000 10 | Ni 1.450000 11 | d 1.000000 12 | illum 2 13 | refl pistol_UVmap_Paint.png 14 | 15 | newmtl None 16 | Ns 500.000001 17 | Ka 1.000000 1.000000 1.000000 18 | Kd 0.800000 0.800000 0.800000 19 | Ks 0.800000 0.800000 0.800000 20 | Ke 0.000000 0.000000 0.000000 21 | Ni 1.450000 22 | d 1.000000 23 | illum 2 24 | -------------------------------------------------------------------------------- /vitrix/assets/models/pistol_UVmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/models/pistol_UVmap.png -------------------------------------------------------------------------------- /vitrix/assets/models/quad.obj: -------------------------------------------------------------------------------- 1 | # Blender v3.0.1 OBJ File: 'quad.blend' 2 | # www.blender.org 3 | mtllib quad.mtl 4 | o Cube 5 | v 0.500000 -0.500000 0.000000 6 | v -0.500000 -0.500000 0.000000 7 | v 0.500000 0.500000 0.000000 8 | v -0.500000 0.500000 0.000000 9 | vt 0.999900 0.999900 10 | vt 0.000100 0.999900 11 | vt 0.000100 0.000100 12 | vt 0.999900 0.000100 13 | vn 0.0000 0.0000 1.0000 14 | usemtl Material 15 | s off 16 | f 3/1/1 4/2/1 2/3/1 17 | f 1/4/1 3/1/1 2/3/1 18 | -------------------------------------------------------------------------------- /vitrix/assets/models/sword.mtl: -------------------------------------------------------------------------------- 1 | # Blender MTL File: 'None' 2 | # Material Count: 1 3 | 4 | newmtl None 5 | Ns 500 6 | Ka 0.8 0.8 0.8 7 | Kd 0.8 0.8 0.8 8 | Ks 0.8 0.8 0.8 9 | d 1 10 | illum 2 11 | -------------------------------------------------------------------------------- /vitrix/assets/models/sword.obj: -------------------------------------------------------------------------------- 1 | # Blender v2.93.6 OBJ File: '' 2 | # www.blender.org 3 | mtllib sword.mtl 4 | o Plane 5 | v -1.000000 -0.213935 0.786065 6 | v 1.000000 0.000000 1.000000 7 | v -1.000000 -0.201108 -0.798892 8 | v 1.000000 0.000000 -1.000000 9 | v -10.945171 -0.198715 0.778545 10 | v -10.953284 -0.187993 -0.791757 11 | v 2.000000 0.000000 1.000000 12 | v -12.659242 -0.211910 0.005339 13 | v 2.000000 0.000000 -1.000000 14 | v 1.000000 0.000000 -2.000000 15 | v 2.000000 0.000000 -2.000000 16 | v 1.000000 0.000000 2.000000 17 | v 2.000000 0.000000 2.000000 18 | v -1.000000 -0.322950 0.786065 19 | v 1.000000 -0.536885 1.000000 20 | v -1.000000 -0.335777 -0.798892 21 | v 1.000000 -0.536885 -1.000000 22 | v -10.945171 -0.338170 0.778545 23 | v -10.953284 -0.348892 -0.791757 24 | v 2.000000 -0.536885 1.000000 25 | v -12.659242 -0.324974 0.005339 26 | v 2.000000 -0.536885 -1.000000 27 | v 1.000000 -0.536885 -2.000000 28 | v 2.000000 -0.536885 -2.000000 29 | v 1.000000 -0.536885 2.000000 30 | v 2.000000 -0.536885 2.000000 31 | v -1.000000 0.000000 0.530387 32 | v 1.000000 0.000000 0.530387 33 | v -11.000000 0.000000 0.530387 34 | v 2.000000 0.000000 0.530387 35 | v -1.000000 -0.536885 0.530387 36 | v 1.000000 -0.536885 0.530387 37 | v -11.000000 -0.536885 0.530387 38 | v 2.000000 -0.536885 0.530387 39 | v 1.000000 0.000000 -0.551971 40 | v 2.000000 0.000000 -0.551971 41 | v -12.283841 -0.170787 0.160630 42 | v 1.000000 -0.536885 -0.551971 43 | v 2.000000 -0.536885 -0.551971 44 | v -12.283841 -0.366098 0.160630 45 | v -1.000000 0.000000 -0.551971 46 | v -11.000000 0.000000 -0.551971 47 | v -1.000000 -0.536885 -0.551971 48 | v -11.000000 -0.536885 -0.551971 49 | vt 0.000000 0.775986 50 | vt 0.000000 1.000000 51 | vt 1.000000 1.000000 52 | vt 1.000000 0.775986 53 | vt 0.000000 0.775985 54 | vt 0.000000 1.000000 55 | vt 0.000000 0.707245 56 | vt 0.000000 1.000000 57 | vt 1.000000 0.234807 58 | vt 1.000000 0.234807 59 | vt 1.000000 0.000000 60 | vt 1.000000 0.000000 61 | vt 1.000000 1.000000 62 | vt 1.000000 1.000000 63 | vt 1.000000 1.000000 64 | vt 1.000000 0.000000 65 | vt 1.000000 0.000000 66 | vt 0.000000 0.775986 67 | vt 1.000000 0.775986 68 | vt 1.000000 1.000000 69 | vt 0.000000 1.000000 70 | vt 0.000000 1.000000 71 | vt 0.000000 0.775985 72 | vt 0.000000 0.707245 73 | vt 0.000000 1.000000 74 | vt 1.000000 0.234807 75 | vt 1.000000 0.000000 76 | vt 1.000000 0.000000 77 | vt 1.000000 0.234807 78 | vt 1.000000 1.000000 79 | vt 1.000000 1.000000 80 | vt 1.000000 1.000000 81 | vt 1.000000 0.000000 82 | vt 1.000000 0.000000 83 | vt 0.000000 0.000000 84 | vt 0.000000 0.000000 85 | vt 0.000000 0.000000 86 | vt 0.000000 0.000000 87 | vt 1.000000 0.775986 88 | vt 1.000000 0.775986 89 | vt 0.000000 0.234807 90 | vt 0.000000 0.234807 91 | vt 0.000000 0.234807 92 | vt 0.000000 0.234807 93 | vn 0.0622 -0.9587 0.2774 94 | vn -0.0003 -0.7811 0.6244 95 | vn 0.2300 -0.9126 0.3379 96 | vn 0.0000 -1.0000 0.0000 97 | vn 0.0622 0.9587 0.2774 98 | vn -0.0003 0.7811 0.6244 99 | vn 0.2300 0.9126 0.3379 100 | vn 0.0000 1.0000 0.0000 101 | vn 0.0000 0.0000 1.0000 102 | vn 0.0007 0.0000 1.0000 103 | vn -1.0000 0.0000 0.0000 104 | vn 0.0008 0.0000 -1.0000 105 | vn 1.0000 0.0000 0.0000 106 | vn 0.0000 0.0000 -1.0000 107 | vn 0.4233 0.0000 0.9060 108 | vn 0.1064 0.0000 -0.9943 109 | vn 0.4191 0.0000 -0.9079 110 | vn 0.1000 0.0000 0.9950 111 | vn -0.0004 0.7737 -0.6336 112 | vn 0.0663 0.9570 -0.2823 113 | vn -0.0004 -0.7737 -0.6336 114 | vn 0.0663 -0.9570 -0.2823 115 | vn 0.3823 0.0000 -0.9241 116 | vn 0.1733 0.9730 -0.1525 117 | vn 0.1733 -0.9730 -0.1525 118 | usemtl None 119 | s off 120 | f 41/1/1 3/2/1 4/3/1 35/4/1 121 | f 41/1/2 42/5/2 6/6/2 3/2/2 122 | f 37/7/3 8/8/3 6/6/3 42/5/3 123 | f 28/9/4 30/10/4 7/11/4 2/12/4 124 | f 4/3/4 10/13/4 11/14/4 9/15/4 125 | f 7/11/4 13/16/4 12/17/4 2/12/4 126 | f 43/18/5 38/19/5 17/20/5 16/21/5 127 | f 43/18/6 16/21/6 19/22/6 44/23/6 128 | f 40/24/7 44/23/7 19/22/7 21/25/7 129 | f 32/26/8 15/27/8 20/28/8 34/29/8 130 | f 17/20/8 22/30/8 24/31/8 23/32/8 131 | f 20/28/8 15/27/8 25/33/8 26/34/8 132 | f 11/14/9 10/13/9 23/32/9 24/31/9 133 | f 3/2/10 6/6/10 19/22/10 16/21/10 134 | f 9/15/11 11/14/11 24/31/11 22/30/11 135 | f 5/35/12 1/36/12 14/37/12 18/38/12 136 | f 10/13/13 4/3/13 17/20/13 23/32/13 137 | f 36/39/11 9/15/11 22/30/11 39/40/11 138 | f 12/17/14 13/16/14 26/34/14 25/33/14 139 | f 6/6/15 8/8/15 21/25/15 19/22/15 140 | f 1/36/16 2/12/16 15/27/16 14/37/16 141 | f 2/12/13 12/17/13 25/33/13 15/27/13 142 | f 37/7/17 5/35/17 18/38/17 40/24/17 143 | f 13/16/11 7/11/11 20/28/11 26/34/11 144 | f 4/3/18 3/2/18 16/21/18 17/20/18 145 | f 7/11/11 30/10/11 34/29/11 20/28/11 146 | f 38/19/8 32/26/8 34/29/8 39/40/8 147 | f 14/37/19 31/41/19 33/42/19 18/38/19 148 | f 14/37/20 15/27/20 32/26/20 31/41/20 149 | f 35/4/4 36/39/4 30/10/4 28/9/4 150 | f 1/36/21 5/35/21 29/43/21 27/44/21 151 | f 1/36/22 27/44/22 28/9/22 2/12/22 152 | f 4/3/4 9/15/4 36/39/4 35/4/4 153 | f 17/20/8 38/19/8 39/40/8 22/30/8 154 | f 8/8/23 37/7/23 40/24/23 21/25/23 155 | f 30/10/11 36/39/11 39/40/11 34/29/11 156 | f 18/38/24 33/42/24 44/23/24 40/24/24 157 | f 31/41/8 43/18/8 44/23/8 33/42/8 158 | f 31/41/8 32/26/8 38/19/8 43/18/8 159 | f 5/35/25 37/7/25 42/5/25 29/43/25 160 | f 27/44/4 29/43/4 42/5/4 41/1/4 161 | f 27/44/4 41/1/4 35/4/4 28/9/4 162 | o Cylinder 163 | v 2.000000 -0.510973 -0.073087 164 | v 4.820092 -0.510973 -0.073086 165 | v 2.000000 -0.506161 0.037710 166 | v 4.820092 -0.506162 0.037710 167 | v 2.000000 -0.491912 0.144249 168 | v 4.820092 -0.491912 0.144249 169 | v 2.000000 -0.468772 0.242436 170 | v 4.820092 -0.468772 0.242436 171 | v 2.000000 -0.437631 0.328497 172 | v 4.820092 -0.437632 0.328497 173 | v 2.000000 -0.399686 0.399126 174 | v 4.820092 -0.399686 0.399126 175 | v 2.000000 -0.356395 0.451608 176 | v 4.820092 -0.356395 0.451608 177 | v 2.000000 -0.309421 0.483926 178 | v 4.820092 -0.309421 0.483926 179 | v 2.000000 -0.260569 0.494838 180 | v 4.820092 -0.260569 0.494838 181 | v 2.000000 -0.211718 0.483926 182 | v 4.820092 -0.211718 0.483926 183 | v 2.000000 -0.164744 0.451608 184 | v 4.820092 -0.164744 0.451608 185 | v 2.000000 -0.121453 0.399126 186 | v 4.820092 -0.121453 0.399126 187 | v 2.000000 -0.083507 0.328497 188 | v 4.820092 -0.083507 0.328497 189 | v 2.000000 -0.052366 0.242436 190 | v 4.820092 -0.052366 0.242436 191 | v 2.000000 -0.029227 0.144249 192 | v 4.820092 -0.029227 0.144249 193 | v 2.000000 -0.014977 0.037710 194 | v 4.820092 -0.014977 0.037710 195 | v 2.000000 -0.010166 -0.073087 196 | v 4.820092 -0.010166 -0.073087 197 | v 2.000000 -0.014977 -0.183883 198 | v 4.820092 -0.014977 -0.183883 199 | v 2.000000 -0.029227 -0.290422 200 | v 4.820092 -0.029227 -0.290422 201 | v 2.000000 -0.052366 -0.388609 202 | v 4.820092 -0.052366 -0.388609 203 | v 2.000000 -0.083507 -0.474670 204 | v 4.820092 -0.083507 -0.474670 205 | v 2.000000 -0.121453 -0.545299 206 | v 4.820092 -0.121453 -0.545299 207 | v 2.000000 -0.164744 -0.597781 208 | v 4.820092 -0.164744 -0.597781 209 | v 2.000000 -0.211718 -0.630099 210 | v 4.820092 -0.211718 -0.630099 211 | v 2.000000 -0.260569 -0.641012 212 | v 4.820092 -0.260569 -0.641011 213 | v 2.000000 -0.309421 -0.630099 214 | v 4.820092 -0.309421 -0.630099 215 | v 2.000000 -0.356395 -0.597781 216 | v 4.820092 -0.356395 -0.597781 217 | v 2.000000 -0.399686 -0.545299 218 | v 4.820092 -0.399686 -0.545299 219 | v 2.000000 -0.437631 -0.474670 220 | v 4.820092 -0.437631 -0.474670 221 | v 2.000000 -0.468772 -0.388609 222 | v 4.820092 -0.468772 -0.388609 223 | v 2.000000 -0.491912 -0.290422 224 | v 4.820092 -0.491912 -0.290422 225 | v 2.000000 -0.506162 -0.183883 226 | v 4.820092 -0.506162 -0.183883 227 | vt 1.000000 0.500000 228 | vt 1.000000 1.000000 229 | vt 0.968750 1.000000 230 | vt 0.968750 0.500000 231 | vt 0.937500 1.000000 232 | vt 0.937500 0.500000 233 | vt 0.906250 1.000000 234 | vt 0.906250 0.500000 235 | vt 0.875000 1.000000 236 | vt 0.875000 0.500000 237 | vt 0.843750 1.000000 238 | vt 0.843750 0.500000 239 | vt 0.812500 1.000000 240 | vt 0.812500 0.500000 241 | vt 0.781250 1.000000 242 | vt 0.781250 0.500000 243 | vt 0.750000 1.000000 244 | vt 0.750000 0.500000 245 | vt 0.718750 1.000000 246 | vt 0.718750 0.500000 247 | vt 0.687500 1.000000 248 | vt 0.687500 0.500000 249 | vt 0.656250 1.000000 250 | vt 0.656250 0.500000 251 | vt 0.625000 1.000000 252 | vt 0.625000 0.500000 253 | vt 0.593750 1.000000 254 | vt 0.593750 0.500000 255 | vt 0.562500 1.000000 256 | vt 0.562500 0.500000 257 | vt 0.531250 1.000000 258 | vt 0.531250 0.500000 259 | vt 0.500000 1.000000 260 | vt 0.500000 0.500000 261 | vt 0.468750 1.000000 262 | vt 0.468750 0.500000 263 | vt 0.437500 1.000000 264 | vt 0.437500 0.500000 265 | vt 0.406250 1.000000 266 | vt 0.406250 0.500000 267 | vt 0.375000 1.000000 268 | vt 0.375000 0.500000 269 | vt 0.343750 1.000000 270 | vt 0.343750 0.500000 271 | vt 0.312500 1.000000 272 | vt 0.312500 0.500000 273 | vt 0.281250 1.000000 274 | vt 0.281250 0.500000 275 | vt 0.250000 1.000000 276 | vt 0.250000 0.500000 277 | vt 0.218750 1.000000 278 | vt 0.218750 0.500000 279 | vt 0.187500 1.000000 280 | vt 0.187500 0.500000 281 | vt 0.156250 1.000000 282 | vt 0.156250 0.500000 283 | vt 0.125000 1.000000 284 | vt 0.125000 0.500000 285 | vt 0.093750 1.000000 286 | vt 0.093750 0.500000 287 | vt 0.062500 1.000000 288 | vt 0.062500 0.500000 289 | vt 0.296822 0.485388 290 | vt 0.250000 0.490000 291 | vt 0.203178 0.485388 292 | vt 0.158156 0.471731 293 | vt 0.116663 0.449553 294 | vt 0.080294 0.419706 295 | vt 0.050447 0.383337 296 | vt 0.028269 0.341844 297 | vt 0.014612 0.296822 298 | vt 0.010000 0.250000 299 | vt 0.014612 0.203178 300 | vt 0.028269 0.158156 301 | vt 0.050447 0.116663 302 | vt 0.080294 0.080294 303 | vt 0.116663 0.050447 304 | vt 0.158156 0.028269 305 | vt 0.203178 0.014612 306 | vt 0.250000 0.010000 307 | vt 0.296822 0.014612 308 | vt 0.341844 0.028269 309 | vt 0.383337 0.050447 310 | vt 0.419706 0.080294 311 | vt 0.449553 0.116663 312 | vt 0.471731 0.158156 313 | vt 0.485388 0.203178 314 | vt 0.490000 0.250000 315 | vt 0.485388 0.296822 316 | vt 0.471731 0.341844 317 | vt 0.449553 0.383337 318 | vt 0.419706 0.419706 319 | vt 0.383337 0.449553 320 | vt 0.341844 0.471731 321 | vt 0.031250 1.000000 322 | vt 0.031250 0.500000 323 | vt 0.000000 1.000000 324 | vt 0.000000 0.500000 325 | vt 0.750000 0.490000 326 | vt 0.796822 0.485388 327 | vt 0.841844 0.471731 328 | vt 0.883337 0.449553 329 | vt 0.919706 0.419706 330 | vt 0.949553 0.383337 331 | vt 0.971731 0.341844 332 | vt 0.985388 0.296822 333 | vt 0.990000 0.250000 334 | vt 0.985388 0.203178 335 | vt 0.971731 0.158156 336 | vt 0.949553 0.116663 337 | vt 0.919706 0.080294 338 | vt 0.883337 0.050447 339 | vt 0.841844 0.028269 340 | vt 0.796822 0.014612 341 | vt 0.750000 0.010000 342 | vt 0.703178 0.014612 343 | vt 0.658156 0.028269 344 | vt 0.616663 0.050447 345 | vt 0.580294 0.080294 346 | vt 0.550447 0.116663 347 | vt 0.528269 0.158156 348 | vt 0.514612 0.203178 349 | vt 0.510000 0.250000 350 | vt 0.514612 0.296822 351 | vt 0.528269 0.341844 352 | vt 0.550447 0.383337 353 | vt 0.580294 0.419706 354 | vt 0.616663 0.449553 355 | vt 0.658156 0.471731 356 | vt 0.703178 0.485388 357 | vn -0.0000 -0.9991 0.0434 358 | vn -0.0000 -0.9912 0.1326 359 | vn -0.0000 -0.9733 0.2294 360 | vn -0.0000 -0.9403 0.3403 361 | vn -0.0000 -0.8809 0.4733 362 | vn -0.0000 -0.7714 0.6363 363 | vn -0.0000 -0.5668 0.8238 364 | vn -0.0000 -0.2180 0.9759 365 | vn -0.0000 0.2180 0.9759 366 | vn -0.0000 0.5668 0.8238 367 | vn 0.0000 0.7714 0.6363 368 | vn 0.0000 0.8809 0.4733 369 | vn 0.0000 0.9403 0.3403 370 | vn 0.0000 0.9733 0.2294 371 | vn 0.0000 0.9912 0.1326 372 | vn 0.0000 0.9991 0.0434 373 | vn 0.0000 0.9991 -0.0434 374 | vn 0.0000 0.9912 -0.1326 375 | vn 0.0000 0.9733 -0.2294 376 | vn 0.0000 0.9403 -0.3403 377 | vn 0.0000 0.8809 -0.4733 378 | vn 0.0000 0.7714 -0.6363 379 | vn 0.0000 0.5668 -0.8238 380 | vn 0.0000 0.2180 -0.9759 381 | vn 0.0000 -0.2180 -0.9759 382 | vn 0.0000 -0.5668 -0.8238 383 | vn -0.0000 -0.7714 -0.6363 384 | vn -0.0000 -0.8809 -0.4733 385 | vn -0.0000 -0.9403 -0.3403 386 | vn -0.0000 -0.9733 -0.2294 387 | vn 1.0000 0.0000 0.0000 388 | vn -0.0000 -0.9912 -0.1326 389 | vn -0.0000 -0.9991 -0.0434 390 | vn -1.0000 -0.0000 0.0000 391 | usemtl None 392 | s off 393 | f 45/45/26 46/46/26 48/47/26 47/48/26 394 | f 47/48/27 48/47/27 50/49/27 49/50/27 395 | f 49/50/28 50/49/28 52/51/28 51/52/28 396 | f 51/52/29 52/51/29 54/53/29 53/54/29 397 | f 53/54/30 54/53/30 56/55/30 55/56/30 398 | f 55/56/31 56/55/31 58/57/31 57/58/31 399 | f 57/58/32 58/57/32 60/59/32 59/60/32 400 | f 59/60/33 60/59/33 62/61/33 61/62/33 401 | f 61/62/34 62/61/34 64/63/34 63/64/34 402 | f 63/64/35 64/63/35 66/65/35 65/66/35 403 | f 65/66/36 66/65/36 68/67/36 67/68/36 404 | f 67/68/37 68/67/37 70/69/37 69/70/37 405 | f 69/70/38 70/69/38 72/71/38 71/72/38 406 | f 71/72/39 72/71/39 74/73/39 73/74/39 407 | f 73/74/40 74/73/40 76/75/40 75/76/40 408 | f 75/76/41 76/75/41 78/77/41 77/78/41 409 | f 77/78/42 78/77/42 80/79/42 79/80/42 410 | f 79/80/43 80/79/43 82/81/43 81/82/43 411 | f 81/82/44 82/81/44 84/83/44 83/84/44 412 | f 83/84/45 84/83/45 86/85/45 85/86/45 413 | f 85/86/46 86/85/46 88/87/46 87/88/46 414 | f 87/88/47 88/87/47 90/89/47 89/90/47 415 | f 89/90/48 90/89/48 92/91/48 91/92/48 416 | f 91/92/49 92/91/49 94/93/49 93/94/49 417 | f 93/94/50 94/93/50 96/95/50 95/96/50 418 | f 95/96/51 96/95/51 98/97/51 97/98/51 419 | f 97/98/52 98/97/52 100/99/52 99/100/52 420 | f 99/100/53 100/99/53 102/101/53 101/102/53 421 | f 101/102/54 102/101/54 104/103/54 103/104/54 422 | f 103/104/55 104/103/55 106/105/55 105/106/55 423 | f 48/107/56 46/108/56 108/109/56 106/110/56 104/111/56 102/112/56 100/113/56 98/114/56 96/115/56 94/116/56 92/117/56 90/118/56 88/119/56 86/120/56 84/121/56 82/122/56 80/123/56 78/124/56 76/125/56 74/126/56 72/127/56 70/128/56 68/129/56 66/130/56 64/131/56 62/132/56 60/133/56 58/134/56 56/135/56 54/136/56 52/137/56 50/138/56 424 | f 105/106/57 106/105/57 108/139/57 107/140/57 425 | f 107/140/58 108/139/58 46/141/58 45/142/58 426 | f 45/143/59 47/144/59 49/145/59 51/146/59 53/147/59 55/148/59 57/149/59 59/150/59 61/151/59 63/152/59 65/153/59 67/154/59 69/155/59 71/156/59 73/157/59 75/158/59 77/159/59 79/160/59 81/161/59 83/162/59 85/163/59 87/164/59 89/165/59 91/166/59 93/167/59 95/168/59 97/169/59 99/170/59 101/171/59 103/172/59 105/173/59 107/174/59 427 | o Cone 428 | v 1.263732 0.000000 0.449782 429 | v 1.155925 0.000000 -0.395315 430 | v 1.371539 0.000000 -0.395315 431 | v 1.263732 0.199644 -0.113616 432 | vt 0.250000 0.490000 433 | vt 0.250000 0.250000 434 | vt 0.457846 0.130000 435 | vt 0.750000 0.490000 436 | vt 0.957846 0.130000 437 | vt 0.542154 0.130000 438 | vt 0.042154 0.130000 439 | vn -0.9342 0.3363 0.1192 440 | vn 0.0000 -1.0000 0.0000 441 | vn 0.0000 0.8159 -0.5782 442 | vn 0.9342 0.3363 0.1192 443 | usemtl None 444 | s off 445 | f 109/175/60 112/176/60 110/177/60 446 | f 109/178/61 110/179/61 111/180/61 447 | f 110/177/62 112/176/62 111/181/62 448 | f 111/181/63 112/176/63 109/175/63 449 | -------------------------------------------------------------------------------- /vitrix/assets/sounds/background-music.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/sounds/background-music.wav -------------------------------------------------------------------------------- /vitrix/assets/sounds/death.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/sounds/death.wav -------------------------------------------------------------------------------- /vitrix/assets/sounds/hurt.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/sounds/hurt.wav -------------------------------------------------------------------------------- /vitrix/assets/sounds/pew.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/sounds/pew.wav -------------------------------------------------------------------------------- /vitrix/assets/sounds/reload.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/sounds/reload.wav -------------------------------------------------------------------------------- /vitrix/assets/sounds/splat.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/sounds/splat.wav -------------------------------------------------------------------------------- /vitrix/assets/sounds/swing.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/sounds/swing.wav -------------------------------------------------------------------------------- /vitrix/assets/sounds/zombie_growl.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/sounds/zombie_growl.wav -------------------------------------------------------------------------------- /vitrix/assets/static/font.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/static/font.ttf -------------------------------------------------------------------------------- /vitrix/assets/static/logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/static/logo.ico -------------------------------------------------------------------------------- /vitrix/assets/static/text-licence.txt: -------------------------------------------------------------------------------- 1 | Copyright 2018 The ZCOOL QingKe HuangYou Project Authors (https://www.github.com/googlefonts/zcool-qingke-huangyou) 2 | 3 | This Font Software is licensed under the SIL Open Font License, Version 1.1. 4 | This license is copied below, and is also available with a FAQ at: 5 | http://scripts.sil.org/OFL 6 | 7 | 8 | ----------------------------------------------------------- 9 | SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 10 | ----------------------------------------------------------- 11 | 12 | PREAMBLE 13 | The goals of the Open Font License (OFL) are to stimulate worldwide 14 | development of collaborative font projects, to support the font creation 15 | efforts of academic and linguistic communities, and to provide a free and 16 | open framework in which fonts may be shared and improved in partnership 17 | with others. 18 | 19 | The OFL allows the licensed fonts to be used, studied, modified and 20 | redistributed freely as long as they are not sold by themselves. The 21 | fonts, including any derivative works, can be bundled, embedded, 22 | redistributed and/or sold with any software provided that any reserved 23 | names are not used by derivative works. The fonts and derivatives, 24 | however, cannot be released under any other type of license. The 25 | requirement for fonts to remain under this license does not apply 26 | to any document created using the fonts or their derivatives. 27 | 28 | DEFINITIONS 29 | "Font Software" refers to the set of files released by the Copyright 30 | Holder(s) under this license and clearly marked as such. This may 31 | include source files, build scripts and documentation. 32 | 33 | "Reserved Font Name" refers to any names specified as such after the 34 | copyright statement(s). 35 | 36 | "Original Version" refers to the collection of Font Software components as 37 | distributed by the Copyright Holder(s). 38 | 39 | "Modified Version" refers to any derivative made by adding to, deleting, 40 | or substituting -- in part or in whole -- any of the components of the 41 | Original Version, by changing formats or by porting the Font Software to a 42 | new environment. 43 | 44 | "Author" refers to any designer, engineer, programmer, technical 45 | writer or other person who contributed to the Font Software. 46 | 47 | PERMISSION & CONDITIONS 48 | Permission is hereby granted, free of charge, to any person obtaining 49 | a copy of the Font Software, to use, study, copy, merge, embed, modify, 50 | redistribute, and sell modified and unmodified copies of the Font 51 | Software, subject to the following conditions: 52 | 53 | 1) Neither the Font Software nor any of its individual components, 54 | in Original or Modified Versions, may be sold by itself. 55 | 56 | 2) Original or Modified Versions of the Font Software may be bundled, 57 | redistributed and/or sold with any software, provided that each copy 58 | contains the above copyright notice and this license. These can be 59 | included either as stand-alone text files, human-readable headers or 60 | in the appropriate machine-readable metadata fields within text or 61 | binary files as long as those fields can be easily viewed by the user. 62 | 63 | 3) No Modified Version of the Font Software may use the Reserved Font 64 | Name(s) unless explicit written permission is granted by the corresponding 65 | Copyright Holder. This restriction only applies to the primary font name as 66 | presented to the users. 67 | 68 | 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font 69 | Software shall not be used to promote, endorse or advertise any 70 | Modified Version, except to acknowledge the contribution(s) of the 71 | Copyright Holder(s) and the Author(s) or with their explicit written 72 | permission. 73 | 74 | 5) The Font Software, modified or unmodified, in part or in whole, 75 | must be distributed entirely under this license, and must not be 76 | distributed under any other license. The requirement for fonts to 77 | remain under this license does not apply to any document created 78 | using the Font Software. 79 | 80 | TERMINATION 81 | This license becomes null and void if any of the above conditions are 82 | not met. 83 | 84 | DISCLAIMER 85 | THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 86 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF 87 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT 88 | OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE 89 | COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 90 | INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL 91 | DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 92 | FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM 93 | OTHER DEALINGS IN THE FONT SOFTWARE. 94 | -------------------------------------------------------------------------------- /vitrix/assets/textures/Inventory/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/Inventory/1.png -------------------------------------------------------------------------------- /vitrix/assets/textures/Inventory/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/Inventory/2.png -------------------------------------------------------------------------------- /vitrix/assets/textures/Inventory/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/Inventory/3.png -------------------------------------------------------------------------------- /vitrix/assets/textures/Inventory/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/Inventory/4.png -------------------------------------------------------------------------------- /vitrix/assets/textures/Inventory/base template.psd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/Inventory/base template.psd -------------------------------------------------------------------------------- /vitrix/assets/textures/Inventory/batleaxe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/Inventory/batleaxe.png -------------------------------------------------------------------------------- /vitrix/assets/textures/Inventory/glock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/Inventory/glock.png -------------------------------------------------------------------------------- /vitrix/assets/textures/Inventory/hammer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/Inventory/hammer.png -------------------------------------------------------------------------------- /vitrix/assets/textures/Inventory/sword.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/Inventory/sword.png -------------------------------------------------------------------------------- /vitrix/assets/textures/ammo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/ammo.png -------------------------------------------------------------------------------- /vitrix/assets/textures/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/background.png -------------------------------------------------------------------------------- /vitrix/assets/textures/bullet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/bullet.png -------------------------------------------------------------------------------- /vitrix/assets/textures/bullet_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/bullet_2.png -------------------------------------------------------------------------------- /vitrix/assets/textures/bullet_test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/bullet_test.png -------------------------------------------------------------------------------- /vitrix/assets/textures/crate.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/crate.png -------------------------------------------------------------------------------- /vitrix/assets/textures/extra.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/extra.png -------------------------------------------------------------------------------- /vitrix/assets/textures/first_aid_kit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/first_aid_kit.png -------------------------------------------------------------------------------- /vitrix/assets/textures/floor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/floor.png -------------------------------------------------------------------------------- /vitrix/assets/textures/hammer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/hammer.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/0.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/1.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/10.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/11.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/12.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/13.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/14.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/15.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/15.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/2.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/3.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/4.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/5.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/6.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/7.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/8.png -------------------------------------------------------------------------------- /vitrix/assets/textures/healthbar/9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/healthbar/9.png -------------------------------------------------------------------------------- /vitrix/assets/textures/heart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/heart.png -------------------------------------------------------------------------------- /vitrix/assets/textures/melee-crosshair.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/melee-crosshair.png -------------------------------------------------------------------------------- /vitrix/assets/textures/pistol.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/pistol.png -------------------------------------------------------------------------------- /vitrix/assets/textures/ranged-crosshair.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/ranged-crosshair.png -------------------------------------------------------------------------------- /vitrix/assets/textures/sky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/C0rupted/Vitrix/84408989f764fa46a7cf0af49cfa82d99bbc8e4c/vitrix/assets/textures/sky.png -------------------------------------------------------------------------------- /vitrix/lib/UI/chat.py: -------------------------------------------------------------------------------- 1 | from vitrix_engine import * 2 | from lib.classes.network import Network 3 | 4 | class Chat(Entity): 5 | def __init__(self, network: Network, username: str, **kwargs): 6 | super().__init__( 7 | parent = camera.ui, 8 | model = Quad(radius=0), 9 | texture = 'white_cube', 10 | scale = Vec2(.5, .6), 11 | position = Vec2(-.636, .2), 12 | color = color.white33, 13 | ) 14 | 15 | self.list = [] 16 | self.network = network 17 | self.prefix = f"[{username}] " 18 | 19 | self.chat_text = Text() 20 | self.text_field = InputField(position=Vec2(-.636, -.13)) 21 | 22 | self.disable() 23 | 24 | for key, value in kwargs.items(): 25 | setattr(self, key, value) 26 | 27 | def update(self): 28 | if len(self.list) >= 24: 29 | self.list.pop(0) 30 | 31 | destroy(self.chat_text) 32 | self.chat_text = Text( 33 | text= "".join(f"{item}\n" for item in self.list), 34 | position = (-.87, .485), 35 | z=camera.clip_plane_near, 36 | scale=1 37 | ) 38 | 39 | 40 | def input(self, key): 41 | if key == "enter": 42 | #temp = self.prefix + self.text_field.text 43 | self.network.send_message(self.prefix + self.text_field.text) 44 | self.list.append(self.prefix + self.text_field.text) 45 | self.text_field.text = "" 46 | 47 | def enable(self): 48 | self.enabled = True 49 | self.chat_text.enabled = True 50 | self.text_field.enabled = True 51 | 52 | def disable(self): 53 | self.enabled = False 54 | self.chat_text.enabled = False 55 | self.text_field.enabled = False 56 | -------------------------------------------------------------------------------- /vitrix/lib/UI/crosshair.py: -------------------------------------------------------------------------------- 1 | from vitrix_engine import * 2 | from lib.paths import GamePaths 3 | 4 | 5 | class Crosshair(Entity): 6 | def __init__(self): 7 | super().__init__( 8 | parent=camera.ui, 9 | model=os.path.join(GamePaths.models_dir, "cube.obj"), 10 | scale=.07 11 | ) 12 | 13 | self.set_ranged() 14 | 15 | def set_ranged(self): 16 | self.texture = os.path.join(GamePaths.textures_dir, "ranged-crosshair.png") 17 | 18 | def set_melee(self): 19 | self.texture = os.path.join(GamePaths.textures_dir, "melee-crosshair.png") -------------------------------------------------------------------------------- /vitrix/lib/UI/healthbar.py: -------------------------------------------------------------------------------- 1 | import math 2 | from turtle import position 3 | from vitrix_engine import * 4 | from lib.paths import GamePaths 5 | 6 | 7 | class HealthBar(Entity): 8 | def __init__(self, max_value): 9 | cube = os.path.join(GamePaths.models_dir, "cube.obj") 10 | super().__init__( 11 | parent = camera.ui, 12 | position = Vec2(-.62, -.43), 13 | scale = Vec2(.4175, .125), 14 | rotation=Vec3(0, 0, 180), 15 | model = cube, 16 | ) 17 | 18 | self.icon = Entity(parent=camera.ui, model=cube, position=Vec2(-.81, -.43), 19 | texture=os.path.join(GamePaths.textures_dir, "heart.png"), 20 | scale=0.1, shader=None) 21 | 22 | self.shader = None 23 | self.max_value = max_value 24 | self.value = self.max_value 25 | self.segments = 15 26 | self.value_per_segment = self.max_value / self.segments 27 | 28 | self.update_texture(self.value) 29 | 30 | def update_texture(self, value): 31 | if value > self.max_value: 32 | self.value = self.max_value 33 | else: 34 | self.value = value 35 | 36 | x = 0 37 | i = 0 38 | while x < self.value: 39 | x += self.value_per_segment 40 | i += 1 41 | self.texture = os.path.join(GamePaths.textures_dir, "healthbar", 42 | str(i) +".png") 43 | 44 | def update(self): 45 | self.update_texture(self.value) 46 | 47 | -------------------------------------------------------------------------------- /vitrix/lib/UI/inventory.py: -------------------------------------------------------------------------------- 1 | import math 2 | from turtle import position 3 | from vitrix_engine import * 4 | from lib.paths import GamePaths 5 | from vitrix_engine.prefabs.first_person_controller import FirstPersonController 6 | 7 | 8 | class HealthBar(Entity): 9 | def __init__(self, max_value): 10 | cube = os.path.join(GamePaths.models_dir, "cube.obj") 11 | super().__init__( 12 | parent = camera.ui, 13 | position = Vec2(-.20, -.43), 14 | scale = Vec2(.4175, .125), 15 | rotation=Vec3(0, 0, 180), 16 | model = cube, 17 | ) 18 | 19 | self.set_ranged() 20 | 21 | self.texture = os.path.join(GamePaths.textures_dir, "Inventory", 22 | str)(i) +".png" 23 | 24 | # self.icon = Entity(parent=camera.ui, model=cube, position=Vec2(-.20, -.0), 25 | # texture=os.path.join(GamePaths.textures_dir, ""), 26 | # scale=0.1, shader=None) 27 | 28 | # self.shader = None 29 | # self.max_value = max_value 30 | # self.value = self.max_value 31 | # self.segments = 15 32 | # self.value_per_segment = self.max_value / self.segments 33 | 34 | # x = 0 35 | # i = 0 36 | # while x < self.value: 37 | # x += self.value_per_segment 38 | # i += 1 39 | # self.texture = os.path.join(GamePaths.textures_dir, "Inventory", 40 | # str(i) +".png") 41 | 42 | # code not ready 43 | 44 | # def inventory_close(): 45 | # Inventory().inventory_ui.enable = False 46 | 47 | # def inventory_enable(): 48 | 49 | # inventory = Inventory() 50 | # Inventory().enable = False 51 | # def add_item(): 52 | # Inventory().append(random.choice(('hammer', 'axe', 'gem', 'pistol', 'sword'))) 53 | 54 | # for i in range(7): 55 | # add_item() 56 | 57 | # add_item_button = Button( 58 | # scale = (.1,.1), 59 | # x = -.5, 60 | # color = color.lime.tint(-.25), 61 | # text = '+', 62 | # tooltip = Tooltip('Add random item'), 63 | # on_click = add_item 64 | # ) 65 | 66 | # # Drag and drop functions, not ready yet 67 | # def find_free_spot(self): 68 | # taken_spots = [(int(e.x), int(e.y)) for e in self.item_parent.children] 69 | # for y in range(8): 70 | # for x in range(5): 71 | # if not (x,-y) in taken_spots: 72 | # return (x,-y) 73 | 74 | 75 | # def append(self, item): 76 | # icon = Draggable( 77 | # parent = Inventory().item_parent, 78 | # model = 'quad', 79 | # texture = item, 80 | # color = color.white, 81 | # origin = (-.5,.5), 82 | # position = self.find_free_spot(), 83 | # z = -.1, 84 | # ) 85 | # name = item.replace('_', ' ').title() 86 | # icon.tooltip = Tooltip(name) 87 | # icon.tooltip.background.color = color.color(0,0,0,.8) 88 | 89 | 90 | # def drag(): 91 | # icon.org_pos = (icon.x, icon.y) 92 | 93 | # def drop(): 94 | # icon.x = int(icon.x) 95 | # icon.y = int(icon.y) 96 | 97 | 98 | 99 | # '''if the spot is taken, swap positions''' 100 | # for c in self.children: 101 | # if c == icon: 102 | # continue 103 | 104 | # if c.x == icon.x and c.y == icon.y: 105 | # print('swap positions') 106 | # c.position = icon.org_pos 107 | 108 | 109 | # icon.drag = drag 110 | # icon.drop = drop 111 | 112 | 113 | -------------------------------------------------------------------------------- /vitrix/lib/UI/notification.py: -------------------------------------------------------------------------------- 1 | import os 2 | import tkinter as tk 3 | from lib.paths import GamePaths 4 | 5 | def on_closing(): 6 | os._exit(0) 7 | 8 | def notify(title: str, msg: str,): 9 | popup = tk.Tk() 10 | popup.title(title) 11 | try: 12 | popup.iconbitmap(os.path.join(GamePaths.static_dir, "logo.ico")) 13 | except: 14 | pass 15 | label = tk.Label(popup, text=msg) 16 | label.pack(side="top", fill="x", pady=10) 17 | B1 = tk.Button(popup, text="Okay", command=popup.destroy) 18 | B1.pack(pady=10) 19 | popup.protocol("WM_DELETE_WINDOW", on_closing) 20 | popup.mainloop() 21 | -------------------------------------------------------------------------------- /vitrix/lib/UI/server_chooser.py: -------------------------------------------------------------------------------- 1 | import os 2 | from tkinter import * 3 | from lib.paths import GamePaths 4 | from lib.UI.notification import notify 5 | 6 | 7 | root = Tk() 8 | root.title("Vitrix - Join a multiplayer server") 9 | 10 | try: 11 | root.iconbitmap(os.path.join(GamePaths.static_dir, "logo.ico")) 12 | except: 13 | pass 14 | 15 | screen_width = root.winfo_screenwidth() 16 | screen_height = root.winfo_screenheight() 17 | 18 | window_width = 459 19 | window_height = 150 20 | 21 | center_x = int(screen_width / 2 - window_width / 2) 22 | center_y = int(screen_height / 2 - window_height / 2) 23 | 24 | root.geometry(f'{window_width}x{window_height}+{center_x}+{center_y}') 25 | 26 | 27 | def on_closing(): 28 | os._exit(0) 29 | 30 | 31 | def submit(): 32 | try: 33 | temp =int(E3.get()) 34 | except: 35 | notify("Vitrix Fatal Error", "Invalid Port Number!") 36 | return 37 | 38 | if E1.get().strip() != "": 39 | if E2.get().strip() != "": 40 | if E3.get().strip() != "": 41 | file = open("data.txt", "w") 42 | file.writelines([E1.get(), "\n", E2.get(), "\n", E3.get()]) 43 | file.close() 44 | root.destroy() 45 | else: 46 | notify("Vitrix Fatal Error", "Port cannot be blank!") 47 | return 48 | else: 49 | notify("Vitrix Fatal Error", "IP Address cannot be blank!") 50 | return 51 | else: 52 | notify("Vitrix Fatal Error", "Username cannot be blank!") 53 | return 54 | 55 | 56 | 57 | L1 = Label(root, text="Username:") 58 | L1.place(anchor = CENTER, relx = .10, rely = .1) 59 | E1 = Entry(root, bd = 5) 60 | E1.place(anchor = CENTER, relx = .5, rely = .1) 61 | 62 | L2 = Label(root, text="Server:") 63 | L2.place(anchor = CENTER, relx = .10, rely = .3) 64 | E2 = Entry(root, bd = 5) 65 | E2.place(anchor = CENTER, relx = .5, rely = .3) 66 | 67 | L3 = Label(root, text="Port:") 68 | L3.place(anchor = CENTER, relx = .10, rely = .5) 69 | E3 = Entry(root, bd = 5) 70 | E3.place(anchor = CENTER, relx = .5, rely = .5) 71 | 72 | submit = Button(root, text="Join", width=10, command=submit) 73 | submit.place(anchor = CENTER, relx = .5, rely = .8) 74 | 75 | root.protocol("WM_DELETE_WINDOW", on_closing) 76 | root.mainloop() 77 | -------------------------------------------------------------------------------- /vitrix/lib/classes/anticheat.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | def perform_quit(): 4 | print("Found cheat. Quitting...") 5 | 6 | with open("ib.cfg", "w") as f: 7 | f.write("1") 8 | with open("../ib.cfg", "w") as f: 9 | f.write("1") 10 | 11 | sys.exit(1) 12 | 13 | def check_jump_height(jump_height: int, valid_jump_height: int): 14 | if jump_height != valid_jump_height: 15 | perform_quit() 16 | 17 | def check_speed(speed: int): 18 | if speed not in [3, 7]: 19 | perform_quit() 20 | 21 | def check_health(health: int): 22 | if health > 150: 23 | perform_quit() -------------------------------------------------------------------------------- /vitrix/lib/classes/network.py: -------------------------------------------------------------------------------- 1 | import socket 2 | import json 3 | 4 | from lib.entities.player import Player 5 | from lib.entities.enemy import Enemy 6 | from lib.entities.bullet import Bullet 7 | 8 | 9 | class Network: 10 | def __init__(self, server_addr: str, server_port: int, username: str): 11 | self.client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 12 | self.addr = server_addr 13 | self.port = server_port 14 | self.username = username 15 | self.recv_size = 2048 16 | self.id = 0 17 | 18 | 19 | def settimeout(self, value): 20 | self.client.settimeout(value) 21 | 22 | 23 | def connect(self): 24 | """ 25 | Connect to the server and get a unique identifier 26 | """ 27 | 28 | self.client.connect((self.addr, self.port)) 29 | self.id = self.client.recv(self.recv_size).decode("utf8") 30 | self.client.send(self.username.encode("utf8")) 31 | 32 | 33 | def receive_info(self): 34 | try: 35 | msg = self.client.recv(self.recv_size) 36 | except socket.error as e: 37 | print(e) 38 | 39 | if not msg: 40 | return None 41 | 42 | msg_decoded = msg.decode("utf8") 43 | 44 | left_bracket_index = msg_decoded.index("{") 45 | right_bracket_index = msg_decoded.index("}") + 1 46 | msg_decoded = msg_decoded[left_bracket_index:right_bracket_index] 47 | 48 | msg_json = json.loads(msg_decoded) 49 | 50 | return msg_json 51 | 52 | 53 | def send_player(self, player: Player): 54 | player_info = { 55 | "object": "player", 56 | "id": self.id, 57 | "position": (player.world_x, player.world_y, player.world_z), 58 | "rotation": player.rotation_y, 59 | "health": player.health, 60 | "joined": False, 61 | "left": False 62 | } 63 | player_info_encoded = json.dumps(player_info).encode("utf8") 64 | 65 | try: 66 | self.client.send(player_info_encoded) 67 | except socket.error as e: 68 | print(e) 69 | 70 | 71 | def send_bullet(self, bullet: Bullet): 72 | bullet_info = { 73 | "object": "bullet", 74 | "position": (bullet.world_x, bullet.world_y, bullet.world_z), 75 | "damage": bullet.damage, 76 | "direction": bullet.direction, 77 | "x_direction": bullet.x_direction 78 | } 79 | 80 | bullet_info_encoded = json.dumps(bullet_info).encode("utf8") 81 | 82 | try: 83 | self.client.send(bullet_info_encoded) 84 | except socket.error as e: 85 | print(e) 86 | 87 | 88 | def send_health(self, player: Enemy): 89 | health_info = { 90 | "object": "health_update", 91 | "id": player.id, 92 | "health": player.health 93 | } 94 | 95 | health_info_encoded = json.dumps(health_info).encode("utf8") 96 | 97 | try: 98 | self.client.send(health_info_encoded) 99 | except socket.error as e: 100 | print(e) 101 | 102 | def send_message(self, message: str): 103 | message_info = { 104 | "object": "chat_message", 105 | "message": message 106 | } 107 | 108 | message_info_encoded = json.dumps(message_info).encode("utf8") 109 | 110 | try: 111 | self.client.send(message_info_encoded) 112 | except socket.error as e: 113 | print(e) 114 | -------------------------------------------------------------------------------- /vitrix/lib/classes/settings.py: -------------------------------------------------------------------------------- 1 | import json, os.path 2 | 3 | 4 | if os.getcwd().split(os.path.sep)[-1] == 'vitrix': 5 | settings_file = open("user/settings.json", "r") 6 | else: 7 | settings_file = open("vitrix/user/settings.json", "r") 8 | 9 | settings = json.loads(settings_file.read()) # dict 10 | 11 | # read the json settings file 12 | def sread(a: str, b: str): # sread('gameplay_settings', 'fov') 13 | return settings[a][b] 14 | 15 | def swrite(a: str, b: str, c: str): # swrite('gameplay_settings', 'fov', 80) 16 | ############################################# 17 | #### Removed this because it doesn't work#### 18 | ############################################# 19 | 20 | # with open("user/settings.json", "r+") as wsettings: 21 | # ndsettings = json.load(wsettings) 22 | # temp = ndsettings['gameplay_settings'] 23 | # to_write = temp['fov'] = c 24 | # wsettings.seek(0) 25 | # json.dump(to_write, wsettings, indent=4) 26 | # wsettings.truncate() 27 | pass 28 | 29 | 30 | def set_fov(fov: int): 31 | swrite('gameplay_settings', 'fov', str(fov)) 32 | 33 | 34 | def get_fov(): 35 | return int(sread('gameplay_settings', 'fov')) 36 | -------------------------------------------------------------------------------- /vitrix/lib/entities/bullet.py: -------------------------------------------------------------------------------- 1 | from vitrix_engine import * 2 | import os 3 | 4 | from lib.entities.enemy import Enemy, Zombie 5 | from lib.paths import GamePaths 6 | 7 | 8 | class Bullet(Entity): 9 | 10 | def __init__(self, position: Vec3, direction: float, x_direction: float, network=False, damage: int = 15, slave=False): 11 | if not network: 12 | self.singleplayer = True 13 | else: 14 | self.singleplayer = False 15 | self.network = network 16 | 17 | speed = 50 18 | dir_rad = math.radians(direction) 19 | x_dir_rad = math.radians(x_direction) 20 | 21 | 22 | self.velocity = Vec3( 23 | math.sin(dir_rad) * math.cos(x_dir_rad), 24 | math.sin(x_dir_rad), 25 | math.cos(dir_rad) * math.cos(x_dir_rad) 26 | ) * speed 27 | 28 | #bullet_tags ={ 29 | # 1 : { 30 | # "model" :"sphere", 31 | # "texture" : "bullet1.png", 32 | # "collider" : "sphere", 33 | # "double_sided" : False, 34 | # "scale" : 0.2 35 | # }, 36 | # 37 | # 2 : { 38 | # "model" : os.path.join(Bullet.model_dir,"bullet2"), 39 | # "texture" : "bullet2.png", 40 | # "collider" : "sphere", 41 | # "double_sided" : False, 42 | # "scale" : 1.0 43 | # } 44 | #} 45 | 46 | super().__init__( 47 | position=position + self.velocity / speed, 48 | model="sphere", 49 | texture=os.path.join(GamePaths.textures_dir, "bullet.png"), 50 | collider="box", 51 | double_sided=True, 52 | scale=0.2 53 | ) 54 | 55 | 56 | self.damage = damage 57 | self.direction = direction 58 | self.x_direction = x_direction 59 | self.slave = slave 60 | 61 | 62 | 63 | def update(self): 64 | self.position += self.velocity * time.dt 65 | hit_info = self.intersects() 66 | 67 | if hit_info.hit: 68 | if not self.slave: 69 | for entity in hit_info.entities: 70 | if isinstance(entity, (Enemy, Zombie)): 71 | entity.health -= self.damage 72 | if not self.singleplayer: 73 | self.network.send_health(entity) 74 | 75 | destroy(self) 76 | -------------------------------------------------------------------------------- /vitrix/lib/entities/crate.py: -------------------------------------------------------------------------------- 1 | import os 2 | from vitrix_engine import * 3 | import random 4 | 5 | from lib.paths import GamePaths 6 | 7 | 8 | class Crate(Entity): 9 | 10 | def __init__(self, position): 11 | super().__init__( 12 | position=position, 13 | scale=1.5, 14 | origin_y=-.5, 15 | model=os.path.join(GamePaths.models_dir, "cube.obj"), 16 | texture=os.path.join(GamePaths.textures_dir, "crate.png"), 17 | ) 18 | 19 | items_list = ["gun", "bandages", "first_aid_kit", "bandages", "bandages"] 20 | 21 | self.contents = [] 22 | 23 | self.collider = BoxCollider(self, size=Vec3(1, 2, 1)) 24 | for i in range (1, random.randint(2, 4)): 25 | self.contents.append(random.choice(items_list)) 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /vitrix/lib/entities/enemy.py: -------------------------------------------------------------------------------- 1 | from vitrix_engine import * 2 | import random 3 | 4 | zombie_names=["Peter","Harry","Sayed","Usman","Gopal","Ryan","Gerald","James","Robert","Frank","Leon","Jordan","Russell","Johny","Ankur","Carl","Suresh"] 5 | 6 | class Enemy(Entity): 7 | def __init__(self, position: Vec3, identifier: str, username: str): 8 | super().__init__( 9 | position=position, 10 | model="cube", 11 | origin_y=-.5, 12 | collider="box", 13 | texture="white_cube", 14 | color=color.color(0, 0, 1), 15 | scale=Vec3(1, 2, 1), 16 | add_to_scene_entities=False 17 | ) 18 | self.gun = Entity( 19 | parent=self, 20 | position=Vec3(.55, .5, .6), 21 | scale=Vec3(.1, .2, .65), 22 | model="cube", 23 | texture="white_cube", 24 | color=color.color(0, 0, .4) 25 | ) 26 | 27 | self.name_tag = Text( 28 | parent=self, 29 | text=username, 30 | position=Vec3(0, 1.3, 0), 31 | scale=Vec2(5, 3), 32 | billboard=True, 33 | origin=Vec2(0, 0) 34 | ) 35 | 36 | self.is_enemy = True 37 | self.health = 150 38 | self.id = identifier 39 | self.username = username 40 | 41 | scene.entities.append(self) 42 | 43 | 44 | def update(self): 45 | if self.health <= 0: 46 | destroy(self) 47 | 48 | 49 | class Zombie(Entity): 50 | def __init__(self, position: Vec3, player): 51 | super().__init__( 52 | position=position, 53 | model="cube", 54 | origin_y=-.5, 55 | collider="box", 56 | texture="white_cube", 57 | color=color.color(0, 0, 1), 58 | scale=Vec3(1, 2, 1) 59 | ) 60 | 61 | self.growl = Audio("zombie_growl") 62 | self.growl.loop = True 63 | self.growl.volume = .5 64 | self.growl.play() 65 | 66 | self.name_tag = Text( 67 | parent=self, 68 | text=random.choice(zombie_names), #Random zombie names 69 | position=Vec3(0, 1.3, 0), 70 | scale=Vec2(5, 3), 71 | billboard=True, 72 | origin=Vec2(0, 0) 73 | ) 74 | 75 | self.is_enemy = True 76 | self.health = 45 77 | self.player = player 78 | 79 | 80 | 81 | def update(self): 82 | 83 | try: 84 | color_saturation = 1 - self.health / 30 85 | except AttributeError: 86 | self.health = 30 87 | color_saturation = 1 - self.health / 30 88 | 89 | self.color = color.color(0, color_saturation, 1) 90 | 91 | 92 | dist = distance_xz(self.player.position, self.position) 93 | if dist > 40: 94 | pass 95 | 96 | self.look_at_2d(self.player.position, 'y') 97 | hit_info = raycast(self.world_position + Vec3(0,1,0), self.forward, 30, ignore=(self,)) 98 | if hit_info.entity == self.player: 99 | if dist > 1.5: 100 | self.position += self.forward * time.dt * 2 101 | else: 102 | self.player.health -= 10 103 | self.player.healthbar.value = self.player.health 104 | Audio("hurt").play() 105 | self.position += self.forward * time.dt * -150 106 | 107 | 108 | if self.health <= 0: 109 | self.growl.stop() 110 | Audio("splat").play() 111 | destroy(self) 112 | 113 | 114 | -------------------------------------------------------------------------------- /vitrix/lib/entities/map.py: -------------------------------------------------------------------------------- 1 | import os 2 | from vitrix_engine import * 3 | 4 | from lib.paths import GamePaths 5 | from lib.entities.crate import Crate 6 | 7 | 8 | class FloorCube(Entity): 9 | def __init__(self, position): 10 | super().__init__( 11 | position=position, 12 | scale=2, 13 | model=os.path.join(GamePaths.models_dir, "cube.obj"), 14 | texture=os.path.join(GamePaths.textures_dir, "floor.png"), 15 | collider="box" 16 | ) 17 | 18 | 19 | class Map(Entity): 20 | def __init__(self): 21 | super().__init__( 22 | model=os.path.join(GamePaths.models_dir, "map1.obj"), 23 | scale=.3 24 | ) 25 | self.collider = MeshCollider(self) 26 | self.crate_one = Crate(position=Vec3(10, 1, -5)) 27 | 28 | # Floor 29 | dark1 = True 30 | for z in range(-28, 30, 2): 31 | dark2 = not dark1 32 | 33 | for x in range(-18, 28, 2): 34 | cube = FloorCube(Vec3(x, 0, z)) 35 | 36 | if dark2: 37 | cube.color = color.color(0, .2, .8) 38 | else: 39 | cube.color = color.color(0, .2, 1) 40 | 41 | dark2 = not dark2 42 | 43 | dark1 = not dark1 -------------------------------------------------------------------------------- /vitrix/lib/entities/player.py: -------------------------------------------------------------------------------- 1 | import os 2 | import time 3 | import threading 4 | from vitrix_engine import * 5 | from vitrix_engine.prefabs.first_person_controller import FirstPersonController 6 | 7 | from lib.entities.bullet import Bullet 8 | from lib.entities.crate import Crate 9 | from lib.entities.enemy import Zombie, Enemy 10 | from lib.UI.healthbar import HealthBar 11 | from lib.UI.crosshair import Crosshair 12 | from lib.weapons.hammer import Hammer 13 | from lib.weapons.pistol import Pistol 14 | from lib.weapons.sword import Sword 15 | from lib.weapons.battleaxe import BattleAxe 16 | from lib.items.aid_kit import AidKit 17 | from lib.items.ammo import Ammo 18 | # from lib.UI.inventory import inventory 19 | 20 | 21 | class Player(FirstPersonController): 22 | def __init__(self, position: Vec3, network = False): 23 | super().__init__( 24 | position=position, 25 | model="cube", 26 | jump_height=2.5, 27 | jump_duration=0.4, 28 | origin_y=-2, 29 | collider="box", 30 | speed=7 31 | ) 32 | self.hit_info = self.intersects() 33 | 34 | self.thirdperson = False 35 | 36 | if not network: 37 | self.singleplayer = True 38 | else: 39 | self.singleplayer = False 40 | self.network = network 41 | 42 | self.pew = Audio("pew", autoplay=False) 43 | self.pew.volume = 0.2 44 | 45 | self.gun = Pistol() 46 | self.hammer = Hammer() 47 | self.sword = Sword() 48 | self.axe = BattleAxe() 49 | 50 | self.hammer.disable() 51 | self.sword.disable() 52 | self.axe.disable() 53 | 54 | self.item_order = ["gun", "hammer", "sword", "axe"] 55 | self.holding = "gun" 56 | 57 | self.pause_text = Text( 58 | ignore_paused=True, 59 | text="Paused", 60 | enabled=False, 61 | position=Vec2(0, .3), 62 | scale=3) 63 | 64 | self.reload_warning_text = Text( 65 | text="Please reload!", 66 | enabled=False, 67 | scale=2) 68 | 69 | self.exit_button = Button( 70 | ignore_paused=True, 71 | text = "Quit Game", 72 | scale=0.15, 73 | on_click=Sequence(Wait(.01), Func(os._exit, 0)) 74 | ) 75 | 76 | self.rounds_counter = Text( 77 | text="Rounds Left: 5", 78 | position=Vec2(.5, .47), 79 | scale=2.5 80 | ) 81 | 82 | self.dead_text = Text( 83 | text="You are dead!", 84 | origin=Vec2(0, 0), 85 | position=Vec2(0, .2), 86 | scale=3 87 | ) 88 | 89 | self.respawn_button = Button( 90 | text = "Respawn", 91 | scale=0.15, 92 | on_click=Func(self.respawn) 93 | ) 94 | 95 | self.pause_text.disable() 96 | self.reload_warning_text.disable() 97 | self.exit_button.disable() 98 | self.dead_text.disable() 99 | self.respawn_button.disable() 100 | 101 | self.health = 150 102 | self.healthbar = HealthBar(self.health) 103 | self.crosshair = Crosshair() 104 | 105 | self.rounds_left = 5 106 | self.paused = False 107 | self.shots_left = 5 108 | self.reach = 6 109 | self.death_message_shown = False 110 | 111 | self.lock = False 112 | # self._inventory = None 113 | # self.inventory_opened = False 114 | 115 | def hide_reload_warning(self): 116 | time.sleep(1) 117 | self.reload_warning_text.disable() 118 | 119 | def reload(self): 120 | self.speed = 3 121 | if self.rounds_left <= 0: 122 | self.speed = 7 123 | self.rounds_counter.text = "Rounds Left: 0" 124 | return 125 | 126 | Audio("reload.wav") 127 | time.sleep(3) 128 | self.shots_left = 5 129 | self.speed = 7 130 | 131 | self.rounds_left -= 1 132 | self.rounds_counter.text = "Rounds Left: " + str(self.rounds_left) 133 | 134 | def input(self, key): 135 | if key == "space": 136 | self.jump() 137 | 138 | if key == "f1": # Third person 139 | if self.thirdperson: # Check if it's enabled 140 | self.thirdperson = False 141 | camera.z = -0 142 | else: 143 | self.thirdperson = True 144 | camera.z = -8 145 | 146 | if key == "f": # Switch item held 147 | if self.gun.enabled: 148 | self.gun.disable() 149 | self.hammer.enable() 150 | self.crosshair.set_melee() 151 | elif self.hammer.enabled: 152 | self.hammer.disable() 153 | self.sword.enable() 154 | self.crosshair.set_melee() 155 | elif self.sword.enabled: 156 | self.sword.disable() 157 | self.axe.enable() 158 | self.crosshair.set_melee() 159 | else: 160 | self.axe.disable() 161 | self.gun.enable() 162 | self.crosshair.set_ranged() 163 | 164 | if key == "r" and self.gun.enabled: 165 | threading.Thread(target=self.reload).start() 166 | 167 | # Inventory key access 168 | 169 | #if key == 'i': 170 | # if not self.inventory_opened: 171 | # _inventory = inventory() 172 | # inventory_opened = True 173 | # else: 174 | # _inventory = None 175 | # inventory_opened = False 176 | # 177 | # if self.lock == False: 178 | # self.lock = True 179 | # self.on_enable() 180 | # else: 181 | # self.lock = False 182 | # self.on_disable() 183 | 184 | if key == "left mouse down" and self.health > 0: 185 | if not self.gun.on_cooldown and self.gun.enabled: 186 | if self.shots_left <= 0 and self.speed == 7: 187 | self.reload_warning_text.enable() 188 | threading.Thread(target=self.hide_reload_warning).start() 189 | return 190 | self.gun.on_cooldown = True 191 | bullet_pos = self.position + Vec3(0, 2, 0) 192 | self.pew.play() 193 | if not self.singleplayer: 194 | bullet = Bullet(bullet_pos, self.world_rotation_y, 195 | -self.camera_pivot.world_rotation_x, self.network) 196 | self.network.send_bullet(bullet) 197 | else: 198 | bullet = Bullet(bullet_pos, self.world_rotation_y, 199 | -self.camera_pivot.world_rotation_x) 200 | self.shots_left -= 1 201 | destroy(bullet, delay=2) 202 | invoke(setattr, self.gun, 'on_cooldown', False, delay=.25) 203 | elif self.sword.enabled or self.axe.enabled: 204 | slash = Audio("swing") 205 | slash.play() 206 | hit_info = raycast(self.world_position + Vec3(0, 2, 0), 207 | self.camera_pivot.forward, self.reach, ignore=(self,)) 208 | try: 209 | if isinstance(hit_info.entity, (Zombie, Enemy)): 210 | if (hit_info.entity.health - 20) <= 0: 211 | slash.stop() 212 | hit_info.entity.health -= 20 213 | except: 214 | pass 215 | 216 | 217 | if key == "right mouse down": 218 | hit_info = raycast(self.world_position + Vec3(0, 2, 0), 219 | self.camera_pivot.forward, self.reach, ignore=(self,)) 220 | try: 221 | for entity in hit_info.entities: 222 | if isinstance(hit_info.entity, Crate) and self.hammer.enabled: 223 | print(hit_info.entity.contents) 224 | destroy(hit_info.entity) 225 | if isinstance(hit_info.entity, AidKit): 226 | print("Healing...") 227 | self.restore_health(hit_info.entity.health_restore) 228 | destroy(hit_info.entity) 229 | if isinstance(hit_info.entity, Ammo): 230 | self.restore_rounds(5) 231 | destroy(hit_info.entity) 232 | except: 233 | pass 234 | 235 | def death(self): 236 | self.death_message_shown = True 237 | 238 | self.on_disable() 239 | 240 | Audio("death").play() # Play death sound 241 | 242 | destroy(self.gun) 243 | destroy(self.healthbar.icon) 244 | destroy(self.healthbar) 245 | self.rotation = 0 246 | self.camera_pivot.world_rotation_x = -45 247 | self.world_position = Vec3(0, 7, -35) 248 | self.crosshair.disable() 249 | 250 | self.dead_text.enable() 251 | self.respawn_button.enable() 252 | 253 | self.exit_button.position = Vec2(0, -.2) 254 | self.exit_button.enable() 255 | 256 | def respawn(self): 257 | self.death_message_shown = False 258 | self.on_enable() 259 | self.gun = Pistol() 260 | self.rotation = Vec3(0, 0, 0) 261 | self.camera_pivot.world_rotation_x = 0 262 | self.world_position = Vec3(0, 3, 0) 263 | self.exit_button.position = Vec2(0, 0) 264 | self.crosshair.enable() 265 | self.health = 150 266 | self.rounds_left = 5 267 | self.healthbar = HealthBar(self.health) 268 | self.respawn_button.disable() 269 | self.dead_text.disable() 270 | self.exit_button.disable() 271 | 272 | def restore_health(self, amount: int): 273 | if self.health + amount > 150: 274 | self.health = 150 275 | else: 276 | self.health += amount 277 | 278 | self.healthbar.value = self.health 279 | 280 | def restore_rounds(self, amount: int): 281 | if self.rounds_left + amount > 15: 282 | self.rounds_left = 15 283 | else: 284 | self.rounds_left += amount 285 | 286 | self.rounds_counter.text = "Rounds Left: " + str(self.rounds_left) 287 | 288 | def update(self): 289 | if self.y < -10: 290 | self.position = Vec3(0, 2, 0) 291 | 292 | if self.health <= 0: # Check if player is dead 293 | if not self.death_message_shown: 294 | self.death() 295 | else: 296 | super().update() 297 | 298 | 299 | def land(self): 300 | i, x = 0, -1 301 | while i <= self.air_time: 302 | i += 0.18 303 | x += 1 304 | 305 | if x * 15 > 0: 306 | self.health -= x * 10 307 | self.healthbar.value = self.health 308 | 309 | self.air_time = 0 310 | self.grounded = True -------------------------------------------------------------------------------- /vitrix/lib/items/aid_kit.py: -------------------------------------------------------------------------------- 1 | from vitrix_engine import * 2 | from lib.paths import GamePaths 3 | import random 4 | 5 | class AidKit(Entity): 6 | def __init__(self, position: tuple): 7 | super().__init__( 8 | model=os.path.join(GamePaths.models_dir, "first_aid_kit.obj"), 9 | color=color.rgb(255, 0, 0), # red 10 | position=position, 11 | collider="sphere", 12 | scale=.4, 13 | ) 14 | 15 | self.collider = MeshCollider(self) 16 | self.health_restore = random.randint(50, 80) # amount of health to give to player 17 | -------------------------------------------------------------------------------- /vitrix/lib/items/ammo.py: -------------------------------------------------------------------------------- 1 | from vitrix_engine import * 2 | from lib.paths import GamePaths 3 | import random 4 | 5 | class Ammo(Entity): 6 | def __init__(self, position: tuple): 7 | super().__init__( 8 | model=os.path.join(GamePaths.models_dir, "ammo.obj"), 9 | texture=os.path.join(GamePaths.textures_dir, "ammo.png"), 10 | position=position, 11 | scale=.4, 12 | ) 13 | 14 | self.collider = MeshCollider(self) 15 | -------------------------------------------------------------------------------- /vitrix/lib/paths.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | class GamePaths(): 4 | models_dir = os.path.join("assets", "models") 5 | textures_dir = os.path.join("assets", "textures") 6 | sounds_dir = os.path.join("assets", "sounds") 7 | static_dir = os.path.join("assets", "static") 8 | -------------------------------------------------------------------------------- /vitrix/lib/weapons/battleaxe.py: -------------------------------------------------------------------------------- 1 | import os 2 | from vitrix_engine import * 3 | from lib.paths import GamePaths 4 | 5 | class BattleAxe(Entity): 6 | def __init__(self): 7 | super().__init__( 8 | parent=camera.ui, 9 | position = Vec2(.7, -.3), 10 | scale=.05, 11 | rotation=Vec3(-20, -20, -10), 12 | model=os.path.join(GamePaths.models_dir, "battleaxe.obj"), 13 | #texture=os.path.join(GamePaths.textures_dir, "axe.png"), 14 | color=color.color(0, 0, .4), 15 | on_cooldown=False 16 | ) -------------------------------------------------------------------------------- /vitrix/lib/weapons/glock.py: -------------------------------------------------------------------------------- 1 | import os 2 | from vitrix_engine import * 3 | from lib.paths import GamePaths 4 | 5 | class Pistol(Entity): 6 | def __init__(self): 7 | super().__init__( 8 | parent=camera.ui, 9 | position = Vec2(0.8, -.6), 10 | scale=0.07, 11 | rotation=Vec3(-10, 20, 5), 12 | model=os.path.join(GamePaths.models_dir, "glock.obj"), 13 | texture=os.path.join(GamePaths.textures_dir, "glock.png"), 14 | color=color.color(0, 0, .4), 15 | on_cooldown=False 16 | ) -------------------------------------------------------------------------------- /vitrix/lib/weapons/hammer.py: -------------------------------------------------------------------------------- 1 | import os 2 | from vitrix_engine import * 3 | from lib.paths import GamePaths 4 | 5 | class Hammer(Entity): 6 | def __init__(self): 7 | super().__init__( 8 | parent=camera.ui, 9 | position = Vec2(.19, -.39), 10 | scale=0.1, 11 | rotation=Vec3(-20, -20, -5), 12 | model=os.path.join(GamePaths.models_dir, "hammer.obj"), 13 | texture=os.path.join(GamePaths.textures_dir, "hammer.png"), 14 | color=color.color(0, 0, .4), 15 | on_cooldown=False 16 | ) -------------------------------------------------------------------------------- /vitrix/lib/weapons/k47.py: -------------------------------------------------------------------------------- 1 | import os 2 | from vitrix_engine import * 3 | from lib.paths import GamePaths 4 | 5 | class K47(Entity): 6 | def __init__(self): 7 | super().__init__( 8 | parent=camera.ui, 9 | position = Vec2(0.8, -.6), 10 | scale=0.07, 11 | rotation=Vec3(-10, 20, 5), 12 | model=os.path.join(GamePaths.models_dir, "k47.obj"), 13 | texture=os.path.join(GamePaths.textures_dir, "k47.png"), 14 | color=color.color(0, 0, .4), 15 | on_cooldown=False 16 | ) -------------------------------------------------------------------------------- /vitrix/lib/weapons/pistol.py: -------------------------------------------------------------------------------- 1 | import os 2 | from vitrix_engine import * 3 | from lib.paths import GamePaths 4 | 5 | class Pistol(Entity): 6 | def __init__(self): 7 | super().__init__( 8 | parent=camera.ui, 9 | position = Vec2(0.8, -.6), 10 | scale=0.07, 11 | rotation=Vec3(-10, 20, 5), 12 | model=os.path.join(GamePaths.models_dir, "pistol.obj"), 13 | texture=os.path.join(GamePaths.textures_dir, "pistol.png"), 14 | color=color.color(0, 0, .4), 15 | on_cooldown=False 16 | ) -------------------------------------------------------------------------------- /vitrix/lib/weapons/sword.py: -------------------------------------------------------------------------------- 1 | import os 2 | from vitrix_engine import * 3 | from lib.paths import GamePaths 4 | 5 | class Sword(Entity): 6 | def __init__(self): 7 | super().__init__( 8 | parent=camera.ui, 9 | position = Vec2(.6, -.39), 10 | scale=0.1, 11 | rotation=Vec3(120, 60, 50), 12 | model=os.path.join(GamePaths.models_dir, "sword.obj"), 13 | #texture=os.path.join(GamePaths.textures_dir, "sword.png"), 14 | color=color.color(0, 0, .4), 15 | on_cooldown=False 16 | ) -------------------------------------------------------------------------------- /vitrix/menu.py: -------------------------------------------------------------------------------- 1 | import os 2 | import platform 3 | import threading 4 | from vitrix_engine import * 5 | import lib.classes.settings as settings 6 | 7 | def buildexec(modulename,dir_path): 8 | try: 9 | if modulename == "mp": 10 | os.system("python " + dir_path + "/multiplayer.py") 11 | elif modulename =="sp": 12 | os.system("python " + dir_path + "/singleplayer.py") 13 | else: 14 | pass 15 | except: 16 | pass # throws error: something wrong with os.system or the path 17 | 18 | 19 | def start_multiplayer(): 20 | app.destroy() 21 | if built: 22 | if platform.system() == "Linux": 23 | os.system("sh multiplayer.sh") 24 | if platform.system() == "Windows": 25 | os.system("multiplayer.bat") 26 | else: 27 | buildexec("mp", dir_path) 28 | os._exit(0) 29 | 30 | def start_singleplayer(): 31 | app.destroy() 32 | if built: 33 | if platform.system() == "Linux": 34 | os.system("sh singleplayer.sh") 35 | if platform.system() == "Windows": 36 | os.system("singleplayer.bat") 37 | else: 38 | buildexec("sp", dir_path) 39 | os._exit(0) 40 | 41 | 42 | def playBackgroundMusic(): 43 | global bgmusic 44 | bgmusic = Audio("background-music") 45 | bgmusic.loop = True 46 | bgmusic.play() 47 | 48 | 49 | class LoadingWheel(Entity): 50 | def __init__(self, **kwargs): 51 | super().__init__() 52 | self.parent = camera.ui 53 | self.point = Entity(parent=self, model=Circle(24, mode='point', thickness=.03), 54 | color=color.light_gray, y=.75, scale=2, texture='circle') 55 | self.point2 = Entity(parent=self, model=Circle(12, mode='point', thickness=.03), 56 | color=color.light_gray, y=.75, scale=1, texture='circle') 57 | 58 | self.scale = .025 59 | self.text_entity = Text(world_parent=self, text='Loading...', origin=(0,1.5), 60 | color=color.light_gray) 61 | self.y = -.25 62 | 63 | self.bg = Entity(parent=self, model='quad', scale_x=camera.aspect_ratio, 64 | color=color.black, z=1) 65 | self.bg.scale *= 400 66 | 67 | for key, value in kwargs.items(): 68 | setattr(self, key ,value) 69 | 70 | 71 | def update(self): 72 | self.point.rotation_y += 5 73 | self.point2.rotation_y += 3 74 | 75 | 76 | class MenuButton(Button): 77 | def __init__(self, text='', **kwargs): 78 | super().__init__(text, scale=(.25, .075), highlight_color=color.gray, **kwargs) 79 | 80 | for key, value in kwargs.items(): 81 | setattr(self, key ,value) 82 | 83 | 84 | def load_menu(): 85 | button_spacing = .075 * 1.25 86 | menu_parent = Entity(parent=camera.ui, y=.15) 87 | main_menu = Entity(parent=menu_parent) 88 | load_menu = Entity(parent=menu_parent) 89 | options_menu = Entity(parent=menu_parent) 90 | 91 | 92 | state_handler = Animator({ 93 | 'main_menu' : main_menu, 94 | 'load_menu' : load_menu, 95 | 'options_menu' : options_menu, 96 | } 97 | ) 98 | 99 | 100 | main_menu.buttons = [ 101 | MenuButton('Start', on_click=Func(setattr, state_handler, 'state', 'load_menu')), 102 | MenuButton('Options', on_click=Func(setattr, state_handler, 'state', 'options_menu')), 103 | MenuButton('Quit', on_click=Sequence(Wait(.01), Func(sys.exit))), 104 | ] 105 | for i, e in enumerate(main_menu.buttons): 106 | e.parent = main_menu 107 | e.y = (-i-2) * button_spacing 108 | e.enabled = False 109 | 110 | singleplayer_btn = MenuButton(parent=load_menu, text="Singleplayer", 111 | on_click=Func(start_singleplayer), y=(i*button_spacing)) 112 | 113 | multiplayer_btn = MenuButton(parent=load_menu, text="Multiplayer", 114 | on_click=Func(start_multiplayer), y=((i-1)*button_spacing)) 115 | 116 | load_menu.back_button = MenuButton(parent=load_menu, text='back', 117 | y=((-i-2)*button_spacing), 118 | on_click=Func(setattr, state_handler, 119 | 'state', 'main_menu')) 120 | 121 | 122 | preview_text = Text(parent=options_menu, x=.275, y=.25, text='Preview text', 123 | origin=(-.5,0)) 124 | for t in [e for e in scene.entities if isinstance(e, Text)]: 125 | t.original_scale = t.scale 126 | 127 | fov_slider = Slider(20, 130, default=settings.get_fov(), step=1 , dynamic=True, 128 | text='FOV:', parent=options_menu) 129 | 130 | def set_fov(): 131 | settings.set_fov(fov_slider.value) 132 | 133 | fov_slider.on_value_changed = set_fov 134 | 135 | 136 | options_back = MenuButton(parent=options_menu, text='Back', x=-.25, origin_x=-.5, 137 | on_click=Func(setattr, state_handler, 'state', 'main_menu')) 138 | 139 | for i, e in enumerate((fov_slider, options_back)): 140 | e.y = -i * button_spacing 141 | 142 | 143 | for menu in (main_menu, load_menu, options_menu): 144 | def animate_in_menu(menu=menu): 145 | for i, e in enumerate(menu.children): 146 | e.original_x = e.x 147 | e.x += .1 148 | e.animate_x(e.original_x, delay=i*.05, duration=.1, 149 | curve=curve.out_quad) # type: ignore 150 | 151 | e.alpha = 0 152 | e.animate('alpha', .7, delay=i*.05, duration=.1, 153 | curve=curve.out_quad) # type: ignore 154 | 155 | if hasattr(e, 'text_entity'): 156 | e.text_entity.alpha = 0 157 | e.text_entity.animate('alpha', 1, delay=i*.05, duration=.1) 158 | 159 | menu.on_enable = animate_in_menu 160 | 161 | 162 | background = Entity(model="cube", texture='background', parent=camera.ui, 163 | scale=(camera.aspect_ratio), color=color.white, z=1) 164 | 165 | 166 | playBackgroundMusic() 167 | print('Loaded Menu') 168 | loading_screen.enabled = False 169 | for i, e in enumerate(main_menu.buttons): 170 | e.enabled = True 171 | 172 | 173 | app = Ursina() 174 | loading_screen = LoadingWheel(enabled=False) 175 | window.exit_button.visible = False 176 | window.title = "Vitrix Menu" 177 | window.borderless = False 178 | default_width = 600 # would be migrated to settings.json 179 | default_height = 600 180 | window.size = (default_width, default_height) 181 | window.fullscreen = False 182 | 183 | loading_screen.enabled = True 184 | threading.Thread(target=load_menu).start() 185 | 186 | 187 | dir_path = os.path.dirname(os.path.realpath(__file__)) 188 | if os.path.exists(dir_path + "/.unbuilt"): 189 | built = False 190 | else: 191 | built = True 192 | 193 | 194 | if __name__ == "__main__": 195 | app.run(info=False) -------------------------------------------------------------------------------- /vitrix/multiplayer.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import socket 4 | from lib.UI.notification import notify 5 | from lib.paths import GamePaths 6 | 7 | try: # Check the internet connection before starting. 8 | socket.socket(socket.AF_INET, socket.SOCK_STREAM).connect(("8.8.8.8", 53)) 9 | 10 | print("Internet connection detected!") 11 | except: 12 | notify("Vitrix - Internet connection error", """Sorry, Vitrix couldn't connect 13 | to the internet. Check your 14 | internet connection and try 15 | again later.""") 16 | 17 | os._exit(1) 18 | 19 | import threading 20 | from vitrix_engine import * 21 | from vitrix_engine.shaders.basic_lighting_shader import basic_lighting_shader 22 | 23 | from lib.classes.settings import get_fov 24 | 25 | from lib.UI.chat import Chat 26 | from lib.classes.network import Network 27 | from lib.entities.map import Map 28 | from lib.entities.player import Player 29 | from lib.entities.enemy import Enemy 30 | from lib.entities.bullet import Bullet 31 | 32 | if os.path.isfile("ib.cfg"): 33 | if open("ib.cfg", "r").read() == "1": 34 | print("You can't play multiplayer.") 35 | print("Reason: Cheats") 36 | notify("You can't play multiplayer.", "You have been banned\nReason: Cheats") 37 | sys.exit(1) 38 | else: 39 | pass 40 | 41 | import lib.UI.server_chooser 42 | from lib.classes.anticheat import * 43 | 44 | try: 45 | with open("data.txt", "r") as file: 46 | lines = file.readlines() 47 | username = lines[0].strip() 48 | server_addr = lines[1].strip() 49 | server_port = lines[2].strip() 50 | except FileNotFoundError: 51 | sys.exit(1) 52 | 53 | 54 | while True: 55 | print(username, " ", server_addr, " ", server_port) 56 | try: 57 | server_port = int(server_port) 58 | except ValueError: 59 | print("\nThe port you entered was not a number, try again with a valid port...") 60 | continue 61 | 62 | n = Network(server_addr, server_port, username) 63 | n.settimeout(5) 64 | 65 | error_occurred = False 66 | 67 | try: 68 | n.connect() 69 | except ConnectionRefusedError: 70 | notify("Vitrix Error", 71 | "Connection refused! This can be because server hasn't started or has reached it's player limit.") 72 | error_occurred = True 73 | except socket.timeout: 74 | notify("Vitrix Error", 75 | "Server took too long to respond, please try again later...") 76 | error_occurred = True 77 | except socket.gaierror: 78 | notify("Vitrix Error", 79 | "The IP address you entered is invalid, please try again with a valid address...") 80 | error_occurred = True 81 | finally: 82 | n.settimeout(None) 83 | 84 | if error_occurred: 85 | sys.exit(1) 86 | 87 | if not error_occurred: 88 | break 89 | 90 | 91 | window.title = "Vitrix - Multiplayer" 92 | window.icon = os.path.join(GamePaths.static_dir, "logo.ico") 93 | 94 | app = Ursina() 95 | window.borderless = False 96 | window.exit_button.visible = False 97 | window.fullscreen = True 98 | camera.fov = get_fov() 99 | 100 | map = Map() 101 | sky = Entity( 102 | model=os.path.join(GamePaths.models_dir, "sphere.obj"), 103 | texture=os.path.join(GamePaths.textures_dir, "sky.png"), 104 | scale=9999, 105 | double_sided=True 106 | ) 107 | Entity.default_shader = basic_lighting_shader 108 | 109 | player = Player(Vec3(0, 1, 0), n) 110 | chat = Chat(n, username) 111 | 112 | def toggle_fullscreen(): 113 | if window.fullscreen: 114 | window.fullscreen = False 115 | else: 116 | window.fullscreen = True 117 | 118 | fullscreen_button = Button( 119 | text="Toggle Fullscreen", 120 | position=Vec2(.2, 0), 121 | scale=0.15, 122 | enabled=False, 123 | on_click=Func(toggle_fullscreen) 124 | ) 125 | fullscreen_button.fit_to_text() 126 | 127 | prev_pos = player.world_position 128 | prev_dir = player.world_rotation_y 129 | enemies = [] 130 | 131 | 132 | def receive(): 133 | while True: 134 | try: 135 | info = n.receive_info() 136 | except Exception as e: 137 | print(e) 138 | continue 139 | 140 | if not info: 141 | print("Server has stopped! Exiting...") 142 | sys.exit() 143 | 144 | if info["object"] == "player": 145 | enemy_id = info["id"] 146 | 147 | if info["joined"]: 148 | new_enemy = Enemy(Vec3(*info["position"]), enemy_id, info["username"]) 149 | new_enemy.health = info["health"] 150 | chat.list.append(f"{info['username']} joined the game") 151 | enemies.append(new_enemy) 152 | continue 153 | 154 | enemy = None 155 | 156 | for e in enemies: 157 | if e.id == enemy_id: 158 | enemy = e 159 | break 160 | 161 | if not enemy: 162 | continue 163 | 164 | if info["left"]: 165 | enemies.remove(enemy) 166 | destroy(enemy) 167 | chat.list.append(f"{enemy.username} left the game") 168 | continue 169 | 170 | enemy.world_position = Vec3(*info["position"]) 171 | enemy.rotation_y = info["rotation"] 172 | 173 | elif info["object"] == "bullet": 174 | b_pos = Vec3(*info["position"]) 175 | b_dir = info["direction"] 176 | b_x_dir = info["x_direction"] 177 | b_damage = info["damage"] 178 | new_bullet = Bullet(b_pos, b_dir, b_x_dir, n, b_damage, slave=True) 179 | destroy(new_bullet, delay=2) 180 | 181 | elif info["object"] == "health_update": 182 | enemy_id = info["id"] 183 | 184 | enemy = None 185 | 186 | if enemy_id == n.id: 187 | enemy = player 188 | else: 189 | for e in enemies: 190 | if e.id == enemy_id: 191 | enemy = e 192 | break 193 | 194 | if not enemy: 195 | continue 196 | 197 | enemy.health = info["health"] 198 | if isinstance(enemy, Player): 199 | enemy.healthbar.value = enemy.health 200 | elif info["object"] == "chat_message": 201 | chat.list.append(info["message"]) 202 | 203 | 204 | def update(): 205 | if player.health > 0: 206 | global prev_pos, prev_dir 207 | 208 | if prev_pos != player.world_position or prev_dir != player.world_rotation_y: 209 | n.send_player(player) 210 | 211 | prev_pos = player.world_position 212 | prev_dir = player.world_rotation_y 213 | 214 | check_speed(player.speed) 215 | check_jump_height(player.jump_height, 2.5) 216 | check_health(player.health) 217 | 218 | 219 | def input(key): 220 | if key == "t" and not fullscreen_button.enabled: 221 | if chat.enabled: 222 | player.on_enable() 223 | chat.disable() 224 | else: 225 | chat.enable() 226 | player.on_disable() 227 | 228 | if key == ("tab" or "escape") and not chat.enabled: 229 | if not player.paused: 230 | player.pause_text.disable() 231 | player.exit_button.disable() 232 | fullscreen_button.disable() 233 | player.crosshair.enable() 234 | player.paused = True 235 | player.on_enable() 236 | else: 237 | player.pause_text.enable() 238 | player.exit_button.enable() 239 | fullscreen_button.enable() 240 | player.crosshair.disable() 241 | player.paused = False 242 | player.on_disable() 243 | 244 | 245 | def main(): 246 | msg_thread = threading.Thread(target=receive, daemon=True) 247 | msg_thread.start() 248 | app.run(info=False) 249 | 250 | 251 | 252 | if __name__ == "__main__": 253 | main() 254 | -------------------------------------------------------------------------------- /vitrix/singleplayer.py: -------------------------------------------------------------------------------- 1 | import os 2 | from vitrix_engine import * 3 | 4 | from lib.entities.map import Map 5 | from lib.entities.player import Player 6 | from lib.entities.enemy import Zombie 7 | 8 | from lib.items.aid_kit import AidKit 9 | from lib.items.ammo import Ammo 10 | 11 | from lib.paths import GamePaths 12 | from vitrix_engine.shaders.basic_lighting_shader import basic_lighting_shader 13 | from lib.classes.settings import get_fov 14 | 15 | window.title = "Vitrix - Singleplayer" 16 | window.icon = os.path.join(GamePaths.static_dir, "logo.ico") 17 | 18 | app = Ursina() 19 | # The inventory needs to load after ursina app() 20 | #from lib.UI.inventory import * 21 | 22 | window.borderless = False 23 | window.exit_button.visible = False 24 | window.fullscreen = True 25 | camera.fov = get_fov() 26 | 27 | Text.default_font = os.path.join(GamePaths.static_dir, "font.ttf") 28 | Entity.default_shader = basic_lighting_shader 29 | 30 | map = Map() 31 | sky = Entity( 32 | model=os.path.join("assets", "models", "sphere.obj"), 33 | texture=os.path.join("assets", "textures", "sky.png"), 34 | scale=9999, 35 | double_sided=True 36 | ) 37 | 38 | def toggle_fullscreen(): 39 | if window.fullscreen: 40 | window.fullscreen = False 41 | else: 42 | window.fullscreen = True 43 | 44 | fullscreen_button = Button( 45 | text="Toggle Fullscreen", 46 | position=Vec2(.2, 0), 47 | scale=0.15, 48 | enabled=False, 49 | on_click=Func(toggle_fullscreen) 50 | ) 51 | fullscreen_button.fit_to_text() 52 | 53 | 54 | player = Player(Vec3(0, 1, 0)) 55 | aid_kit = AidKit(Vec3(10, 1.4, 3)) 56 | ammo = Ammo(Vec3(15, 1, 3)) 57 | 58 | enemies = [] 59 | 60 | 61 | #controls_dict={ 62 | # "tab":"Pause the Game", 63 | # "L":"Release a zombie", 64 | # "left-click":"Fire", 65 | # "space": "Jump", 66 | # "alt-f4":"Exit game", 67 | # "1":"Switch ammo" 68 | #} 69 | #controls_text = Text( 70 | # text= "".join(f"{key} = {value}\n" for key,value in controls_dict.items() ), 71 | # origin=Vec2(2.8, -3), 72 | # scale=1 73 | # ) 74 | #def cycleAmmo(bullet_tag): # default bullet tag is int 1 75 | # if bullet_tag == 1: 76 | # return 2 77 | # else: 78 | # return 1 79 | 80 | 81 | def input(key): 82 | if key == ("tab" or "escape"): 83 | if not player.paused: 84 | player.pause_text.disable() 85 | player.exit_button.disable() 86 | fullscreen_button.disable() 87 | player.crosshair.enable() 88 | player.paused = True 89 | player.on_enable() 90 | else: 91 | player.pause_text.enable() 92 | player.exit_button.enable() 93 | fullscreen_button.enable() 94 | player.crosshair.disable() 95 | player.paused = False 96 | player.on_disable() 97 | 98 | if key == "l": 99 | enemies.append(Zombie(Vec3(0, 1.5, 0), player)) 100 | 101 | 102 | sun = DirectionalLight() 103 | sun.look_at(Vec3(1,-1,-1)) 104 | 105 | 106 | if __name__ == "__main__": 107 | app.run(info=False) 108 | -------------------------------------------------------------------------------- /vitrix/user/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "game_settings": { 3 | "language": "en", 4 | "text_size": "1", 5 | "window_width": "600", 6 | "window_height": "600", 7 | "shadows": "True" 8 | }, 9 | "multiplayer": { 10 | "username": "Player", 11 | "icon": "icon.png" 12 | }, 13 | "gameplay_settings": { 14 | "fov": "85" 15 | } 16 | } --------------------------------------------------------------------------------