This commit is contained in:
Victorious Children Studios 2024-07-13 16:15:50 +03:00
parent 6765c8240e
commit 594e088a83
286 changed files with 17523 additions and 232 deletions

13
DanisRace Debug.txt Normal file
View file

@ -0,0 +1,13 @@
[] Animation Staires
[] Animation Jump
[] Walk Speed
[] Auto Animation Swimming
[] Auto Control Swimming on Water
[] Jump Bugged
[] Slower Walk Animation

235
LICENSE
View file

@ -1,232 +1,7 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Software: GNU General Public License Version 3 or any later version
Game Art: Creative Commons Attribution-ShareAlike
Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
Some art was taken from other projects that have other ( compatible ) licenses. Most of them are taken from Moria's Race movie sources. Like for example the sound files. Most of those are either CC0 or in some cases CC-BY or CC-BY-SA.
Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for software and other kinds of works.
The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and modification follow.
TERMS AND CONDITIONS
0. Definitions.
“This License” refers to version 3 of the GNU General Public License.
“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
A “covered work” means either the unmodified Program or a work based on the Program.
To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
1. Source Code.
The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
The Corresponding Source for a work in source code form is that same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
7. Additional Terms.
“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
11. Patents.
A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
DanisRace
Copyright (C) 2024 BlenderDumbass
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
DanisRace Copyright (C) 2024 BlenderDumbass
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
For full list of sound files used in this project please refer to SOUNDLICENSES file.
For Font Licenses please look into the fonts folder.

View file

@ -1,3 +1,5 @@
# DanisRace
# Dani's Race
The Libre Game Dani's Race.
A Free / Libre Open World Game.
[Dani's Race Website](https://blenderdumbass.codeberg.page/DanisRace/)

49
SOUNDLICENSES Normal file
View file

@ -0,0 +1,49 @@
The files are renamed and or changed in some way for the game. Not the entire list of those sounds might be present in the game. ( Those are sounds used in Moria's Race movie and are being reused for the game ).
____________________________________________________________________________________________
Ambience, Night Wildlife, A.wav - CC-BY by InspectorJ (www.jshaw.co.uk) of Freesound.org https://freesound.org/people/InspectorJ/sounds/352514/
Leather Bow Stretch - CC-BY by EminYILDIRIM from Freesound .org https://freesound.org/people/EminYILDIRIM/sounds/536085/
Eurofighter Typhoon Flyby 004 Close Proximity - CC-BY by TimoSchmied https://freesound.org/people/TimoSchmied/sounds/640498/
jet engine start, CRJ 900 - CC-BY by alex36917 https://freesound.org/people/alex36917/sounds/582249/
Jet Engine 1 - CC-BY by InSintesi https://freesound.org/people/InSintesi/sounds/346034/
motor_drill01 - CC-BY by Taira Komori https://freesound.org/people/Taira%20Komori/sounds/212397/
ELECTRIC_MOTOR - CC-BY by jacobsteel https://freesound.org/people/jacobsteel/sounds/336665/
Dental_chair_servo_switch - CC-BY by beerbelly38 https://freesound.org/people/beerbelly38/sounds/160432/
steps_sneakers - CC-BY by neohylanmay https://freesound.org/people/neohylanmay/sounds/333201/
Pipe_Drag_01 - CC-BY by dheming https://freesound.org/people/dheming/sounds/177782/
robot step short medium-heavy - CC-BY by keemocore https://freesound.org/people/keemocore/sounds/148309/
Swoosh_EminYILDIRIM CC-BY by EminYILDIRIM https://freesound.org/people/EminYILDIRIM/sounds/555057/
bunch_of_swooshes CC-BY by berglindsi https://freesound.org/people/berglindsi/sounds/402977/
Horn Honk CC-BY by mkoenig https://freesound.org/people/mkoenig/sounds/81173/
underwater_ambience CC-BY by akemov https://freesound.org/people/akemov/sounds/255597/
Water_Swirl_Small_3 CC-BY by InspectorJ https://freesound.org/people/InspectorJ/sounds/398723/
aprox-5000 CC-BY by lonemonk https://freesound.org/people/lonemonk/sounds/100840/
unfa's-swoosh CC-0 by unfa https://freesound.org/people/unfa/sounds/584188/
tire_puncture CC-BY by WaveAdventurer
https://freesound.org/people/WaveAdventurer/sounds/702718/
Big Explosion CC-BY by Lamoot
https://opengameart.org/content/big-explosion
spray painting CC-BY by Jay_You
https://freesound.org/people/Jay_You/sounds/460408/

106
ScriptSnippits.txt Normal file
View file

@ -0,0 +1,106 @@
[01_Bring_Neonspeedster_To_Racetrack]
Dani wakes up in the room. Nobody is home. Telephone rings after 10 seconds.
Dani: Yes?
Paps Voice: Dani, I can't believe that I'm telling this. Jack just brought
the truck over without the car. Moria has to start practicing. And there is no
car. Dani. Bring here the Neonspeedster. It should be in the garage. You have
3 minutes. Not a single scratch. You hear me! Not a single scratch.
Message: Bring Neonspeedster to Paps onto the Racetrack.
A directional arrow appears and it points to Neonspeedster in the garage. As
soon as the player takes the car. The arrow will point at the racetrack. There
by the entrance, stands a Blue Truck. Paps, Jack and Moria are next to it.
If the car has less then 100% health:
Paps: I told you not a single scratch, Dani. What do you think should we
do with a broken car?
Message: Assignment Failed.
If the car is fully healthy:
Paps: Excellent! One, day, if you prove yourself, I'll let you drive on the
racetrack, Dani. Now get out.
If Dani gets out:
Message: Assignment Passed.
Moria takes the car and goes onto the racetrack on it.
Game goes to next assignment.
______________________________________________________________________
Dani delivered the car to the racetrack and got out of the car. Moria took the car without talking much and drove it to the racetrack. Paps was left with Dani and Jack alone.
Paps: Jack.
Jack: Yes.
Paps: Go wait in the truck!
Jack goes into the truck. Sitting on the passenger's seat.
Paps: Dani. This is unbelievable. Well, okay... Jack didn't break the truck. But the fact that he came here without Neonspeedster is frankly insane to say the least. I know what we can do.
Dani: Yes?
Paps: You will drive the truck home with him as a passenger. He is supposed to be a professional race driver, but your 11 yr old sister already drives better than him! And now you, will drive him instead of him driving you. Well this is something. That will teach him a lesson.
Dani laughs a bit.
Paps: Dani. Go get the truck back home. Keep Jack inside.
Dani: Okay.
Message: Bring the truck back home.
As soon as you sit into the truck and start going.
Jack: Let me guess... He is trying to punish me by making you drive the truck? Hm... He doesn't know me. It's not punishing. It's amazing! Also he probably told you that I didn't bring a car here. Well he is lying. I brought a car. It's in the truck right now. It's just not a Neonspeedster. And Moria apparently only likes Neonspeedsters. He is not punishing me for that, you know. He is punishing me for crashing on a tower spin. On a tower spin of all places! Who will not crash there? Even Moria barely made it through. Hell Tali Shtern crashed that day on the Tower Spin. And he is still punishing me for this.
As the truck is getting close to the house.
Jack: Wait, wait. Let's not go home. Wanna race?
Dani: Yes.
Jack: Let's go this way. There is a race coming up and we have a spare race car with us. Hell I'll let you race.
Dani: Okay!
Message: Drive the truck to the race.
The previous assignment is aborted and now they are driving to a race beside a huge building. There are a few cars already waiting and ready to race.
As soon as you get there:
Jack: Press here to unload the car.
Message: Press D to unload the car.
This is needed for later, when people could change their keybindings.
As soon as Dani is in the car, a circle appears into which you can drive.
Message: Press R to start the race.
The race starts. The race is very messy and with a lot of off-road-ing and breaking through stuff. A part of it goes through the place where Dani lives.
_____________________________________
Jack's Reactions to Dani's Driving.
Hitting cars:
Dani, your will break the car!
Dani, the car will break, dani!
We are, wrecking the car!
Paps will be pissed!
Dani, what are you doing man!
"Oh God!":
Dani, can you please concentrate, please!
You almost killed us, dani!
Ooooaaahhh!
Speeding up on a race:
Triple caution!!!
Dani! Double caution!!! Triple caution!!!
Concentrate, Dani, Please!
Concentrate!
You are going too fast!
We will miss the turn!
Slow down! Listen to me! Dani!

File diff suppressed because it is too large Load diff

185
Scripts/Cinema.py Normal file
View file

@ -0,0 +1,185 @@
# This script will make the cinema work.
import bge
import aud
def Main(w):
scene = bge.logic.getCurrentScene()
cont = bge.logic.getCurrentController()
obj = cont.owner
inCinema = scene.objects["CinemaColider"]["InCinema"]
def cTprint(t):
cText = scene.objects["CinemaText"]
if cText["Text"] != t:
cText["Text"] = t
print(t)
black = scene.objects["CinemaScreen.Black"]
# Play the movie
if obj.get("Movie"):
cTprint("")
if not obj.get("Video"):
movieTexture = bge.texture.VideoFFmpeg(obj.get("Movie"))
print(dir(movieTexture))
texture = bge.texture.Texture(obj, 0, 0)
texture.source = movieTexture
texture.source.play()
texture.refresh(False)
width, height = movieTexture.size
obj.scaling[1] = obj.scaling[1] / height * 1080
device = aud.Device()
sound = aud.Sound(obj.get("Movie"))
obj["Sound"] = device.play(sound)
obj["Video"] = texture
obj["Time"] = bge.logic.getRealTime()
obj["StartTime"] = bge.logic.getRealTime()
obj["soundref"] = 100
black.visible = False
elif inCinema:
if obj.get("iTimer", 0):
obj["iTimer"] = obj.get("iTimer", 1) -1
# Move the audio forward
if 87 in bge.logic.globalDict["keys"] and not obj.get("iTimer", 0):
obj["AudOffset"] = obj.get("AudOffset", 0) + 0.25
obj["iTimer"] = 10
elif 85 in bge.logic.globalDict["keys"] and not obj.get("iTimer", 0):
obj["AudOffset"] = obj.get("AudOffset", 0) - 0.25
obj["iTimer"] = 10
if bge.logic.getRealTime() - obj["Time"] > (1/30):
obj["Video"].source.refresh()#obj["Sound"].position)
obj["Video"].refresh(False)
obj["Time"] = bge.logic.getRealTime()
#print(obj["Video"].source.framerate)
#print("Video Refreshed at:", obj["Time"], obj["Sound"].position)
if not obj["soundref"]:
try:
obj["Sound"].position = bge.logic.getRealTime()-obj["StartTime"]+obj.get("AudOffset", 0)
except:
obj["Movie"] = None
obj["Video"] = None
black.visible = True
obj.scaling[1] = 1
obj["cTfolder"] = obj["cTfolder"][:obj["cTfolder"].rfind("/")]
obj["cTfolder"] = obj["cTfolder"][:obj["cTfolder"].rfind("/")] + "/"
obj["soundref"] = 100
else:
obj["soundref"] -= 1
else:
obj["Sound"].stop()
obj["Video"].source.stop()
obj["Movie"] = None
obj["Video"] = None
obj.scaling[1] = 1
black.visible = True
obj["cTfolder"] = obj["cTfolder"][:obj["cTfolder"].rfind("/")]
obj["cTfolder"] = obj["cTfolder"][:obj["cTfolder"].rfind("/")] + "/"
# FILE MANAGER ( I know I'm crazy )
elif inCinema:
import os
obj["cTfolder"] = obj.get("cTfolder", "/")
obj["cTselect"] = obj.get("cTselect", 0)
# Files and folders
formats = [".mp4", ".ogg", ".ogv", ".avi"]
try:
listdir = []
for i in os.listdir(obj["cTfolder"]):
for format in formats:
if not os.path.isfile(obj["cTfolder"]+i) or i.endswith(format):
listdir.append(i)
break
listdir = list(sorted(listdir))
except:
listdir = []
obj["Movie"] = obj["cTfolder"][:-1]
if not listdir:
obj["cTfolder"] = obj["cTfolder"][:obj["cTfolder"].rfind("/")]
obj["cTfolder"] = obj["cTfolder"][:obj["cTfolder"].rfind("/")] + "/"
if obj.get("iTimer", 0):
obj["iTimer"] = obj.get("iTimer", 1) -1
# Up and down
if 72 in bge.logic.globalDict["keys"] and not obj.get("iTimer", 0):
obj["cTselect"] = ( obj["cTselect"] -1 ) % len(listdir)
obj["iTimer"] = 10
bge.logic.globalDict["SoundDevice"].play(bge.logic.globalDict["sounds"]["checkpoint"]["sound"]) # Play a Ding
elif 70 in bge.logic.globalDict["keys"] and not obj.get("iTimer", 0):
obj["cTselect"] = ( obj["cTselect"] +1 ) % len(listdir)
obj["iTimer"] = 10
bge.logic.globalDict["SoundDevice"].play(bge.logic.globalDict["sounds"]["checkpoint"]["sound"]) # Play a Ding
elif 7 in bge.logic.globalDict["keys"] and not obj.get("iTimer", 0):
obj["cTfolder"] = obj["cTfolder"] + listdir[obj["cTselect"]] + "/"
obj["cTselect"] = 0
obj["iTimer"] = 10
bge.logic.globalDict["SoundDevice"].play(bge.logic.globalDict["sounds"]["checkpoint"]["sound"]) # Play a Ding
elif 59 in bge.logic.globalDict["keys"] and not obj.get("iTimer", 0):
obj["cTfolder"] = obj["cTfolder"][:obj["cTfolder"].rfind("/")]
obj["cTfolder"] = obj["cTfolder"][:obj["cTfolder"].rfind("/")] + "/"
obj["cTselect"] = 0
obj["iTimer"] = 10
bge.logic.globalDict["SoundDevice"].play(bge.logic.globalDict["sounds"]["checkpoint"]["sound"]) # Play a Ding
# Drawing
t = "[ "+obj["cTfolder"]+" ]\n\n"
for n, f in enumerate(listdir[max(0,obj["cTselect"]-5):max(0,obj["cTselect"]-5)+10]):
if listdir[obj["cTselect"]] == f:
t = t + " [ "
else:
t = t + " "
t = t+f
if listdir[obj["cTselect"]] == f:
t = t + " ] "
else:
t = t + " "
t = t + "\n"
cTprint(t)

161
Scripts/Common.py Normal file
View file

@ -0,0 +1,161 @@
import random
# Common things needed for various things
# Colors are used to make the
clr = {
"norm":"\033[00m", # Reset to normal
"bold":"\033[01m", # Bold Text
"ital":"\033[03m", # Italic Text
"undr":"\033[04m", # Underlined
"blnk":"\033[05m", # Blinking
# Text
"tdbl":"\033[30m", # Dark Black
"tdrd":"\033[31m", # Dark Red
"tdgr":"\033[32m", # Dark Green
"tdyl":"\033[33m", # Dark Yellow
"tdbu":"\033[34m", # Dark Blue
"tdma":"\033[35m", # Dark Magenta
"tdcy":"\033[36m", # Dark Cyan
"tdwh":"\033[37m", # Dark White
"tbbl":"\033[90m", # Bright Black
"tbrd":"\033[91m", # Bright Red
"tbgr":"\033[92m", # Bright Green
"tbyl":"\033[93m", # Bright Yellow
"tbbu":"\033[94m", # Bright Blue
"tbma":"\033[95m", # Bright Magenta
"tbcy":"\033[96m", # Bright Cyan
"tbwh":"\033[97m", # Bright White
# Background
"bdbl":"\033[40m", # Dark Black
"bdrd":"\033[41m", # Dark Red
"bdgr":"\033[42m", # Dark Green
"bdyl":"\033[43m", # Dark Yellow
"bdbu":"\033[44m", # Dark Blue
"bdma":"\033[45m", # Dark Magenta
"bdcy":"\033[46m", # Dark Cyan
"bdwh":"\033[47m", # Dark White
"bbbl":"\033[100m", # Bright Black
"bbrd":"\033[101m", # Bright Red
"bbgr":"\033[102m", # Bright Green
"bbyl":"\033[103m", # Bright Yellow
"bbbu":"\033[104m", # Bright Blue
"bbma":"\033[105m", # Bright Magenta
"bbcy":"\033[106m", # Bright Cyan
"bbwh":"\033[108m" # Bright White
}
keycodes = {
"A":23,
"B":24,
"C":25,
"D":26,
"E":27,
"F":28,
"G":29,
"H":30,
"I":31,
"J":32,
"K":33,
"L":34,
"M":35,
"N":36,
"O":37,
"P":38,
"Q":39,
"R":40,
"S":41,
"T":42,
"U":43,
"V":44,
"W":45,
"X":46,
"Y":47,
"Z":48,
"0":13,
"1":14,
"2":15,
"3":16,
"4":17,
"5":18,
"6":19,
"7":20,
"8":21,
"9":22,
"F1" :88,
"F2" :89,
"F3" :90,
"F4" :91,
"F5" :92,
"F6" :93,
"F7" :94,
"F8" :95,
"F9" :96,
"F10":97,
"F11":98,
"F12":99,
"LShift" :55,
"RShift" :54,
"LCtrl" :50,
"RCtrl" :53,
"LAlt" :51,
"RAlt" :52,
"Tab" :57,
"Space" :8,
"Enter" :7,
"BackSpace" :59,
"Delete" :60,
"Home" :110,
"End" :109,
"PageUp" :111,
"PageDown" :112,
"UpArrow" :72,
"DownArrow" :70,
"RightArrow":71,
"LeftArrow" :69
}
mousecodes = {
"RMB" : 118,
"MMB" : 117,
"LMB" : 116
}
IDColors = {}
def consoleForm(obj):
# Function that prints a pretty object info about
ID = hex(id(obj))[2:].upper()
NAME = str(obj)
c = IDcolor(ID)
return c + " " + ID + " " + NAME + " " + clr["norm"]
def IDcolor(ID):
# Coloring
if ID not in IDColors:
r = random.random()
g = random.random()
b = random.random()
ct = clr["tbwh"]
if max(r, g, b ) > 0.9 or sum((r, g, b))/3 > 0.5:
ct = clr["tdbl"]
c = clr["bold"] + "\033[48;2;"+str(int(r*256))+";"+str(int(g*256))+";"+str(int(b*256))+"m"+ct
IDColors[ID] = c
c = IDColors[ID]
return c

683
Scripts/Destruction.py Normal file
View file

@ -0,0 +1,683 @@
# This is full of destruction stuff
import bge
import aud
import random
import numpy
import math
import mathutils
import types
from Scripts import Reuse
from Scripts import Opt
from Scripts import Multiplayer_Shared
from Scripts.Common import *
scene = bge.logic.getCurrentScene()
cam = scene.active_camera
if "Destruction" not in bge.logic.globalDict:
bge.logic.globalDict["Destruction"] = {}
database = bge.logic.globalDict["Destruction"]
# Particle system
def particles(object, # Particle object
point, # Point where to spawn them
despawn, # Time ( in frames before disappearing )
amount=5, # Amount of them to spawn
max=50, # Max amount of them in the scene
spread=0, # Spread of particles on start
normal=0.05, # Spread of particles over time
velocity=[0,0,0], # Velocity of particles
scale = 1 # Scale of the particle object
):
# Performance kill switch
if not Opt.GoodFPS("particles", 0.5):
return
# Not do the effect if not in view
if cam.getDistanceTo(point) > 100 or not cam.pointInsideFrustum(point) == cam.INSIDE:
return
# We will need a place to register particles
if "particles-registry" not in bge.logic.globalDict:
bge.logic.globalDict["particles-registry"] = {}
registry = bge.logic.globalDict["particles-registry"]
# Making sure that registry contains particle type
if object not in registry:
registry[object] = []
for i in range(amount):
# If we reached max, we abort
inscene = len( registry[object] )
inreuse = len( Reuse.reuse.get(object, []) )
spawned = inscene - inreuse
if spawned > max:
return
# Making particle
particle = Reuse.Create(object, despawn)
particle.scaling = [scale, scale, scale]
# Recording into registry
if particle not in registry[object]:
registry[object].append(particle)
# Puting it into position ( adding the spread )
particle.position = point + mathutils.Vector([random.uniform(-spread, spread),
random.uniform(-spread, spread),
random.uniform(-spread, spread)])
# The next part will require an actuator
# Introducting random spread over time
particle.actuators["Motion"].dLoc = mathutils.Vector([random.uniform(-normal, normal),
random.uniform(-normal, normal),
random.uniform(-normal, normal)])
# Adding the velocity
particle.actuators["Motion"].dLoc += mathutils.Vector(velocity)
def Smoke(point, strength=0.5):
# Not do the effect if not in view
if cam.getDistanceTo(point) > 100 or not cam.pointInsideFrustum(point) == cam.INSIDE:
return
if numpy.random.choice([True, False], p=[strength, 1-strength]):
# Performance kill switch
def do(point):
smokeParticle = Reuse.Create("Smoke", random.randint(30, 60))
smokeParticle.position = point
if Opt.GoodFPS("Smoke", strength):
do(point)
def Dust(point, strength=0.5):
# Not do the effect if not in view
if cam.getDistanceTo(point) > 100 or not cam.pointInsideFrustum(point) == cam.INSIDE:
return
if numpy.random.choice([True, False], p=[strength, 1-strength]):
# Performance kill switch
def do(point):
smokeParticle = Reuse.Create("Dust", random.randint(30, 60))
smokeParticle.position = point
if Opt.GoodFPS("Dust", 0.85):
do(point)
else:
pass
def FireElementTextureLogic(obj):
if type(obj) == bge.types.SCA_PythonController:
obj = obj.owner
vect = obj.getVectTo(cam)
obj.alignAxisToVect((0,0,1), 2, 1)
obj.alignAxisToVect(vect[1], 1, 1)
obj.blenderObject["fire"] -= 0.1
try: v = obj.parent.worldLinearVelocity.copy()
except:
try: v = obj.parent.parent.worldLinearVelocity.copy()
except:return
v = -v + mathutils.Vector((0,0,30))
obj.alignAxisToVect(v, 2, 1)
def AttatchFireBall(point, attachment=None, size=1, duration=0):
# This function will attach a fireball to a point.
# Making the FireBall
FireBall = Reuse.Create("FireBall", duration)
# Attatching the Fireball
FireBall.position = point.copy()
FireBall.scaling = [size, size, size]
if attachment:
FireBall.setParent(attachment, True)
# Attatching a light to it.
if not duration:
if "Light" not in FireBall:
light = Reuse.Create("FireLamp")
light.position = FireBall.position
light.setParent(FireBall)
FireBall["Light"] = light
light = FireBall["Light"]
light.blenderObject.data.use_shadow = False
# In case the fireball is farther than 50 meters
# from the camera, we execute this ones.
FireElementTextureLogic(FireBall)
# Storring it and returning
#ID = Multiplayer_Shared.RandomString()
#database[ID] = FireBall
#FireBall["ID"] = ID
return FireBall
def DeleteFireBall(FireBall):
# To save space we gonna do that.
if "Light" in FireBall:
light = FireBall["Light"]
light.removeParent()
Reuse.Delete(light)
Reuse.Delete(FireBall)
FireBall.removeParent()
def FireBurst(point, size):
# This will make a short burst of fire.
FireBurst = Reuse.Create("FireBurst", 10)
FireBurst.position = point.copy()
FireBurst.scaling = [size, size, size]
FireBurst.blenderObject["fire"] = 1
def SpreadOnGround(object, point, size, spread, amount, duration=0, randomDuration=True):
# This works similarly to particles, but
# instead puts the objects onto the ground.
for i in range(amount):
if randomDuration:
d = random.uniform( duration / 2 , duration )
else: d = duration
obj = Reuse.Create(object, d)
obj.position = mathutils.Vector(point) + mathutils.Vector([random.uniform(-spread, spread),
random.uniform(-spread, spread),
random.uniform(-spread, spread)])
obj.scaling = [size, size, size]
# Puttin the object on the flor
obj.position.z += spread + 1
topos = obj.position.copy()
topos.z -= 200
ray = obj.rayCast(topos)
if ray[1]: obj.position = ray[1]
def Fire(point, strength=0.5):
# Not do the effect if not in view
if cam.getDistanceTo(point) > 100 or not cam.pointInsideFrustum(point) == cam.INSIDE:
return
if numpy.random.choice([True, False], p=[strength, 1-strength]):
# Performance kill switch
def do(point):
#fireParticle = Reuse.Create("Fire", random.randint(30, 60))
#fireParticle.position = point
#FireBurst(point, 0.5)
# Adding some sparks to the fire
particles("FireBurst", point,
despawn = 10,
amount = random.randint(0, 3),
max = 50,
spread = 0.5,
normal = 0.01,
velocity = [0,0,0.1],
scale=random.uniform(0.2,1.0))
if Opt.GoodFPS("Fire", strength):
do(point)
def WaterSplash(point, strength=0.5, rot=0, force=1):
if numpy.random.choice([True, False], p=[strength, 1-strength]):
waterSplash = Reuse.Create("WaterSplashCar", random.randint(10, 20))
waterSplash.position = point
waterSplash.orientation = [0,0,rot]
waterSplash.scaling = [
random.uniform(0.6, 1.4),
random.uniform(0.6, 1.4),
random.uniform(0.6*force, 1.4*force)
]
# Sound
device = bge.logic.globalDict["SoundDevice"]
s = "//sfx/splash.ogg"
if s not in bge.logic.globalDict["sounds"]:
bge.logic.globalDict["sounds"][s] = {"sound":aud.Sound(bge.logic.expandPath(s)),
"play":None}
sound = bge.logic.globalDict["sounds"][s]
sound["play"] = device.play(sound["sound"])
sound["play"].location = point
sound["play"].relative = False
sound["play"].distance_maximum = 100
sound["play"].distance_reference = 1
sound["play"].attenuation = 1
sound["play"].pitch = random.uniform(0.6, 1.4)
sound["play"].volume = 5 * min(2, force)
def Explosion(point, visible=True, size=3, mass=10, effectcars=True):
# Shockwave
# Shockwave will be done using math applied to every object within
# a certain size to the explosion.
dani = scene.objects["Dani_Box"]
if dani.get("driving"):
dani["driving"]["shake"] = mass * 10 / dani.getDistanceTo(point)
for object in scene.objects:
# Getting distance to the object
distance = object.getDistanceTo(point)
# Skipping every object outside of the size of the explosion
if distance > size:
continue
# Calculating forces on the object ( father away less forces ).
force = ( 1 - distance / size ) * mass * object.mass
# Calculating direction of the force
vector = object.getVectTo(point)[1] * -force
# Applying force
try:
object.applyImpulse(point, vector)
# If it is a car we can apply damage to it, by sending it a fake
# impulse of collision.
# But first we need to make sure to have the data for this
# operation
Apoint = types.SimpleNamespace()
Apoint.worldPoint = mathutils.Vector(point)
Apoint.appliedImpulse = force * 10
points = [Apoint]
# Then we send it over
for callback in object.collisionCallbacks:
callback(None, point, None, points)
except:
pass
# Then we also have objects that use this very module to be
# destructable. The all have a collision actuator listening
# to a collision with a property "explosion" to execute their
# function.
if "spawned_by" in object:
for controller in object.controllers:
# This is a bit hacky, but it works.
try:
if "Destruction" in controller.script:
exec(controller.script.replace("Scripts.Destruction.", "")+"(controller)")
except: pass
# And also we want to unsuspend it's physics.
object.restoreDynamics()
# Fire particles
if visible:
# particles("Fire", point,
# despawn = random.randint(int(size/2), int(size)),
# amount = random.randint(int(size/2), int(size)),
# max = 200,
# spread = 0,
# normal = 0.2,
# velocity = [0,0,0.01],
# scale = 2)
FireBurst(point, size/2)
particles("Sparkle", point,
despawn = random.randint(0, 100),
amount = random.randint(10, 50),
max = 100,
spread = size/2,
normal = 0.5,
velocity = [0,0,0.01])
Smoke(point, 1)
#AttatchFireBall(point,
# size = 0.5,
# duration = 200)
SpreadOnGround("FireBall",
point,
0.5,
size/2,
10,
500)
# Sound
device = bge.logic.globalDict["SoundDevice"]
s = "//sfx/boom.ogg"
if s not in bge.logic.globalDict["sounds"]:
bge.logic.globalDict["sounds"][s] = {"sound":aud.Sound(bge.logic.expandPath(s)),
"play":None}
sound = bge.logic.globalDict["sounds"][s]
sound["play"] = device.play(sound["sound"])
sound["play"].location = point
sound["play"].relative = False
sound["play"].distance_maximum = 100
sound["play"].distance_reference = 1
sound["play"].attenuation = 1
sound["play"].pitch = random.uniform(0.6, 1.4)
sound["play"].volume = 20
def DeclareBroken(cont):
#cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
part = cont.owner
part["spawned_by"]["broken"] = True
def WoodGate_level0(cont):
#cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
part = cont.owner
part["spawned_by"]["broken"] = True
colision = cont.sensors["Collision"]
car = colision.hitObject
def do(cont, car, scene, part):
# Optimization trick
if len(Reuse.reuse.get("GatePart.Level0", [])) >= 4:
# Spawning madness
for i in range(4):
chunk = Reuse.Create("GatePart.Level0", 10, selfDestructInactive=True)
Reuse.SelfDestruct(chunk, 500)
chunk.mass = 0
chunk.position = part.position
chunk.orientation = part.orientation
chunk.applyMovement( [ 0, i*1.24-2.45, 0 ] , True)
if car:
cv = car.getLinearVelocity()
chunk.setLinearVelocity( cv / 2)
# Sound
device = bge.logic.globalDict["SoundDevice"]
s = "//sfx/wood.ogg"
if s not in bge.logic.globalDict["sounds"]:
bge.logic.globalDict["sounds"][s] = {"sound":aud.Sound(bge.logic.expandPath(s)),
"play":None}
sound = bge.logic.globalDict["sounds"][s]
sound["play"] = device.play(sound["sound"])
sound["play"].location = chunk.position
sound["play"].velocity = chunk.getLinearVelocity()
sound["play"].relative = False
sound["play"].distance_maximum = 100
sound["play"].distance_reference = 1
sound["play"].attenuation = 1
sound["play"].pitch = random.uniform(0.6, 1.4)
sound["play"].volume = 5
# Deleting the wooden gate
Reuse.Delete(part)
if Opt.GoodFPS("WoodGate_level0", 0.8) or (car and car.get("active")):
do(cont, car, scene, part)
else:
Opt.ScheduleTask("WoodGate_level0 ["+str(id(part))+"]", 0.8, do,
cont, car, scene, part)
def WoodGate_level1(cont):
# Performance kill switch
if not Opt.GoodFPS("WoodGate_level1", 0.7):
return
#cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
part = cont.owner
# Optimization trick
if len(Reuse.reuse.get("GatePart.Level1", [])) >= 4:
# Spawning madness
chunks = []
for i in range(4):
chunk = Reuse.Create("GatePart.Level1", 10, selfDestructInactive=True)
Reuse.SelfDestruct(chunk, 100)
chunk.mass = 0
chunk.position = part.position
chunk.orientation = part.orientation
chunks.append(chunk)
chunks[0].applyMovement( [ 0, 0, 0.75 ] , True)
chunks[0].applyRotation( [ math.pi/2, 0, 0 ] , True)
chunks[1].applyMovement( [ 0, -0.75, 0 ] , True)
chunks[2].applyMovement( [ 0.1, 0, 0 ] , True)
chunks[2].applyRotation( [ math.pi/4, 0, 0 ] , True)
chunks[3].applyRotation( [ -( math.pi/4 ), 0, 0, ] , True)
# Deleting the wooden part
Reuse.Delete(part)
def LightStand(cont):
#cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
part = cont.owner
colision = cont.sensors["Collision"]
car = colision.hitObject
def do(cont, car, scene, part):
part["spawned_by"]["broken"] = True
head = None
tail = None
if Reuse.reuse.get("LightStand.Borked.Head"):
# Head ( top part )
head = Reuse.Create("LightStand.Borked.Head", 300, selfDestructInactive=True)
Reuse.SelfDestruct(head, 600)
head.position = part.position
head.orientation = part.orientation
if Reuse.reuse.get("LightStand.Borked.Tail"):
# Tail ( or leg )
tail = Reuse.Create("LightStand.Borked.Tail", 300, selfDestructInactive=True)
Reuse.SelfDestruct(tail, 600)
tail.position = part.position
tail.orientation = part.orientation
tail.applyMovement( [ 0, 0, -1.3 ] , True)
tail.localAngularVelocity = [random.uniform(-1,1),random.uniform(-1,1),random.uniform(-1,1)]
if car:
cv = car.getLinearVelocity()
if head: head.setLinearVelocity( cv )
if tail: tail.setLinearVelocity( cv )
# Deleting the light stand
Reuse.Delete(part)
if head:
# Sound
device = bge.logic.globalDict["SoundDevice"]
s = "//sfx/hit.ogg"
if s not in bge.logic.globalDict["sounds"]:
bge.logic.globalDict["sounds"][s] = {"sound":aud.Sound(bge.logic.expandPath(s)),
"play":None}
sound = bge.logic.globalDict["sounds"][s]
sound["play"] = device.play(sound["sound"])
sound["play"].location = head.position
sound["play"].velocity = head.getLinearVelocity()
sound["play"].relative = False
sound["play"].distance_maximum = 100
sound["play"].distance_reference = 1
sound["play"].attenuation = 1
sound["play"].pitch = random.uniform(0.6, 1.4)
sound["play"].volume = 5
if Opt.GoodFPS("LightStand", 0.9) or (car and car.get("active")):
do(cont, car, scene, part)
else:
Opt.ScheduleTask("LightStand ["+str(id(part))+"]", 0.8, do,
cont, car, scene, part)
def HouseShelf(cont):
# Performance kill switch
if not Opt.GoodFPS("HouseShelf", 0.5):
return
#cont = bge.logic.getCurrentController()
scene = bge.logic.getCurrentScene()
part = cont.owner
part["spawned_by"]["broken"] = True
# -753 -940 412
despawn = 200
# Shelfs
for i in range(5):
shelf = Reuse.Create("Shelf", despawn)
shelf.position = part.position
shelf.orientation = part.orientation
shelf.applyMovement([0.09,0,(0.3*i)-0.65], True)
# Legs
leg = Reuse.Create("Shelf_Leg1", despawn)
leg.position = part.position
leg.orientation = part.orientation
leg.applyMovement([1.3,0,0], True)
leg = Reuse.Create("Shelf_Leg2", despawn)
leg.position = part.position
leg.orientation = part.orientation
leg.applyMovement([-1.1,0,0], True)
# Lego bricks
brick = Reuse.Create("LegoBrick", despawn)
brick.position = part.position
brick.orientation = part.orientation
brick.applyMovement([0.3,0,0.31], True)
brick.applyRotation([0,0,-(math.pi/4)], True)
brick = Reuse.Create("LegoBrick", despawn)
brick.position = part.position
brick.orientation = part.orientation
brick.applyMovement([-0.2,0,0], True)
brick.applyRotation([0,0,-(math.pi/4)], True)
# Toy Boxes
box = Reuse.Create("Toy_Box", despawn)
box.position = part.position
box.orientation = part.orientation
box.applyMovement([-0.6,0,0], True)
box = Reuse.Create("Toy_Box", despawn)
box.position = part.position
box.orientation = part.orientation
box.applyMovement([0.3,0,0.7], True)
box = Reuse.Create("Toy_Box", despawn)
box.position = part.position
box.orientation = part.orientation
box.applyMovement([0.3,0,-0.7], True)
# Deleting the light stand
Reuse.Delete(part)
# Sound
device = bge.logic.globalDict["SoundDevice"]
s = "//sfx/wood.ogg"
if s not in bge.logic.globalDict["sounds"]:
bge.logic.globalDict["sounds"][s] = {"sound":aud.Sound(bge.logic.expandPath(s)),
"play":None}
sound = bge.logic.globalDict["sounds"][s]
sound["play"] = device.play(sound["sound"])
sound["play"].location = box.position
sound["play"].velocity = box.getLinearVelocity()
sound["play"].relative = False
sound["play"].distance_maximum = 100
sound["play"].distance_reference = 1
sound["play"].attenuation = 1
sound["play"].pitch = random.uniform(0.6, 1.4)
sound["play"].volume = 5

307
Scripts/Garage.py Normal file
View file

@ -0,0 +1,307 @@
# GPLv3-or-later
# (C) J.Y.Amihud ( blenderdumbass )
# This will deal with garage and inventory system.
import bge
import mathutils
from Scripts import Reuse
from Scripts import Vehicle
from Scripts import Money
from Scripts.Common import *
if "inventory" not in bge.logic.globalDict:
bge.logic.globalDict["inventory"] = {}
inventory = bge.logic.globalDict["inventory"]
# Items you can buy for the inventory
shop = {
"Wheels":{
"name":"Car Wheels",
"cost":392,
"model":"Garage_wheel",
"icon":[0,1],
"usemodel":"HatchBack01-white-wheel",
"usescale":0.383585
},
"Parts":{
"name":"Body-work\nParts Kit",
"cost":283,
"model":"Garage_bodypart",
"icon":[0,2],
"usemodel":"Redkiss_Car_body.005"
},
"Nitros":{
"name":"NiTRO",
"cost":465,
"model":"Garage_Nitro",
"icon":[0,0],
"usemodel":"NitroCan"
},
"Spoiler1":{
"name":"Smooth-Bruh\nSpoiler",
"cost":249,
"model":"Garage_Spoiler1",
"icon":[0,3],
"usemodel":"Spoiler1_Attatch",
"effects":{
"drag" :0.75,
"downforce":1.3
}
},
"Spoiler2":{
"name":"Metalcore\nSpoiler",
"cost":353,
"model":"Garage_Spoiler2",
"icon":[0,4],
"usemodel":"Spoiler2_Attatch",
"effects":{
"drag" :0.50,
"downforce":1.51
}
},
"Spoiler3":{
"name":"Stupid\nSpoiler",
"cost":481,
"model":"Garage_Spoiler3",
"icon":[0,5],
"usemodel":"Spoiler3_Attatch",
"effects":{
"drag" :0.90,
"downforce":1.05
}
},
"Spoiler4":{
"name":"6C\nSpoiler",
"cost":699,
"model":"Garage_Spoiler4",
"icon":[0,6],
"usemodel":"Spoiler4_Attatch",
"effects":{
"drag" :0.3,
"downforce":2.01
}
}
}
def Encode():
# We want to look through all cars that are in the garage.
# And see which ones are in the garage
scene = bge.logic.getCurrentScene()
dani = scene.objects["Dani_Box"]
garage = scene.objects["GarageColider"]
garageDistance = 31
# Making sure that we are not running it forever
saved = bge.logic.globalDict.get("garage-saved", [])
if saved:
return saved
# Saving the cars.
# IMPORTANT! The data here should be possible to save into json.
for car in bge.logic.globalDict["allcars"]:
if car.getDistanceTo(garage) < garageDistance:
cardata = Vehicle.Encode(car)
saved.append(cardata)
Reuse.Delete(car)
bge.logic.globalDict["garage-saved"] = saved
return saved
def Decode():
# This will restore cars into the garage
scene = bge.logic.getCurrentScene()
dani = scene.objects["Dani_Box"]
garage = scene.objects["GarageColider"]
# Making sure that we are not running it forever
saved = bge.logic.globalDict.get("garage-saved", [])
if not saved:
return
for cardata in saved:
Vehicle.Decode(cardata, new=True)
bge.logic.globalDict["garage-saved"] = []
UpdateShelfs()
def Inside():
scene = bge.logic.getCurrentScene()
dani = scene.objects["Dani_Box"]
garage = scene.objects["GarageColider"]
garageDistance = 31
ingarage = []
for car in bge.logic.globalDict["allcars"]:
if car.getDistanceTo(garage) < garageDistance:
ingarage.append(car)
return ingarage
def Computer():
# The inventory computer in the Garage
scene = bge.logic.getCurrentScene()
cont = bge.logic.getCurrentController()
dani = scene.objects["Dani_Box"]
computer = scene.objects["Computer"]
computerIcon = scene.objects["ComputerIcon"]
computerIconTop = scene.objects["ComputerIcon.Top"]
computerIconBottom = scene.objects["ComputerIcon.Bottom"]
computerItemName = scene.objects["Garage_Computer_Text.Name"]
computerItemHave = scene.objects["Garage_Computer_Text.Have"]
computerItemPrice = scene.objects["Garage_Computer_Text.Price"]
keys = bge.logic.globalDict["keys"]
if dani.getDistanceTo(computer) > 3:
return
else:
# Updating the icons
# You need to trigger the depsgraph on them for them
# to get the material updated. So we do a dummy operation.
computerIcon.applyRotation((0,0,0))
computerIconTop.applyRotation((0,0,0))
computerIconBottom.applyRotation((0,0,0))
for n, name in enumerate(shop):
item = shop[name]
have = inventory.get(name, 0)
if computer.get("selection",0) == n:
printname = item.get("name", name)
computerItemName["Text"] = printname
have = "have "+str(int(inventory.get(name, 0)))
computerItemHave["Text"] = have
price = "$"+str(item.get("cost", 0))
computerItemPrice["Text"] = price
icon = item.get("icon", [16,16])
computerIcon.blenderObject["raw"] = icon[0]
computerIcon.blenderObject["column"] = icon[1]
elif computer.get("selection",0) + 1 == n:
icon = item.get("icon", [16,16])
computerIconBottom.blenderObject["raw"] = icon[0]
computerIconBottom.blenderObject["column"] = icon[1]
elif computer.get("selection",0) + 1 == len(shop):
icon = [15,15]
computerIconBottom.blenderObject["raw"] = icon[0]
computerIconBottom.blenderObject["column"] = icon[1]
elif computer.get("selection",0) - 1 == n:
icon = item.get("icon", [16,16])
computerIconTop.blenderObject["raw"] = icon[0]
computerIconTop.blenderObject["column"] = icon[1]
elif computer.get("selection",0) == 0:
icon = [15,15]
computerIconTop.blenderObject["raw"] = icon[0]
computerIconTop.blenderObject["column"] = icon[1]
if keycodes["UpArrow"] in keys and not computer.get("timer"):
computer["selection"] = max(computer.get("selection",0) - 1, 0)
computer["timer"] = 5
elif keycodes["DownArrow"] in keys and not computer.get("timer"):
computer["selection"] = min(computer.get("selection",0) + 1, len(shop)-1)
computer["timer"] = 5
elif keycodes["Enter"] in keys and not computer.get("timer"):
Buy(list(shop.keys())[computer.get("selection",0)])
computer["timer"] = 5
if computer.get("timer"): computer["timer"] -= 1
def Buy(name):
# This function will execute a buying of an item
# First we are going to test whether the player has enough money
cost = shop.get(name, {}).get('cost', 0)
model = shop.get(name, {}).get('model')
if Money.Have(cost):
Money.Pay(cost)
if name not in inventory:
inventory[name] = 1
else:
inventory[name] += 1
UpdateShelfs()
else:
bge.logic.globalDict["print"] = "Not enough Money to buy "+name+"."
def Use(name):
if name in inventory:
inventory[name] = max(inventory[name] - 1, 0)
UpdateShelfs()
def Has(name):
return inventory.get(name)
def UpdateShelfs():
# This function updates the shelfs in the game to show if you
# have stuff. Otherwise you would need to come every time to the
# computer.
scene = bge.logic.getCurrentScene()
for name in inventory:
model = shop.get(name, {}).get('model')
amount = inventory[name]
amount = min( amount, 5 )
if model:
model = scene.objects[model]
model.blenderObject.modifiers["Array"].count = amount
if not amount:
model.visible = False
else:
model.visible = True

File diff suppressed because it is too large Load diff

1673
Scripts/Main_update.py Normal file

File diff suppressed because it is too large Load diff

191
Scripts/Map.py Normal file
View file

@ -0,0 +1,191 @@
# This file is for map functions.
# The points where the map image file ends in the
# space of the game.
# ( Note the map is 180 degrees rotated from the in game orientation of everything.
# This is due to modeling of the map ( while Moria's Race movie was being made ) was
# made before the lore for whether this place is was made up. )
xs = -2633 # The most east point
xe = 2383 # The most west point
ys = -1911 # The most north point
ye = 3106 # THe most south point
# Widths of that image file in meters.
xd = xe - xs
yd = ye - ys
rr = 730 # Radius to the edge of the map in meters
mr = 0.05 # Same radius by as a point on the map.
map_factor = mr / rr # The factor by which the relative point is calculated.
import bge
import math
import mathutils
from Scripts import Reuse
from Scripts import Character_Controll
from Scripts import Vehicle
def UpdateMapUI():
# Scene stuff
scene = bge.logic.getCurrentScene()
dani = scene.objects["Dani_Box"]
cam = scene.active_camera
# Map widget
cui = scene.objects["Map_UI"]
# Rotation
# We use the orientation of the camera
# and rotating it 180 degrees for the map.
r = cam.orientation.to_euler().z
r += math.pi
if r > 2*math.pi: r -= 2*math.pi
r = [0,0,r]
cui.blenderObject["orientation"] = r
# Position
# This one is a bit harder, since it will
# move the mapping of the image texture arround
# in the material. And it's hard to tell it just
# the coordinations ( also there is 180 degree flip ).
dl = dani.position
px = 1-( ( dl.x - xs ) / xd ) - 0.13
py = 1-( ( dl.y - ys ) / yd ) - 0.12
p = [px,py,0]
cui.blenderObject["position"] = p
# Map Dani Indicator
# This is even harder. Since the map is rotated with camera
# this widget should by ofsetted by the camera rotation.
cr = r[2]
mdi = scene.objects["Map_Dani_Indicator"]
rig = Character_Controll.getRig(dani)
r = (2*math.pi)-rig.worldOrientation.to_euler().z
r += cr
if r > 2*math.pi: r -= 2*math.pi
r = [0,r,0]
mdi.localOrientation = r
# Removing old show marks
database = bge.logic.globalDict.get("map-icons", {})
for ID in list(database.keys()):
data = database[ID]
#if data["obj"] in Reuse.reuse.get(str(data["obj"]), [])\
if data["updated"]+0.5 < bge.logic.getRealTime():
Reuse.Delete(data["icon"])
del database[ID]
def Show(obj, color=[1,0,0], icon="Map_Icon_Directional", ID=""):
# This function will show things on the map.
# Scene stuff
scene = bge.logic.getCurrentScene()
dani = scene.objects["Dani_Box"]
cam = scene.active_camera
cui = scene.objects["Map_UI"]
# Making the icon database to track changes.
if "map-icons" not in bge.logic.globalDict:
bge.logic.globalDict["map-icons"] = {}
database = bge.logic.globalDict["map-icons"]
# Making sure that there is an object in the database
if not ID:
if type(obj) == list: ID = str(obj)
else: ID = str(id(obj))
if ID not in database:
database[ID] = {"obj":obj}
data = database[ID]
data["updated"] = bge.logic.getRealTime()
# Making sure that there is an icon in the data
if "icon" not in data:
# Making an icon
icon = Reuse.Create(icon, frompoint=cui)
icon.setParent(cui, True, True)
icon.worldScale = cui.worldScale * 2
icon.applyRotation([math.pi/2,0,0], True)
icon.blenderObject["color"] = color
data["icon"] = icon
icon = data["icon"]
# Now that we have the icon we can map it to the map
f = map_factor
# Getting vector to the target
try:
t = obj.worldPosition.copy()
torot = True
except:
t = mathutils.Vector(obj)
torot = False
d = dani.getDistanceTo(t)
if d > rr: # If the target out of range of the map
f = mr / d # This puts the icon on the edge of the map
f *= cui.worldScale.x * 2
t = t - dani.worldPosition
cr = cam.worldOrientation.to_euler()
cr = mathutils.Euler((0,0,-cr.z))
t.rotate(cr)
t = t * f
t.z = 0.001
icon.worldPosition = Vehicle.RelativePoint(cui, t)
# Rotation
if torot:
cr = cr.z
r = obj.worldOrientation.to_euler().z
r += cr
if r > 2*math.pi: r -= 2*math.pi
r = [math.pi/2,0,r]
icon.localOrientation = r
else:
icon.localOrientation = [math.pi/2, 0,0]

61
Scripts/Money.py Normal file
View file

@ -0,0 +1,61 @@
# GPLv3 or later
# (C) J.Y.Amihud ( blenderdumbass )
# This scripts will deal with money in the game.
import bge
import aud
if "money" not in bge.logic.globalDict:
bge.logic.globalDict["money"] = 0.0
money = bge.logic.globalDict["money"]
def Set(amount):
global money
money = amount
UpdateUI(sound=False)
def Get():
return money
def Recieve(amount):
global money
money += amount
UpdateUI()
def Pay(amount):
global money
money -= amount
UpdateUI()
def Have(amount):
if money >= amount: return True
else: return False
def UpdateUI(sound=True):
scene = bge.logic.getCurrentScene()
UI = scene.objects["Dani_Money_Indicator"]
UI["Text"] = "$"+str(int(money))
bge.logic.globalDict["money"] = money
if sound:
Sound()
def Sound():
device = bge.logic.globalDict["SoundDevice"]
code = "//sfx/money.ogg"
if code not in bge.logic.globalDict["sounds"]:
bge.logic.globalDict["sounds"][code] = {"sound":aud.Sound(bge.logic.expandPath(code)),
"play":None}
sound = bge.logic.globalDict["sounds"][code]
if not sound["play"] or not sound["play"].status:
sound["play"] = device.play(sound["sound"])
sound["play"].volume = 2

57
Scripts/Mouse.py Normal file
View file

@ -0,0 +1,57 @@
# Gpl3 or later
# (C) J.Y.Amihud 2024
# Stuff related to mouse control
import bge
def MouseLook(cont):
MouseLookActual(cont)
def MouseLookActual(cont, workanyway=False):
if not bge.logic.globalDict.get("mouse-active", True):
return
# We need this to be able disable mouse look from the
# the code.
# Getting object that will rotate.
if type(cont) == bge.types.SCA_PythonController:
obj = cont.owner
else: obj = cont
scene = bge.logic.getCurrentScene()
dani = scene.objects["Dani_Box"]
# Disabling the camera rotation
if not workanyway and dani.get("driving") and dani["driving"].get("dynamiccam", True):
return
# Getting mouse position on the screen.
mouse = bge.logic.mouse
pos = list(mouse.position)
# Mouse positions are normalized to be 0.5 at the center.
# We need center to be 0.0.
pos[0] -= 0.5
pos[1] -= 0.5
# Getting factor information about how to move the mouse
# from the object.
my = -obj.get("mouse_Y", 1.0)
mx = -obj.get("mouse_X", 1.0)
mg = obj.get("mouse_global", True)
# Applying the rotation.
obj.applyRotation((pos[1]*my, 0, pos[0]*mx), mg)
# Centring the mouse.
CenterCursor()
def CenterCursor():
if not bge.logic.globalDict.get("mouse-active", True):
return
bge.render.setMousePosition(int(bge.render.getWindowWidth() / 2), int(bge.render.getWindowHeight() / 2))

View file

@ -0,0 +1,222 @@
# GPLv3 or later
# (C) J.Y.Amihud ( blenderdumbass ) 2024
# Multiplayer client functions
import bge
import time
import json
import zlib
import traceback
from Scripts import Vehicle
from Scripts import Character_Controll
from Scripts import Opt
from Scripts import Settings
from Scripts.Multiplayer_Shared import *
from Scripts import Reuse
from Scripts.Common import *
settings = Settings.load_settings()
host = settings.get("mp-host", "")
def DescribeScene():
scene = bge.logic.getCurrentScene()
dani = scene.objects["Dani_Box"]
cam = scene.active_camera
garage = scene.objects["GarageColider"]
garageDistance = 31
chunksize = 250
data = {}
addr = Opt.Address(dani.position, chunksize)
if addr not in data:
data[addr] = []
danidata = Character_Controll.Encode(dani)
data[addr].append(danidata)
userId = bge.logic.globalDict.get("userId")
for car in bge.logic.globalDict["allcars"]:
if car.get("inview") and car.getDistanceTo(garage) > garageDistance:
if car.get("ownerId") and car.get("ownerId") != userId:
continue
addr = Opt.Address(car.position, chunksize)
cardata = Vehicle.Encode(car)
if addr not in data:
data[addr] = []
data[addr].append(cardata)
return data
def MainLoop():
scene = bge.logic.getCurrentScene()
dani = scene.objects["Dani_Box"]
cam = scene.active_camera
chunksize = 250
bge.logic.globalDict["networkQueue"] = {}
while True:
try:
# A bit of delay, to not owerwhelm the server
time.sleep(0.1)
# Testing if the game is still runing.
# it will fail when the game engine stops.
try: bge.logic.getRealTime()
except: return
if bge.logic.globalDict.get("restore-physics-timer"):
continue
if bge.logic.globalDict.get("network-scene"):
continue
######### SENDING THE DATA TO SERVER ############
data = {}
# Login
LoginEncode(data)
# Scene
data["scene"] = DescribeScene()
data["vision"] = Opt.Surround(cam.position,
chunksize,
cam.orientation.to_euler())
# Queue
networkQueue = bge.logic.globalDict["networkQueue"]
for key in networkQueue:
if networkQueue[key]:
data[key] = networkQueue[key].pop(0)
######### DEALING WITH RESPONSE ############
data = Send(host, data)
for key in data:
payload = data[key]
if key == "login":
LoginDecode(payload)
elif key == "scene":
bge.logic.globalDict["network-scene"] = payload
elif key == "message":
bge.logic.globalDict["print"] = payload
else:
print(key, payload)
except Exception:
print("\n\nNETWORK CLIENT ERROR:", clr["bold"]+clr["tdrd"], traceback.format_exc(), clr["bold"])
def SecondaryLoop():
# This loop runs in the game loop, not the separate thread.
# And it deals with updates sent by the other thread.
if bge.logic.globalDict.get("network-scene"):
data = bge.logic.globalDict["network-scene"]
SceneDecode(data)
bge.logic.globalDict["network-scene"] = None
def LoginEncode(data):
data["login"] = {}
data["login"]["userId"] = bge.logic.globalDict.get("userId")
data["login"]["username"] = settings.get("mp-name")
data["login"]["room"] = settings.get("mp-room")
def LoginDecode(data):
if data.get("userId"):
bge.logic.globalDict["userId"] = data["userId"]
if data.get("room"):
settings["mp-room"] = data["room"]
def SceneDecode(data):
netObjects = bge.logic.globalDict["netObjects"]
if not data:
return
for addr in data:
chunk = data[addr]
for obj in chunk:
# update = True
# if obj.get("netId") in netObjects["netId"]:
# if obj.get("ownerId"):
# netObjects["netId"][obj.get("netId")]["ownerId"] = obj.get("ownerId")
# obj["ID"] = id(netObjects["netId"][obj.get("netId")])
# Sometimes we want to update some things like netId.
if obj.get("ID") in netObjects["pythonId"]\
and obj.get("name") == netObjects["pythonId"][obj["ID"]].name:
netObjects["pythonId"][obj["ID"]]["netId"] = obj.get("netId")
netObjects["netId"][obj.get("netId")] = netObjects["pythonId"][obj["ID"]]
if obj.get("type") == "veh":
Vehicle.Decode(obj, network=True)
elif obj.get("type") == "chr":
Character_Controll.Decode(obj, network=True)
def QueueToSend(key, data):
networkQueue = bge.logic.globalDict["networkQueue"]
if key not in networkQueue:
networkQueue[key] = []
networkQueue[key].append(data)
def GrabOwnership(obj):
# This function grabs ownership of an object.
# Like when a player steals a car spawned by
# another player.
userId = bge.logic.globalDict["userId"]
ownerId = obj.get("ownerId")
netId = obj.get("netId")
# First we will check that the ownership isn't ours.
if userId != ownerId and netId:
QueueToSend("change-ownership",{
"netId" :netId,
"userId":userId
})
obj["ownerId"] = userId

View file

@ -0,0 +1,455 @@
# GNU GPL v3 or later
# ( C ) J.Y.Amihud ( blenderdumbass ) 2024
import os
import sys
import zlib
import json
import time
import threading
import subprocess
import Settings
from Common import *
from Multiplayer_Shared import *
from http.server import BaseHTTPRequestHandler, HTTPServer
class handler(BaseHTTPRequestHandler):
def do_POST(self):
data = self.Recieve()
response = ParseRequest(data)
self.Send(response)
def Send(self, data):
# Compressing
data = json.dumps(data)
data = data.encode("utf-8")
data = zlib.compress(data)
# Sending
self.send_response(200)
self.send_header("Content-type","application/zip")
self.end_headers()
self.wfile.write(data)
def Recieve(self):
length = int(self.headers.get('content-length'))
data = self.rfile.read(length)
data = zlib.decompress(data)
data = json.loads(data)
return data
def log_message(self, format, *args):
# I don't want any logs.
return
def ParseRequest(data):
resp = {}
for key in data:
payload = data[key]
if "login" == key:
resp[key] = Login(payload)
elif "change-ownership" == key:
resp[key] = ChangeOwnership(payload)
elif "scene" == key:
resp[key] = Scene(data)
elif "vision" == key:
pass
else:
print(key, payload)
userId = data.get("login", {}).get("userId")
room = Safe(data.get("login", {}).get("room"))
messages = LoadData("messages", {}, room)
if messages.get(userId):
resp["message"] = messages[userId].pop(0)
SaveData("messages", messages, room)
return resp
def Login(data):
resp = {}
newuser = False
# Checking userId
if not data.get("userId"):
resp["userId"] = RandomString()
# Checking room
if not data.get("room"):
resp["room"] = "MainRoom"
elif data.get("room") != Safe(data.get("room", "")):
resp["room"] = Safe(data["room"])
data["timestamp"] = time.time()
# Storring users data.
users = LoadData("users", {})
if data.get("userId") and data.get("userId") not in users:
newuser = True
if data.get("userId"):
users[data["userId"]] = data
SaveData("users", users)
if newuser:
userId = data.get("userId")
name = data.get("username")
room = Safe(data.get("room"))
NotifyOthers(userId, name+" joined game.", room)
print(Format(userId), "JOINED GAME!")
return resp
def ChangeOwnership(data):
print(Format(data.get("userId")), "GRABBED", Format(data.get("netId")))
objects = LoadData("objects", {})
if data.get("netId") in objects:
obj = objects[data.get("netId")]
obj["ownerId"] = data.get("userId")
SaveData("objects", objects)
# Changing ownership in chunk
addr = obj.get("chunk")
room = Safe(obj.get("room"))
chunk = LoadData(addr, {}, room)
for o in chunk:
if o.get("netId") == data.get("netId"):
o["ownerId"] = data.get("userId")
SaveData(addr, chunk, room)
return True
else:
print(Format(data.get("netId")),"netId:",data.get("netId"), "NOT FOUND, WHILE CHANGING OWNERSHIP!")
return False
def Scene(data):
scene = data["scene"]
userId = data.get("login", {}).get("userId")
room = Safe(data.get("login", {}).get("room", "MainRoom"))
# We are not updating scene if there is no userId yet.
if not userId:
return
# Reading scene payload.
resp = {}
objects = LoadData("objects", {})
for addr in scene:
chunk = scene[addr]
for obj in chunk:
# Some people might want to cheat by inputing
# values for other users.
if obj.get("netId"):
obj["ownerId"] = objects.get(obj.get("netId"), {}).get("ownerId")
if not obj["ownerId"]:
obj["ownerId"] = userId
if obj.get("ownerId") and obj.get("ownerId") != userId:
chunk.remove(obj)
# Saving chunks data.
for addr in scene:
chunk = scene[addr]
saved = LoadData(addr, [], room)
add = []
# Cleaning up
for obj in saved:
if obj.get("netId") not in objects or objects[obj.get("netId")].get("chunk") != addr:
saved.remove(obj)
ids = []
for obj in saved:
ids.append(obj.get("netId"))
for obj in chunk:
# If object is Dani and it has no netId
# we assume that somebody new joined the
# room.
if obj.get("name") == "Dani_Box" and not obj.get("netId"):
obj["netId"] = userId
obj["ownerId"] = userId
add.append(obj)
elif not obj.get("netId"):
obj["netId"] = RandomString()
obj["ownerId"] = userId
add.append(obj)
if obj.get("netId") not in ids:
saved.append(obj)
else:
saved[ids.index(obj.get("netId"))] = obj
objects[obj["netId"]] = {"chunk":addr,
"name":obj.get("name"),
"timestamp":time.time(),
"ownerId":obj.get("ownerId"),
"room":room}
SaveData(addr, saved, room)
if addr in data.get("vision", []):
resp[addr] = []
for obj in saved:
if obj.get("ownerId") != userId:
resp[addr].append(obj)
for obj in add:
resp[addr].append(obj)
SaveData("objects", objects)
return resp
def Notify(userId, message, room):
messages = LoadData("messages", {}, room)
if userId not in messages:
messages[userId] = []
messages[userId].append(message)
SaveData("messages", messages, room)
def NotifyOthers(userId, message, room):
users = LoadData("users", {})
for user in users:
if user != userId and users[user].get("room") == room:
Notify(user, message, room)
def SaveData(name, data, room=None):
# Making folder for server stuff
folder = Settings.get_settings_folder()+"/server/"
if room: folder = folder+str(room)+"/"
try: os.makedirs(folder)
except: pass
# Saving the json
with open(folder+str(name)+".json", "w") as save:
json.dump(data, save, indent=4)
def LoadData(name, otherwise=None, room=None):
try:
folder = Settings.get_settings_folder()+"/server/"
if room: folder = folder+str(room)+"/"
with open(folder+str(name)+".json") as o:
return json.load(o)
except: return otherwise
def Safe(string):
# This function stripts strings from any unsafe
# characters.
good = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_"
new = ""
for i in string:
if i in good: new = new + i
else: new = new + "_"
return new
def Format(netId, room=True):
objects = LoadData("objects",{})
users = LoadData("users",{})
if netId in users:
name = users[netId].get("username", "Unknown")
room = users[netId].get("room", "Unknown Room")
ownerId = netId
owner = ""
else:
name = objects.get(netId, {}).get("name", "Unknown Object")
room = objects.get(netId, {}).get("room", "Unknown Room")
ownerId = objects.get(netId, {}).get("ownerId")
owner = users.get(ownerId, {}).get("username", "Unknown")
string = IDcolor(room)+" "+room+" "+IDcolor(netId)+" "+netId[-4:]+" "+name
if owner and ownerId:
string = string + " " + IDcolor(ownerId) + " by "+ownerId[-4:]+" " + owner
string = string + " " + clr["norm"]
return string
###### RUNNING THE SERVER #####
def ArgumentsHandler():
port = 6969
ipv6 = "-4"
if "--help" in sys.argv or "-h" in sys.argv:
print("""
This is the Multiplayer server for Dani's Race.
It is technically an HTTP server that handles
POST requests send by the game. Those requests
are in a JSON format compressed with python's
ZLIB library. There is no webpage, so trying to
access it with a browser will probably spit out
an error.
"""+clr["bold"]+clr["tdyl"]+"""RUN THIS SERVER FROM THE "Scripts" FOLDER!"""+clr["norm"]+"""
--help , -h : This Help Text.
--port """+clr["tdyl"]+"""<number>"""+clr["norm"]+""" : Sets up a port on which the
server will listen.
--ipv6 , -6 : Use IPv6 connection for global network.
""")
exit()
if "--port" in sys.argv:
try:
port = int(sys.argv[ sys.argv.index("--port")+1 ])
except:
print("Didn't specify port number.\nExample ( for port 8080 ): $ python3 Multiplayer_Server.py --port 8080")
exit()
if "--ipv6" in sys.argv or "-6" in sys.argv:
ipv6 = "-6"
return port, ipv6
PORT, IPV6 = ArgumentsHandler()
print(clr["bold"]+"Dani's Race Multiplayer Server!"+clr["norm"])
###### CLEANUPS #####
def CleanUps():
while True:
time.sleep(3)
# Cleaning up users
users = LoadData("users", {})
delete = []
for userId in users:
user = users[userId]
room = user.get("room")
name = user.get("username")
# If user missing for 10 seconds, he is gone.
if user.get("timestamp", 0) < time.time() -10:
NotifyOthers(userId, name+" left the game.", room)
print(Format(userId), "LEFT GAME!")
delete.append(userId)
for i in delete:
del users[i]
SaveData("users", users)
objects = LoadData("objects", {})
delete = []
for netId in objects:
obj = objects[netId]
# Deleting objects after 5 missing seconds
if obj.get("timestamp", 0) < time.time() -5:
delete.append(netId)
for i in delete:
del objects[i]
SaveData("objects", objects)
cleanups = threading.Thread(target=CleanUps)
cleanups.daemon = True
cleanups.start()
print("Started cleanups thread.")
print(clr["bold"]+"Starting server:", clr["norm"])
try:
IP = subprocess.check_output(["hostname", "-I"]).decode("utf-8").split(" ")[0]
except:
try:
# Some versions of hostname just have the -i option that acts like -I in
# other versions.
IP = subprocess.check_output(["hostname", "-i"]).decode("utf-8").split(" ")[0]
except:
IP = clr["tdrd"]+"127.0.0.1"+clr["norm"]
if not IP or IP == "\n":
IP = clr["tdrd"]+"127.0.0.1"+clr["norm"]
print(" Local IP:", clr["bold"], IP, clr["norm"])
try:
GLOBALIP = subprocess.check_output(["curl", "-s", IPV6, "ifconfig.co"]).decode("utf-8")[:-1]
print(" Global IP:", clr["bold"], GLOBALIP, clr["norm"])
except:
GLOBALIP = None
print(" Global IP:",clr["tdrd"]+clr["bold"], "No connection to Global Network.", clr["norm"])
print(" Port:", clr["bold"], PORT, clr["norm"])
print(" Local Hostname:", clr["bold"], "http://"+IP+":"+str(PORT), clr["norm"])
if GLOBALIP:
if IPV6 == "-4":
print(" Global Hostname:", clr["bold"], "http://"+GLOBALIP+":"+str(PORT), clr["norm"])
else:
print(" Global Hostname:", clr["bold"], "http://["+GLOBALIP+"]:"+str(PORT), clr["norm"])
print()
serve = HTTPServer(("", PORT), handler)
try:
serve.serve_forever()
except KeyboardInterrupt:
print()
print("Server Exited!")

View file

@ -0,0 +1,40 @@
# GPLv3 or later
# ( C ) J.Y.Amihud ( blenderdumbass ) 2024
import os
import json
import zlib
import random
import urllib.request
import urllib.parse
def RandomString(size=16):
# This will generate random strings, primarily
# for the purpose of recognizing the same objects
# on the network.
good = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"
text = ""
for i in range(size):
text = text + random.choice(good)
return text
def Send(host, data):
# Compressing
data = json.dumps(data)
data = data.encode("utf-8")
data = zlib.compress(data)
# Sending
req = urllib.request.Request(host, data=data)
# Recieving
data = urllib.request.urlopen(req).read()
data = zlib.decompress(data)
data = json.loads(data)
return data

508
Scripts/Opt.py Normal file
View file

@ -0,0 +1,508 @@
import bge
import math
import numpy
import mathutils
r = math.radians
from Scripts import Reuse
from Scripts.Common import *
# Chunks to store data about parts of the world
chunks = {}
bge.logic.globalDict["Opt.chunks"] = chunks
camspeed = 0.0
camposition = mathutils.Vector((0,0,0))
camspeedframe = 0.0
def CameraSpeed():
# This function gives the average speed of the
# camera at any given frame.
frame = round(bge.logic.getRealTime(), 2)
global camspeed
global camposition
global camspeedframe
if frame != camspeedframe:
camspeedframe = frame
# Getting velocity of the camera
p = bge.logic.getCurrentScene().active_camera.worldPosition
v = p - camposition
camposition = p.copy()
# Averaging the velocity
av = 0
for i in v:
if i > 0: av += i
else : av -= i
av /= 3
# Storing the value
camspeed = av
# Returning the value
return camspeed
def ToFPS():
# Return a fraction that is useful to adjust FPS
# sensitive values like gravity.
return 60/bge.logic.getAverageFrameRate()
# Global Variables for GoodFPS function to work.
fpshistory = {} # History of last 200 or so frames FPS
targetFPS = 1 # Target FPS which to aim to preserve
FPStargets = {} # Database of how much a given function effects FPS
testingTarget = False # Fuction that is being tested for how much it effects FPS
testingTargetFrame = 0 # Frame where the test is started
testFPS = 60 # The FPS before the test started
limitframe = 0 # The Frame that is currently being calculated for expected FPS
expectedfps = 60 # Expected FPS with running functions tested effects removed from current FPS
def GoodFPS(func="", factor=1, boolean=True, traceback=False, ):
global targetFPS
# Recording the framerate into buffer
# This buffer will be used to regulate the target FPS
fps = bge.logic.getAverageFrameRate()
frame = round(bge.logic.getRealTime(), 2)
camspeed = min(CameraSpeed(), 1)
global fpshistory
fpshistory[frame] = fps
# Limiting execution based on camera speed.
if boolean and numpy.random.choice([True, False], p=[camspeed, 1-camspeed]):
return False
# Setting the target fps
if frame > 5:# and fps > targetFPS:
targetFPS = max(fpshistory.values())
targetFPS *= 1.1
#targetFPS = min(targetFPS, 30)
# Slicing buffer to contain only last 300 records
newfpshistory = {}
for i in list(fpshistory.keys())[-300:]:
newfpshistory[i] = fpshistory[i]
fpshistory = newfpshistory
# Calculating the fraction ( of how much are we within the target FPS )
fraction = ( sum( min(f, targetFPS) for f in fpshistory.values()) / len(fpshistory) ) / targetFPS
# Testing FPS impacts of various functions to see
# how much to limit them.
global FPStargets
global testFPS
global testingTarget
global testingTargetFrame
# This runs when the target for testing is already setup
if testingTarget:
# If we have some decrease in performace, we calculate how much it effects the FPS
if frame > testingTargetFrame and fps+1 < testFPS:
FPStargets[testingTarget] = {"fraction":fps / testFPS, "frame":frame}
testingTarget = False
# Otherwise we cancel the test
elif frame -2 > testingTargetFrame:
testingTarget = False
# While we testing, we want to return False, so nothing else will effect the FPS
if boolean: return False
else: return 0.0
# This runs to start the test
if ( func and func not in FPStargets and 10 < frame or FPStargets.get(func, {}).get("frame", frame) + 60 < frame ) and fraction > factor:
testFPS = fps
testingTarget = func
testingTargetFrame = frame
# And we want to return True so the function will get launched.
if boolean: return True
else: return 1.0
# Limiting functions based on the tests
global limitframe
global expectedfps
# Findinf the limiting factor
try:
targetFactor = min(n.get("fraction") for n in FPStargets.values()) * factor
except:
targetFactor = factor
# Limiting
if expectedfps * FPStargets.get(func, {}).get("fraction", 1) < targetFPS * targetFactor:
if boolean: return False
# If we allow the function to run
# we want to recalculate the expected FPS
# based on the tests
if limitframe != frame:
# If the tests data is flawed
if int(expectedfps) > int(fps)+2:
FPStargets = {}
# Calculating expected FPS
expectedfps = fps*FPStargets.get(func, {}).get("fraction", 1)
limitframe = frame
else:
expectedfps *= FPStargets.get(func, {}).get("fraction", 1)
# Returning
if boolean:
return True#fraction > factor
else:
return fraction
def Address(location, precision):
# This function will return an adress of any given location
# Which could be used to compare between objects to see if they
# are close enough together.
ret = ""
for axis in location[:2]:
ret = ret + str(round(axis/precision))+":"
return ret
def Surround(location, precision, camera=None):
# This function will give a list of addresses around a certain point.
ret = []
ORL = []
addedtypes = []
for axis in location[:2]:
ORL.append(round(axis/precision))
ret.append(Address(ORL, 1))
if not camera:
# X
if (location[0]/precision) - round(location[0]/precision) < 0.5:
ret.append(Address([ORL[0]-1, ORL[1]], 1))
addedtypes.append("-x")
elif (location[0]/precision) - round(location[0]/precision) > 0.5:
ret.append(Address([ORL[0]+1, ORL[1]], 1))
addedtypes.append("+x")
# Y
if (location[1]/precision) - round(location[1]/precision) < 0.5:
ret.append(Address([ORL[0], ORL[1]-1], 1))
addedtypes.append("-y")
elif (location[1]/precision) - round(location[1]/precision) > 0.5:
ret.append(Address([ORL[0], ORL[1]+1], 1))
addedtypes.append("+y")
# Diagonals
if "+x" in addedtypes and "+y" in addedtypes:
ret.append(Address([ORL[0]+1, ORL[1]+1], 1))
elif "-x" in addedtypes and "-y" in addedtypes:
ret.append(Address([ORL[0]-1, ORL[1]-1], 1))
elif "-x" in addedtypes and "+y" in addedtypes:
ret.append(Address([ORL[0]-1, ORL[1]+1], 1))
elif "+x" in addedtypes and "-y" in addedtypes:
ret.append(Address([ORL[0]+1, ORL[1]-1], 1))
else:
if r(70) >= camera[2] >= r(-70):
ret.append(Address([ORL[0], ORL[1]+1], 1))
if r(25) >= camera[2] >= r(-115):
ret.append(Address([ORL[0]+1, ORL[1]+1], 1))
if r(-20) >= camera[2] >= r(-160):
ret.append(Address([ORL[0]+1, ORL[1]], 1))
if r(-65) >= camera[2] >= r(-180) or r(180) > camera[2] >= r(155):
ret.append(Address([ORL[0]+1, ORL[1]-1], 1))
if r(-110) >= camera[2] >= r(-180) or r(180) > camera[2] >= r(110):
ret.append(Address([ORL[0], ORL[1]-1], 1))
if r(-155) >= camera[2] >= r(180) or r(180) > camera[2] >= r(65):
ret.append(Address([ORL[0]-1, ORL[1]-1], 1))
if r(160) >= camera[2] >= r(20):
ret.append(Address([ORL[0]-1, ORL[1]], 1))
if r(115) >= camera[2] >= r(-25):
ret.append(Address([ORL[0]-1, ORL[1]+1], 1))
return ret
previousSurround = {}
def SurroundChanged(key, surround):
# This returns whether surround was changed between frames
if key not in previousSurround:
previousSurround[key] = surround.copy()
changed = surround != previousSurround[key]
previousSurround[key] = surround.copy()
return changed
def RegisterObject(object, precision, delete=True):
# This will move an object from scene.objects into
# chunks. So that they could be stored without
# effecting the BGE Depsgraph performance.
# Creating chunk
addr = Address(object.position, precision)
if addr not in chunks:
chunks[addr] = {"loaded":False,
"objects":[]}
# Adding properties
virtualObject = {}
virtualObject["name"] = object.name
virtualObject["position"] = object.position.copy()
virtualObject["orientation"] = object.orientation.to_euler()
virtualObject["scaling"] = object.scaling.copy()
for i in object.blenderObject.game.properties:
virtualObject[i.name] = i.value
# Adding the object to the chunk
chunks[addr]["objects"].append(virtualObject)
# Deleting real object
if delete:
object.endObject()
# Returning
return virtualObject
def SortByDistance(l, cam, withdistance=False):
# This sorts a chunk by the distance
distanced = []
for n, i in enumerate(l):
d = cam.getDistanceTo(i["position"])
distanced.append([d, n, i])
distanced = sorted(distanced)
if withdistance:
return distanced
ret = []
for i in distanced:
ret.append(i[2])
return ret
def UpdateScene(camobject, precision, camera=None):
# This function will update the scene. According to the camera
# view.
location = camobject.position
# Getting addresses
addrs = Surround(location, precision, camera)
# Checking if any of addresses are not up to date.
for addr in chunks:
# Delete object if address not in view
# It is done in a separate loop and first,
# because we might need elements from it
# to spawn later. Otherwise we might cache
# way too many objects into memory.
if addr not in addrs and chunks[addr]["loaded"]:
for object in chunks[addr]["objects"]:
if object.get("object"):
Reuse.Delete(object["object"])
object["object"] = None
chunks[addr]["loaded"] = False
# Breaking to skip to next frame and
# re-evaluate whether the FPS is good
return
lookthroughchunks = chunks
if addrs[0] in chunks:
lookthroughchunks = [chunks[addrs[0]]]+list(chunks.keys())
# Fixing random items at the chunks.
for i in range(5):
addr = random.choice(list(chunks.keys()))
item = random.choice(chunks[addr]["objects"])
if item.get("broken"):
item["broken"] = False
print(consoleForm(item["name"]), "Fixed")
for addr in chunks:
# Create objects when addres in view
if addr in addrs and not chunks[addr]["loaded"]:
for object in SortByDistance(chunks[addr]["objects"], camobject):
if not object.get("object") and not object.get("broken"):
object["object"] = Reuse.Create(object["name"])
object["object"].position = object["position"]
object["object"].orientation = object["orientation"]
object["object"].scaling = object["scaling"]
# Some objects have a height adjustment value
object["object"].position[2] += object["object"].get("movez", 0)
# Some effects require a reference point
object["object"]["spawned_by"] = object
# Some objects need dynamics to be suspended
if object.get("suspendDynamics"):
object["object"].suspendDynamics(True)
# Some objects might change mesh during game
if object["object"].get("good"):
object["object"].replaceMesh(object["object"]["good"])
chunks[addr]["loaded"] = True
# Breaking to skip to next frame and
# re-evaluate whether the FPS is good
return
# Level Of Details for spawn objects
# This is needed because normal LOD system
# with those objects sometimes gives a
# segmentation fault.
elif addr in addrs and chunks[addr]["loaded"]:
sortedObjects = SortByDistance(chunks[addr]["objects"], camobject, True)
# closestUnspawned = [1000000, 0, {}]
# for object in sortedObjects:
# if not object[2].get("object") and object[0] < closestUnspawned[0]:
# closestUnspawned = object
#
# if Reuse.reuse.get(closestUnspawned[2].get("name")):
# closestUnspawned[2]["object"] = Reuse.Create(closestUnspawned[2].get("name"))
# closestUnspawned[2]["object"].position = closestUnspawned[2]["position"]
# closestUnspawned[2]["object"].orientation = closestUnspawned[2]["orientation"]
# closestUnspawned[2]["object"].scaling = closestUnspawned[2]["scaling"]
#
# # Some objects have a height adjustment value
# closestUnspawned[2]["object"].position[2] += closestUnspawned[2]["object"].get("movez", 0)
#
# # Some effects require a reference point
# closestUnspawned[2]["object"]["spawned_by"] = closestUnspawned[2]
#
# # Some objects need dynamics to be suspended
# if closestUnspawned[2].get("suspendDynamics"):
# closestUnspawned[2]["object"].suspendDynamics(True)
for distance, n, object in sortedObjects:
#
# if object["name"] == closestUnspawned[2].get("name") and distance > closestUnspawned[0] and object.get("object"):
# Reuse.Delete(object["object"])
# object["object"] = None
if "lods" in object and object.get("object"):
distance = object["object"].getDistanceTo(location)
for lod in object["lods"]:
lodDistance = object["lods"][lod]
if int(distance) <= lodDistance:
break
if object["object"].name != lod:
Reuse.Delete(object["object"])
object["object"] = Reuse.Create(lod)
object["object"].position = object["position"]
object["object"].orientation = object["orientation"]
object["object"].scaling = object["scaling"]
# Some objects have a height adjustment value
object["object"].position[2] += object["object"].get("movez", 0)
# Some effects require a reference point
object["object"]["spawned_by"] = object
# Some objects need dynamics to be suspended
if object.get("suspendDynamics"):
object["object"].suspendDynamics(True)
taskschedule = {}
def ScheduleTask(taskname, FPSfactor, task, *args):
# This function adds a function to the schedule
taskObject = {"FPSfactor":FPSfactor,
"task":task,
"args":args}
taskschedule[taskname] = taskObject
def ExecuteScheduled():
# This function executes a scheduled task
# for taskname in taskschedule:
# print("Scheduled:", taskname)
# print()
# Trying to execute something
for taskname in taskschedule:
taskObject = taskschedule[taskname]
if GoodFPS("[Scheduled] "+taskname, taskObject["FPSfactor"]):
del taskschedule[taskname]
taskObject["task"](*taskObject["args"])
return
def Force(value):
# This function adjusts acceleration
# to fps
return value * ( ToFPS() ** 2 )
def Velocity(value):
# This function adjusts velocity
# to fps
return value * ToFPS()
def PrintTime():
# This function is used for testing
print(bge.logic.getRealTime())

138
Scripts/Reuse.py Normal file
View file

@ -0,0 +1,138 @@
import bge
from Scripts.Common import *
# This script is to spawn objects smartly
# We will need this
scene = bge.logic.getCurrentScene()
# We need a dictionary to save objects for reuse
if "reuse" not in bge.logic.globalDict:
bge.logic.globalDict["reuse"] = {}
bge.logic.globalDict["reuse-amounts"] = {}
bge.logic.globalDict["self-destruct"] = []
# For easy access
reuse = bge.logic.globalDict["reuse"]
amounts = bge.logic.globalDict["reuse-amounts"]
selfDestruct = bge.logic.globalDict["self-destruct"]
# Function to spawn objects
def Create(object, selfDestructFrames=0, selfDestructInactive=False, visible=True, declarenew=False, frompoint=None):
# Making a list of those objects in reuse dictionary.
if object not in reuse:
reuse[object] = []
# If the list is empty ( we need more objects ) we make a new one.
if not reuse[object]:
if not frompoint: frompoint = object
object = scene.addObject(object, frompoint, 0, False)
new = True
if object.name not in amounts:
amounts[object.name] = 0
amounts[object.name] += 1
#print(clr["bold"]+clr["tdyl"]+"Reuse New"+clr["norm"]+":", object, amounts[object.name])
else:
object = reuse[object].pop(0)
object.restorePhysics()
object.worldLinearVelocity = [0,0,0]
object.worldAngularVelocity = [0,0,0]
new = False
# If self descructing
if selfDestructFrames:
SelfDestruct(object, selfDestructFrames, selfDestructInactive)
object.setVisible( visible )
if declarenew:
return object, new
else:
return object
def Delete(object, inactive=False):
# To make this callable from logic bricks the next thing is needed.
try:
object = object.owner
except:
pass
# Making a list of those objects in reuse dictionary.
# Technically if Create() was use to create this object it's
# not needed, but incase other objects will be stored like this.
if object.name not in reuse:
reuse[object.name] = []
# Sometimes just recording that the object is available is enough:
if not inactive:
# Instead of deleting we are going to store it for later
object.worldLinearVelocity = [0,0,0]
object.worldAngularVelocity = [0,0,0]
object.scaling = [1,1,1]
object.suspendPhysics()
object.position = [0, 0, -1000] # Putting it outside of the playable area ( in case there are parented parts )
object.visible = False
# For some objects
if "Motion" in object.actuators:
object.actuators["Motion"].dLoc = [0,0,0]
# Storing the object for later use
if object not in reuse[object.name]:
reuse[object.name].append(object)
# Making sure it will not self distract again after it is reused
object["self-destruct"] = 2
if object in selfDestruct:
selfDestruct.remove(object)
def SelfDestruct(object, frames, inactive=False):
# Function that will make objects ( like particles ) self terminate:
# We will add the object into a dict
object["self-destruct"] = frames
object["self-destruct-inactive"] = inactive
selfDestruct.append(object)
def SelfDestructDo():
# Happening on update to self destruct objects
for object in selfDestruct:
object["self-destruct"] -= 1
if object["self-destruct"] <= 0:
Delete(object, object["self-destruct-inactive"])
if object in selfDestruct:
selfDestruct.remove(object)
def EndObject(object):
# Actually end object
# Reuding the number of the object in amounts
if object.name in amounts:
amounts[object.name] -= 1
print(clr["bold"]+clr["tdrd"]+"Reuse End Object"+clr["norm"]+":", object, amounts[object.name])
# Removing the object from reuse if it is in reuse
if object in reuse.get(object.name):
reuse[object.name].remove(object)
# Removing all object's children, and the object.
for i in object.childrenRecursive:
i.endObject()
object.endObject()

819
Scripts/Script.py Normal file
View file

@ -0,0 +1,819 @@
# This file contains all of the scripted events of the game's story.
# And some logic to go with it.
import bge
import aud
from Scripts import Reuse
from Scripts import Character_Controll
from Scripts import Vehicle
from Scripts import Map
from Scripts import Main_update
from Scripts import Garage
from Scripts.Common import *
Story = {"currentEvent":"01_Bring_Neonspeedster_To_Racetrack","passed":[]}
Speakers = {}
def Run(scene, dani):
# This function runs the script
if Story["currentEvent"] in Story:
Story[Story["currentEvent"]](scene, dani)
# This needed incase some character started speaking
RemoveSpeakerAnimation()
def RingPhone():
# This function rings the phone.
bge.logic.globalDict["print"] = "Press P to answer the phone.\nPress H to hang up."
device = bge.logic.globalDict["SoundDevice"]
s = "//sfx/music/ringtone.ogg"
if s not in bge.logic.globalDict["sounds"]:
bge.logic.globalDict["sounds"][s] = {"sound":aud.Sound(bge.logic.expandPath(s)),
"play":None}
sound = bge.logic.globalDict["sounds"][s]
sound["play"] = device.play(sound["sound"])
sound["play"].volume = 0.5
return sound["play"]
def AnsweredPhone():
# This function answers phone if player presses P
sound = Story["ringing"]
# Answer Phone
if keycodes["P"] in bge.logic.globalDict["keys"]:
sound.stop()
return True
# Hang Up
elif keycodes["H"] in bge.logic.globalDict["keys"]:
sound.stop()
return False
# Do nothing
else:
return False
def PlayDialogue(number, character=None):
# This function plays dialogue from the specific scene.
device = bge.logic.globalDict["SoundDevice"]
s = "//sfx/voices/scenes/"+Story["currentEvent"]+"/"+number+".ogg"
if s not in bge.logic.globalDict["sounds"]:
bge.logic.globalDict["sounds"][s] = {"sound":aud.Sound(bge.logic.expandPath(s)),
"play":None}
sound = bge.logic.globalDict["sounds"][s]
sound["play"] = device.play(sound["sound"])
sound["play"].volume = 2
if character:
sound["play"].location = character.worldPosition
sound["play"].velocity = character.getLinearVelocity()
sound["play"].relative = False
sound["play"].distance_maximum = 200
sound["play"].distance_reference = 1
sound["play"].attenuation = 0
sound["play"].volume = 2
# Setting speaking animation
character["speaking"] = True
# Removing the speaking animation
# when the sound file is finished
Speakers[character.name] = {"sound":sound, "character":character}
return sound["play"]
def RemoveSpeakerAnimation():
# This function removes speaker animations
# for when characters speak.
for charactername in Speakers:
speaker = Speakers[charactername]
character = speaker["character"]
sound = speaker["sound"]
if not sound["play"].status:
character["speaking"] = False
def emote(dani, data, sound):
# This function will set off face animations
# based on the data and sound timing.
for emotion in data:
start, end = emotion[0]
emotion = emotion[1]
if start < sound.position < end:
Character_Controll.ApplyAnimation(dani, emotion)
def StatusText(text, bold=[]):
# This function prints a status text that is visible all
# the time.
scene = bge.logic.getCurrentScene()
st = scene.objects["Game_Status_Text"]
if "status-text" not in bge.logic.globalDict:
bge.logic.globalDict["status-text"] = ""
if text != bge.logic.globalDict["status-text"]:
# Updating text
# I'm doing this and not `st["Text"] = text` because
# I want it it update the blender object data now.
# Since next part will be to boldify the text.
st.blenderObject.data.body = text
# Storing the text value, so it will not update on every frame.
bge.logic.globalDict["status-text"] = text
bge.logic.globalDict["status-bold"] = ""
if "status-bold" not in bge.logic.globalDict:
bge.logic.globalDict["status-bold"] = ""
if bold != bge.logic.globalDict["status-bold"]:
bge.logic.globalDict["status-bold"] = bold
# Boldifying the text
for n, i in enumerate(st.blenderObject.data.body_format):
if n in bold:
i.use_bold = True
i.material_index = 0
else:
i.use_bold = False
i.material_index = 1
def StatusUpdate(stages, stage):
t = ""
bold = []
for n, s in enumerate(stages):
if n == stage:
bold = range(len(t), len(t)+len(s)+5+3)
t = t + "-> "
if stage > n:
t = t + s + " <+>\n"
else:
t = t + s + " < >\n"
try:StatusText(t, bold)
except Exception as e: print("error", e)
##############################################################################
# Mission : Deliver Neonspeedster to Racetrack.
# Challenge: Not to break the car.
def scene(scene, dani):
# First we will make the phone called to Dani.
# He needs to pick it up to start the mission itself.
# The phone call should only ring when Dani is close to the house
# since we don't want the player to be near the Racetrack and
# see that Paps isn't there yet. We will spawn him there later.
stages = [
"Find Neonspeedster",
"Deliver it to Paps"
]
house = scene.objects["TheHouse"]
pointer = scene.objects["PointingArrow"]
targetLocation = [-62.82, 967.5, 4.738]
# Showing on the map
if not dani.get("race"):
Map.Show(house, icon="Map_Circle", color=[1,0.8,0])
if dani.getDistanceTo(house) < 200 and not dani.get("race"):
# If at least 20 seconds have been passed from the start of the game.
if bge.logic.getRealTime() > Story.get("lastring", 20):
Story["ringing"] = RingPhone()
Story["lastring"] = bge.logic.getRealTime() + 100
# If the phone is still ringing we can answer it
if "ringing" in Story and Story["ringing"].status and AnsweredPhone():
del Story["ringing"]
Story["dialogue01"] = PlayDialogue("brief")
dani["race"] = Story["currentEvent"]
# Animation of dani holding the phone
if "dialogue01" in Story:
Character_Controll.ApplyAnimation(dani, "AnswerPhone")
# Emoting to the phone conversation
emotion_data = [
[[ 3.1 , 3.6 ], "Talk" ],
[[ 8.6 , 8.9 ], "Laugh"],
[[ 18.1 , 19.0 ], "Talk" ]
]
emote(dani, emotion_data, Story["dialogue01"])
# When we finished listening to it activate the event
if "dialogue01" in Story and not Story["dialogue01"].status:
del Story["dialogue01"]
bge.logic.globalDict["print"] = "Find the Neonspeedster.\nIt should be in the garage."
Story["stage0"] = True
StatusUpdate(stages, 0)
# Animation of putting away the phone
Character_Controll.ApplyAnimation(dani, "PutPhoneAway")
# We we will a neonspeedste at a specific point in the garage for this to work
# relying on the spawn system is stupid, since it might decide that we will not
# get a NeonSpeedster
NeonSpeedsterPosition = [-754.61, -1043.9, 409.32]
NeonSpeedsterOrientation = [0, 0, -1.79]
TruckPosition = [-44.62, 960.8, 4.738]
if "stage1" not in Story and not "NeonSpeedster" in Story and dani.getDistanceTo(NeonSpeedsterPosition) < 50:
f = False
for c in Garage.Inside():
if c.name == "NeonSpeedsterBox":
Story["NeonSpeedster"] = c
f = True
if not f:
# We need properly declare the car, otherwise it will break things
Story["NeonSpeedster"] = Vehicle.Spawn("NeonSpeedsterBox",
NeonSpeedsterPosition,
NeonSpeedsterOrientation)
# Showing all neonspeedsters on the map
if "stage0" in Story and str(dani.get("drving")) != "NeonSpeedsterBox":
for car in bge.logic.globalDict["allcars"]:
if car.name == "NeonSpeedsterBox":
Map.Show(car, color=Vehicle.GetColor(car))
# As soon as dani found the Neonspeedster, we activate the second stage
if "stage0" in Story and dani["driving"] and dani["driving"].name == "NeonSpeedsterBox":
del Story["stage0"]
try: del Story["NeonSpeedster"]
except: pass
bge.logic.globalDict["print"] = "Drive the Neonspeedster to the Racetrack.\nNot a single scratch!"
pointer.visible = True
# Making a cylinder where the mission ends
Story["stage1"] = Reuse.Create("Starter.Cylinder")
Story["stage1"].position = targetLocation
Story["stage1"].scaling = [8,8,1]
StatusUpdate(stages, 1)
# Spawning Paps To make sure he is there to recieve
# the car
Reuse.Delete(scene.objects["PapsBox"])
Story["Paps"] = Reuse.Create("PapsBox")
Story["Paps"].position = [-54.875, 972.66, 4.7383]
# He spawns in an area where the physics arent enabled for
# the ground yet.
Story["Paps"].suspendDynamics(True)
Story["Paps"]["deactivated"] = True
# Same thing but for Moria
Story["Moria"] = Reuse.Create("MoriaBox")
Story["Moria"].position = [-56.875, 972.66, 4.7383]
Story["Moria"].suspendDynamics(True)
# And Jack
Story["Jack"] = Reuse.Create("JackBox")
Story["Jack"].position = [-52.875, 972.66, 4.7383]
Story["Jack"].suspendDynamics(True)
# Fixing Pap's dynamics and making paps go at Dani
if "Paps" in Story and Story["Paps"].getDistanceTo(dani) < 500:
if Story["Paps"]["deactivated"]:
Story["Paps"].restoreDynamics()
Story["Moria"].restoreDynamics()
Story["Jack"].restoreDynamics()
Story["Paps"]["deactivated"] = False
# Draw a pointer to the racetrack
if "stage1" in Story:
# Showing the racetrack on the map
Map.Show(targetLocation, icon="Map_Circle", color=[1,0.8,0])
# Point the pointer to the racetrack
tocheck = pointer.getVectTo(targetLocation)
pointer.alignAxisToVect(tocheck[1], 1, 0.1)
pointer.alignAxisToVect( (0,0,1), 2, 1.0 )
# Spawning the truck that paps was talking about near paps
if "Truck" not in Story and dani.getDistanceTo(TruckPosition) < 200:
Story["Truck"] = Vehicle.Spawn("TruckBox",
TruckPosition,
[0,0,0])
# Deciding on the mission
if dani["driving"] and dani["driving"].name == "NeonSpeedsterBox" and dani["driving"].getDistanceTo(targetLocation) < 8:
StatusUpdate(stages, 2)
#Character_Controll.ApplyAnimation(Story["Paps"], "Stand")
Reuse.Delete(Story["stage1"])
del Story["stage1"]
if dani["driving"]["health"] >= 0.99:
bge.logic.globalDict["print"] = "Excellent Job!"
Story["dialogue02"] = PlayDialogue("win", Story["Paps"])
Story["verdict"] = "won"
Story["Neonspeedster"] = dani["driving"]
else:
bge.logic.globalDict["print"] = "You Failed! There was a scratch!"
Story["dialogue02"] = PlayDialogue("lose", Story["Paps"])
Story["verdict"] = "lost"
# While the paps is telling you that you won
if "dialogue02" in Story:
emotion_data = [
[[ 1.15 , 8 ], "Talk" ]
]
emote(Story["Paps"], emotion_data, Story["dialogue02"])
if 50 > Story["Paps"].getDistanceTo(dani) > 4:
Character_Controll.walkToward(Story["Paps"], dani)
if 50 > Story["Moria"].getDistanceTo(dani) > 4:
Character_Controll.walkToward(Story["Moria"], dani)
if 50 > Story["Jack"].getDistanceTo(dani) > 4:
Character_Controll.walkToward(Story["Jack"], dani)
# When the dialog ende# d.
if not Story["dialogue02"].status:
# Going for the next story
if Story["verdict"] == "won":
Story["passed"].append(Story["currentEvent"])
Story["currentEvent"] = "02_Bring_Truck_To_House"
Story["timer"] = 100
#else:
# try: del Story["Truck"]
# except: pass
# Ending the event
del Story["dialogue02"]
pointer.visible = False
dani["race"] = ""
StatusText("")
Story["01_Bring_Neonspeedster_To_Racetrack"] = scene
##############################################################################
def scene(scene, dani):
house = scene.objects["TheHouse"]
pointer = scene.objects["PointingArrow"]
# Moria goes to the racetrack and does some racing by herself.
if "Moria" in Story:
# Moria goes to the car
if not dani.get("driving") and not Story["Moria"].get("driving"):
Character_Controll.getIntoCar(Story["Moria"], Story["Neonspeedster"])
if Story["Moria"].get("driving"):
racepos = [-61.7856, 1028, 0]
# Moria drive the car to the race
if Story["Moria"]["driving"].getDistanceTo(racepos) > 2 and "Moria-Practicing" not in Story:
Story["Moria"]["driving"]["npc"] = "story"
Story["Moria"]["driving"]["target"] = racepos
Vehicle.TargetedNPC(Story["Moria"]["driving"])
# Moria racing the race
elif "Moria-Practicing" not in Story:
Story["Moria"]["driving"]["race"] = "RacetrackRace"
Story["Moria"]["driving"]["npc"] = "racer"
Story["Moria"]["driving"]["racing"] = True
Story["Moria-Practicing"] = True
# Optmization Deleting both Moria and the car she drives
# if Dani is far enough away.
if dani.getDistanceTo(Story["Moria"]) > 500:
if Story["Moria"].get("driving"):
Story["Moria"]["driving"]["racing"] = False
Reuse.Delete(Story["Moria"]["driving"])
Character_Controll.getOutCar(Story["Moria"])
Reuse.Delete(Story["Moria"])
del Story["Moria"]
# Paps
if "Paps" in Story:
# Optimization
if not "dialogue1" in Story and not "dialogue2" in Story:
if dani.getDistanceTo(Story["Paps"]) > 500:
Reuse.Delete(Story["Paps"])
del Story["Paps"]
# Jack
if "Jack" in Story:
# Optimization
if dani.getDistanceTo(Story["Jack"]) > 500 and Story.get("stage", 0) < 5:
Reuse.Delete(Story["Jack"])
if Story["Jack"].get("driving"):
Character_Controll.getOutCar(Story["Jack"])
del Story["Jack"]
dani["race"] = ""
try: del Story["stage"]
except: pass
pointer.visible = False
# Truck
if "Truck" in Story:
# Optimization
if dani.getDistanceTo(Story["Truck"]) > 500 and Story.get("stage", 0) < 5:
Reuse.Delete(Story["Truck"])
del Story["Truck"]
dani["race"] = ""
try:
del Story["stage"]
bge.logic.globalDict["print"] = "Mission Failed! You've abandoned it."
except: pass
pointer.visible = False
racetrack = [-62.82, 967.5, 4.738]
# Showing on the map
if not dani.get("race"):
Map.Show(racetrack, icon="Map_Circle", color=[1,0.8,0])
# If dani is close to the racetrack and everything has been despawned
# spawned it back in if dani comes.
if dani.getDistanceTo(racetrack) < 450 and "stage" not in Story and not dani.get("race"):
# Restoring truck, Paps and Jack
if "Truck" not in Story:
TruckPosition = [-44.62, 960.8, 4.738]
Story["Truck"] = Vehicle.Spawn("TruckBox",
TruckPosition,
[0,0,0])
if not Story["Truck"].get("cargo"):
# There is a car in the truck actually
DarkShadowLocation = [-44.62, 960.8, 10]
Story["DarkShadow"] = Vehicle.Spawn("DarkShadowBox",
DarkShadowLocation,
[0,0,0],
color="pallete")
Vehicle.PackCargo(Story["Truck"], Story["DarkShadow"])
if "Paps" not in Story:
Story["Paps"] = Reuse.Create("PapsBox")
Story["Paps"].position = [-54.875, 972.66, 4.7383]
try:
Reuse.Delete(Story["Jack"])
del Story["Jack"]
except:pass
try:
Reuse.Delete(Story["Truck"])
del Story["Truck"]
except:pass
if "Jack" not in Story:
Story["Jack"] = Reuse.Create("JackBox")
Story["Jack"].position = [-52.875, 972.66, 4.7383]
# Paps coming to Dani
if 100 > Story["Paps"].getDistanceTo(dani) > 4:
Character_Controll.walkToward(Story["Paps"], dani)
# Not restoring Moria.
if Story.get("timer", 100): Story["timer"] = Story.get("timer", 100) - 1
else:
# Paps is telling Jack to go inside the truck.
if dani.getDistanceTo(Story["Paps"]) < 50 and "dialogue1" not in Story:
Story["dialogue1"] = PlayDialogue("d1", Story["Paps"])
# Paps emoting
if "dialogue1" in Story:
emotion_data = [
[[ 0.18 , 0.7 ], "Talk" ],
[[ 1.52 , 2.5 ], "Talk" ]
]
emote(Story["Paps"], emotion_data, Story["dialogue1"])
# When he finished talking Jack goes to the truck.
if "dialogue1" in Story and not Story["dialogue1"].status:
if Story["Jack"].get("driving") != Story["Truck"]:
Character_Controll.getIntoCar(Story["Jack"], Story["Truck"], passanger=True)
else:
Story["stage"] = 1
del Story["dialogue1"]
# Paps telling you how he wants you to hummiliate jack
if Story.get("stage") == 1:
# Paps coming to Dani
if "Paps" in Story:
if 100 > Story["Paps"].getDistanceTo(dani) > 4:
Character_Controll.walkToward(Story["Paps"], dani)
if "dialogue2" not in Story:
Story["dialogue2"] = PlayDialogue("brief", Story["Paps"])
# Paps emoting
if "dialogue2" in Story:
emotion_data = [
[[ 0.0 , 0.8 ], "Talk" ],
[[ 2.6 , 3.5 ], "Talk" ],
[[ 4.7 , 12.7 ], "Talk" ],
[[ 14.1 , 15.4 ], "Talk" ],
[[ 17.3 , 20.303 ], "Talk" ],
[[ 21.37 , 27 ], "Talk" ],
[[ 28.5 , 34.6 ], "Talk" ],
[[ 36.6 , 37.6 ], "Talk" ],
[[ 38.3 , 40.0 ], "Talk" ],
]
emote(Story["Paps"], emotion_data, Story["dialogue2"])
if "dialogue2" in Story and not Story["dialogue2"].status:
Story["stage"] = 2
del Story["dialogue2"]
bge.logic.globalDict["print"] = "Get the truck home!"
# Now you are faced with the choice to either get the truck or
# continue doing some stupid stuff.
if Story.get("stage") == 2:
# Mapping the truck on the map
Map.Show(Story["Truck"], color=[0,0,1])
# If you sit in the truck the mission begins.
if dani.get("driving") == Story["Truck"]:
dani["race"] = Story["currentEvent"]
Story["stage"] = 3
Story["timer"] = 500
pointer.visible = True
if Story.get("stage") == 3:
# Mapping the house
Map.Show(house, icon="Map_Circle", color=[1,0.8,0])
# Point to the house
tocheck = pointer.getVectTo(house)
pointer.alignAxisToVect(tocheck[1], 1, 0.1)
pointer.alignAxisToVect( (0,0,1), 2, 1.0 )
# If Truck blows up you loose
if Story["Truck"].get("blown"):
bge.logic.globalDict["print"] = "Mission failed! You broke the truck."
dani["race"] = ""
del Story["stage"]
try:
Reuse.Delete(Story["Paps"])
del Story["Paps"]
except:pass
pointer.visible = False
if "dialogue3" in Story:
Story["dialogue3"].stop()
if "dialogue4" in Story:
Story["dialogue4"].stop()
# Jack telling his side of the story.
if Story["timer"]: Story["timer"] -= 1
else:
if "dialogue3" not in Story and ( not Story["Jack"].get("saying") or not Story["Jack"]["saying"].status ):
Story["dialogue3"] = PlayDialogue("d2")
Story["Jack"]["saying"] = Story["dialogue3"]
# Jack emoting
if "dialogue3" in Story:
emotion_data = [
[[ 4.2 , 4.7 ], "Talk" ],
[[ 10 , 10.5 ], "Laugh" ],
]
emote(dani, emotion_data, Story["dialogue3"])
emotion_data = [
[[ 0.1 , 0.8 ], "Talk" ],
[[ 1.2 , 3.7 ], "Talk" ],
[[ 6.5 , 7.1 ], "Talk" ],
[[ 8.3 , 10.1 ], "Talk" ],
[[ 11.3 , 14.8 ], "Talk" ],
[[ 15.4 , 17.3 ], "Talk" ],
[[ 18.6 , 22.1 ], "Talk" ],
[[ 23.5 , 25.1 ], "Talk" ],
[[ 26.3 , 30.2 ], "Talk" ],
[[ 30.9 , 31.8 ], "Talk" ],
[[ 32.5 , 33.7 ], "Talk" ],
[[ 34.6 , 38.5 ], "Talk" ],
[[ 39.6 , 41.6 ], "Talk" ],
]
emote(Story["Jack"], emotion_data, Story["dialogue3"])
# If Jack told his story and we are close enough to the house
if "dialogue3" in Story and not Story["dialogue3"].status:
# Jack tells changes the mission
if Story["Truck"].getDistanceTo(house) < 450:
if "dialogue4" not in Story and ( not Story["Jack"].get("saying") or not Story["Jack"]["saying"].status ):
Story["dialogue4"] = PlayDialogue("twist")
Story["Jack"]["saying"] = Story["dialogue4"]
# Jack emoting
if "dialogue4" in Story:
emotion_data = [
[[ 3.4 , 3.7 ], "Talk" ],
[[ 9.8 , 10.2 ], "Talk" ],
]
emote(dani, emotion_data, Story["dialogue4"])
emotion_data = [
[[ 0.1 , 0.5 ], "Talk" ],
[[ 1.1 , 1.8 ], "Talk" ],
[[ 2.2 , 3.0 ], "Talk" ],
[[ 4.3 , 5.0 ], "Talk" ],
[[ 5.5 , 7.9 ], "Talk" ],
[[ 8.4 , 9.6 ], "Talk" ],
]
emote(Story["Jack"], emotion_data, Story["dialogue4"])
if "dialogue4" in Story and not Story["dialogue4"].status:
del Story["dialogue3"]
del Story["dialogue4"]
Story["stage"] = 4
# Unlocking the race in the middle of this
Story["start_race"] = True
if Story.get("stage") == 4:
racepos = [-254.4, -508.1, 189.2]
# No need to show the race on the map, since it
# will temporarily unlocked and that will make
# the standard system show it on the map.
# Point to the race
tocheck = pointer.getVectTo(racepos)
pointer.alignAxisToVect(tocheck[1], 1, 0.1)
pointer.alignAxisToVect( (0,0,1), 2, 1.0 )
# If Truck blows up you loose
if Story["Truck"].get("blown"):
bge.logic.globalDict["print"] = "Mission failed! You broke the truck."
dani["race"] = ""
del Story["stage"]
try:
Reuse.Delete(Story["Paps"])
del Story["Paps"]
except:pass
pointer.visible = False
if Story["Truck"].getDistanceTo(racepos) < 70:
bge.logic.globalDict["print"] = "Press D to unload the car."
if not Story["DarkShadow"].get("isCargo"):
Story["stage"] = 5
Character_Controll.getOutCar(Story["Jack"])
pointer.visible = False
# Jack goes into the car that you've brought.
if Story.get("stage") == 5:
if Story["Jack"].get("driving") != Story["DarkShadow"]:
Character_Controll.getIntoCar(Story["Jack"], Story["DarkShadow"], passanger=True)
# else:
# Story["stage"] = 6
Story["02_Bring_Truck_To_House"] = scene
# Mission: Deliver the Truck with Jack to the house.
# Twist : Jack will want you to turn away from the challenge. To end up
# on a race not so far away from the house.
##############################################################################
# Mission: Race not so far away from the house.
# Twist : Paps notices you race, since he and moria are back from her training.
# He is mad because you drove like an idiot and broke the car.
##############################################################################
# Mission : The Mansion Race.
# Challenge: Not to break the car.
##############################################################################
# Mission : One of the drivers from the last race invites you to race
# like an idiot ( Pito's Statue Race ).

196
Scripts/Settings.py Normal file
View file

@ -0,0 +1,196 @@
# Gplv3 or any later version
# (C) J.Y.Amihud 2024
import os
import json
# Those modules don't work everywhere
try:
import bge
import bpy
from Scripts import Main_update
from Scripts import Script
from Scripts import Money
from Scripts import Garage
from Scripts import Character_Controll
from Scripts import Vehicle
from Scripts.Common import *
except:
pass
def get_settings_folder():
game = "danisrace"
try:
data_dir = os.environ["XDG_DATA_HOME"] + "/" + game
except:
data_dir = os.path.expanduser("~/.local/share/"+game)
try:
os.makedirs(data_dir)
except:
pass
return data_dir
def load_settings():
folder = get_settings_folder()
f = folder+"/config.json"
try:
with open(f) as o:
return json.load(o)
except: return {}
def Execute():
# This function will execute the various settings inside of the game
data = load_settings()
if not data: return
scene = bge.logic.getCurrentScene()
# SHADOWS
for obj in scene.lights:
# Use Shadow
try: obj.blenderObject.data.use_shadow = data.get("shadows", True)
except: pass
# Use Contact Shadow
try: obj.blenderObject.use_contact_shadow = data.get("cntctshadows", True)
except: pass
# Softshadows
bpy.data.scenes["Scene"].eevee.use_soft_shadows = data.get("softshadows", True)
# Reflections
bpy.data.scenes["Scene"].eevee.use_ssr = data.get("reflections", True)
# Samples TODO figure it out
bpy.data.scenes["Scene"].eevee.taa_render_samples = data.get("samples", 1)
# Volume samples
bpy.data.scenes["Scene"].eevee.volumetric_samples = data.get("volumesamples", 32)
# Compositor
if data.get("compositor"):
bpy.context.space_data.shading.use_compositor = 'ALWAYS'
else:
bpy.context.space_data.shading.use_compositor = 'DISABLED'
# Skin samples
bpy.data.scenes["Scene"].eevee.sss_samples = data.get("skinsamples", 5)
# Volume shadows
bpy.data.scenes["Scene"].eevee.use_volumetric_shadows = data.get("volumeshadow", False)
# Volume lights
bpy.data.scenes["Scene"].eevee.use_volumetric_lights = data.get("volumelight", True)
# Volume shadows samp
bpy.data.scenes["Scene"].eevee.volumetric_shadow_samples = data.get("volshadsampl", 3)
# Cube Shadow res
bpy.data.scenes["Scene"].eevee.shadow_cube_size = data.get("shadowslamps", "512")
# Sun shadow res
bpy.data.scenes["Scene"].eevee.shadow_cascade_size = data.get("shadowssun", "1024")
# Logic Steps
#bge.logic.setMaxLogicFrame(100)
# Controlls
controlmap = {
"veh_forward" :"forward",
"veh_backward" :"backward",
"veh_left" :"left",
"veh_right" :"right",
"veh_drift" :"drift",
"veh_nitro" :"nitro",
"veh_resque" :"resque",
"veh_gear_up" :"gearup",
"veh_gear_down":"geardown",
"veh_auto_gear":"autogear",
"veh_dynamcam" :"dynamcam",
"veh_upload" :"unload",
"chr_forward" :"forward",
"chr_backward" :"backward",
"chr_left" :"left",
"chr_right" :"right",
"chr_jump" :"jump",
"chr_get_car" :"getcar",
"chr_swimdown" :"swimdown"
}
for control in controlmap:
if control.startswith("chr"): folder = bge.logic.globalDict["chr_controls"]
else: folder = bge.logic.globalDict["veh_controls"]
try: folder[controlmap[control]] = keycodes[data[control]]
except Exception as e:
print("Error assigning controls",e)
def SaveGame():
# Let's generate the data to save.
data = {
"currentEvent" : Script.Story["currentEvent"],
"passedEvents" : Script.Story["passed"]
}
data["cars"] = Garage.Encode()
data["money"] = Money.Get()
data["inventory"] = Garage.inventory
data["time"] = bge.logic.globalDict["time"]
folder = get_settings_folder()
f = folder+"/save.json"
try:
with open(f, "w") as save:
json.dump(data, save, indent=4, sort_keys=True)
print(clr["bold"]+clr["tdgr"]+"Game saved!"+clr["norm"], f)
except Exception as e:
print(clr["bold"]+clr["tdrd"]+"Failed to save game:"+clr["norm"], e)
def LoadGame():
# loading game
folder = get_settings_folder()
f = folder+"/save.json"
try:
with open(f) as o:
data = json.load(o)
except Exception as e:
print("Couldn't Load Game:", e)
return
bge.logic.globalDict["garage-saved"] = data.get("cars", [])
Script.Story["currentEvent"] = data.get("currentEvent", "01_Bring_Neonspeedster_To_Racetrack")
Script.Story["passed"] = data.get("passedEvents", [])
Money.Set(data.get("money", 0.0))
Garage.inventory = data.get("inventory", {})
Garage.UpdateShelfs()
bge.logic.globalDict["start-time"] = data.get("time")

456
Scripts/Tools.py Normal file
View file

@ -0,0 +1,456 @@
# GPLv3 or any later version
# (C) J.Y.Amihud ( blenderdumbass )
# This file will dealwith tools and stuff.
import bge
import bpy
import aud
import math
import mathutils
from Scripts import Reuse
from Scripts.Common import *
from Scripts import Vehicle
from Scripts import Script
from Scripts import Garage
def MainLoop():
keys = bge.logic.globalDict["keys"]
mouse = bge.logic.globalDict["mouse"]
scene = bge.logic.getCurrentScene()
dani = scene.objects["Dani_Box"]
if dani.get("driving"):
return
camera = scene.active_camera
hand = scene.objects["Tool_Hand"]
hc = scene.objects["Health_Circle"]
box = scene.objects["Boxify"]
if box.get("timer"): box["timer"] -= 1
else: box.position = [0,0,-1000]
# If dani is using a fix tool
if str(dani.get("tool")) == "FixTool":
dis = 10000
car = None
for thecar in bge.logic.globalDict["allcars"]:
cd = thecar.getDistanceTo(dani)
if cd < dis:
dis = cd
car = thecar
ray = DaniPoint(dani, camera)
found = False
if car:
# First we gonna create a list of all objects
# that the car can get fixed.
attachment = dani.get("tool-attachment")
objs = []
if not Vehicle.OnGround(car):
objs = [car]
for wheel in car["wheels"]:
if ( wheel.visible and not attachment ) or attachment == "Wheels" :
objs.append(wheel)
for door in car.get("doors", []):
if ( door.visible and not attachment ) or attachment == "Parts" :
objs.append(door)
if "NitroCanProxy" in car.childrenRecursive and\
(( not car.get("NitroCan") and attachment == "Nitros") or ( car.get("NitroCan") and not attachment )):
objs.append(car.childrenRecursive["NitroCanProxy"])
if "SpoilerProxy" in car.childrenRecursive and\
( ( not car.get("Spoiler") and "Spoiler" in str(attachment) ) or ( car.get("Spoiler") and not attachment )):
objs.append(car.childrenRecursive["SpoilerProxy"])
if ray[1]:
point = ray[1]
d = 10
c = None
for obj in objs:
od = obj.getDistanceTo(point)
if od < d:
d = od
c = obj
if c:
found = True
if c not in car["wheels"]:
center = Boxify(c)
else:
center = Boxify(c, True)
text = ""
if c in car["wheels"]:
text = "Wheel"
elif str(c) == "NitroCanProxy":
text = "Nitros"
elif "Spoiler" in str(c):
text = "Spoiler"
elif c == car:
text = "Engine and Chassis"
elif c in car["doors"]:
text = "Bodywork"
orange = range(len(text))
text = text + "\n" + str(int(round(c.get("health", 1.0)*100)))+"%"
Script.StatusText(text, orange)
# Activate the tool
if mousecodes["LMB"] in mouse:
FixToolSound()
if str(c) == "NitroCanProxy":
Vehicle.AddNitroCan(car)
dani["tool-attachment"] = None
car["nitro"] = 10.0
if str(c) == "SpoilerProxy" and attachment:
spoilertype = Garage.shop.get(attachment, {}).get("usemodel")
Vehicle.AddSpoiler(car, spoilertype)
dani["tool-attachment"] = None
c["health"] = c.get("health", 1.0) + 0.01
if c["health"] >= 1.0:
c["health"] = 1.0
# Replacing mesh, to looks nice.
if c.get("Good"):
c.replaceMesh(c.get("Good"))
# Doors
if c in car["doors"]:
c["locked"] = True
rot = door.orientation.to_euler()
for i in range(3):
if i == door.get("axis",2):
rot[i] = door.get("lockat", 0)
else:
rot[i] = 0
c.orientation = rot
c.suspendPhysics()
door.orientation = rot
if c == car:
Vehicle.ChangeBody(car, good=True)
if c == car:
car["blown"] = False
if c["health"] > 0.1:
if not c.visible:
dani["tool-attachment"] = None
c.visible = True
# Removing parts
if mousecodes["RMB"] in mouse:
FixToolSound()
# Removing spoilers
if str(c) == "SpoilerProxy" and not attachment:
spoilertype = Vehicle.RemoveSpoiler(car)
for name in Garage.shop:
item = Garage.shop[name]
if item.get("usemodel") == spoilertype:
dani["tool-attachment"] = name
# Removing nitros
if str(c) == "NitroCanProxy" and not attachment:
Vehicle.RemoveNitroCan(car)
dani["tool-attachment"] = "Nitros"
# Removing bodywork
if c in car["doors"] and not attachment:
c["health"] = 0.0
c.visible = False
dani["tool-attachment"] = "Parts"
# Removing wheels
elif c in car["wheels"] and not attachment:
c["health"] = 0.0
c.visible = False
dani["tool-attachment"] = "Wheels"
# Shelf
if not found:
tool = dani["tool"]
closest = 5
theitem = ""
themodel = None
for name in Garage.inventory:
amount = Garage.inventory[name]
item = Garage.shop.get(name, {})
model = item.get('model')
if model: model= scene.objects[model]
if ( amount or name == dani.get("tool-attachment") ) and model:
d = dani.getDistanceTo(model)
if d < closest:
closest = d
theitem = name
themodel = model
if themodel:
name = theitem
amount = Garage.inventory[name]
item = Garage.shop.get(name, {})
printname = item.get("name", name)
Boxify(themodel)
Script.StatusText(printname+"\nIn Stock: "+str(amount), range(len(printname)))
if mousecodes["LMB"] in mouse and not tool.get("active-timer"):
tool["active-timer"] = 30
print("pressed", dani.get("tool-attachment"))
if not dani.get("tool-attachment"):
dani["tool-attachment"] = name
Garage.Use(name)
else:
name = dani["tool-attachment"]
if name not in Garage.inventory: Garage.inventory[name] = 1
else: Garage.inventory[name] += 1
Garage.UpdateShelfs()
dani["tool-attachment"] = None
if tool.get("active-timer"): tool["active-timer"] -= 1
# Tool attachment
if dani.get("tool-attachment"):
name = dani["tool-attachment"]
item = Garage.shop.get(name, {})
usemodel = item.get("usemodel")
if not dani.get("tool-attachment-model") and usemodel:
dani["tool-attachment-model"] = Reuse.Create(usemodel)
dani["tool-attachment-model"].suspendPhysics()
dani["tool-attachment-model"].blenderObject["MainColor"] = [1.000000, 0.008796, 0.000000]
dani["tool-attachment-model"].blenderObject["SecondaryColor"] = [1.000000, 0.500000, 0.000000]
s = item.get("usescale", 1)
dani["tool-attachment-model"].scaling = [s,s,s]
else:
usemodel = dani["tool-attachment-model"]
usemodel.position = Vehicle.RelativePoint(dani, (-0.5,-0.5,0.5))
usemodel.applyRotation((0.03,-0.01,0.05),False)
elif dani.get("tool-attachment-model"):
Reuse.Delete(dani["tool-attachment-model"])
dani["tool-attachment-model"] = None
# If dani is using a paint tool
elif str(dani.get("tool")) == "PaintTool":
ray = DaniPoint(dani, camera)
tool = dani["tool"]
if ray[0] in bge.logic.globalDict["allcars"]:
car = ray[0]
Boxify(car)
if mousecodes["LMB"] in mouse:
PaintToolSound()
if not tool.get("active-timer"):
Vehicle.SmartColor(car, "pallete")
tool["active-timer"] = 30
elif mousecodes["RMB"] in mouse:
PaintToolSound()
if not tool.get("active-timer"):
Vehicle.SmartColor(car)
tool["active-timer"] = 30
if tool.get("active-timer"): tool["active-timer"] -= 1
def UpdateTool(tool):
tool = tool.owner
scene = bge.logic.getCurrentScene()
dani = scene.objects["Dani_Box"]
hand = scene.objects["Tool_Hand"]
box = scene.objects["Boxify"]
icon = scene.objects["Dani_Tool_Icon"]
if "taken" not in tool:
tool["taken"] = None
tool["wasat"] = tool.position.copy()
if not tool["taken"]:
if dani.getDistanceTo(tool["wasat"]) < 2 and not tool.get("timer") and not dani.get("tool"):
tool["taken"] = dani
tool["timer"] = 100
dani["tool"] = tool
tool.position = hand.position
tool.orientation = hand.orientation
tool.setParent(hand, True)
icon.blenderObject["raw"] = tool.get("icon_raw", 1)
icon.blenderObject["column"] = tool.get("icon_column", 0)
tool.applyRotation([0,0,0.1], False)
elif dani.getDistanceTo(tool["wasat"]) < 2 and not tool.get("timer"):
tool["taken"] = None
tool["timer"] = 100
dani["tool"] = None
box.position = [0,0,-1000]
tool.removeParent()
tool.position = tool["wasat"]
tool.orientation = [0,0,0]
Script.StatusText(" ")
icon.blenderObject["raw"] = 1
icon.blenderObject["column"] = 0
if tool.get("timer"): tool["timer"] -= 1
def Boxify(obj, orcenter=False):
# This function will draw a box around the object
scene = bge.logic.getCurrentScene()
box = scene.objects["Boxify"]
box["timer"] = 10
if not orcenter:
# Finding bounding box
bbox = obj.blenderObject.bound_box
# finding the center of the box
center = 0.125 * sum((mathutils.Vector(b) for b in bbox), mathutils.Vector())
center.rotate(obj.orientation)
center * obj.scaling
center = obj.position + center
box.position = center
else:
box.position = obj.position
center = obj.position
box.orientation = obj.orientation
box.scaling = obj.blenderObject.dimensions
return center
def DaniPoint(dani, camera):
# Then we want to see if any of them are pointed at
fro = dani.position.copy()
fro.z += 1
to = fro.copy()
to.z -= 1
to -= fro
to.rotate(camera.worldOrientation.to_euler())
to += fro
ray = Vehicle.BeautyRayCast(dani, "tool", to, fro, dist=5)
return ray
#### SOUNDS #####
def FixToolSound():
# Engine Sound
device = bge.logic.globalDict["SoundDevice"]
code = "//sfx/fixtool.ogg"
if code not in bge.logic.globalDict["sounds"]:
bge.logic.globalDict["sounds"][code] = {"sound":aud.Sound(bge.logic.expandPath(code)),
"play":None}
sound = bge.logic.globalDict["sounds"][code]
if not sound["play"] or not sound["play"].status:
sound["play"] = device.play(sound["sound"])
sound["play"].volume = 1
def PaintToolSound():
# Engine Sound
device = bge.logic.globalDict["SoundDevice"]
code = "//sfx/painttool.ogg"
if code not in bge.logic.globalDict["sounds"]:
bge.logic.globalDict["sounds"][code] = {"sound":aud.Sound(bge.logic.expandPath(code)),
"play":None}
sound = bge.logic.globalDict["sounds"][code]
if not sound["play"] or not sound["play"].status:
sound["play"] = device.play(sound["sound"])
sound["play"].volume = 1

4356
Scripts/Vehicle.py Normal file

File diff suppressed because it is too large Load diff

BIN
SettingUI/banner.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 484 KiB

BIN
SettingUI/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 377 KiB

BIN
SettingUI/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

View file

@ -0,0 +1,61 @@
{
"Talk":{
"Action":"DaniEmotions",
"Frames":[0, 10],
"kwargs":{"layer":3}
},
"Laugh":{
"Action":"DaniEmotions",
"Frames":[10, 20],
"kwargs":{"layer":3}
},
"Stand":{
"Frames":[0, 290]
},
"Walk":{
"Frames":[301, 313]
},
"Drive":{
"Frames":[330,330]
},
"Swim":{
"Frames":[340,353]
},
"Fly":{
"Frames":[358,371],
"kwargs":{"priority":-1,
"blendin":5}
},
"Hang":{
"Frames":[390,390],
"kwargs":{"priority":-1}
},
"Land":{
"Frames":[371,384],
"kwargs":{"priority":-1}
},
"AnswerPhone":{
"Action":"DanisPhone",
"Frames":[32, 100],
"kwargs":{"layer":2},
"Keep":true
},
"PutPhoneAway":{
"Action":"DanisPhone",
"Frames":[0, 32],
"kwargs":{"layer":2}
}
}

21
animdata/chr/JackBox.json Normal file
View file

@ -0,0 +1,21 @@
{
"Stand":{
"Frames":[0,300]
},
"Walk":{
"Frames":[330, 350]
},
"Drive":{
"Frames":[360,361]
},
"Talk":{
"Action":"JackTalk",
"Frames":[0, 20],
"kwargs":{"layer":3}
}
}

View file

@ -0,0 +1,14 @@
{
"Stand":{
"Frames":[0,276]
},
"Walk":{
"Frames":[300, 320]
},
"Drive":{
"Frames":[325,325]
}
}

17
animdata/chr/PapsBox.json Normal file
View file

@ -0,0 +1,17 @@
{
"Walk":{
"Frames":[301, 330]
},
"Stand":{
"Frames":[0, 290]
},
"Talk":{
"Action":"PapsTalk",
"Frames":[0, 10],
"kwargs":{"layer":3}
}
}

BIN
assembly.blend Normal file

Binary file not shown.

BIN
ast/loc/City_source.blend Normal file

Binary file not shown.

BIN
ast/loc/city.blend Normal file

Binary file not shown.

BIN
ast/loc/textures/Ground.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 MiB

BIN
ast/loc/textures/ads.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 MiB

BIN
ast/loc/textures/bush.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 159 KiB

BIN
ast/loc/textures/cliff.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 664 KiB

BIN
ast/loc/textures/dirt.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

BIN
ast/loc/textures/sings.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 KiB

BIN
ast/veh/DarkShadow.blend Normal file

Binary file not shown.

BIN
ast/veh/HatchBack01.blend Normal file

Binary file not shown.

BIN
ast/veh/NeonSpeedster.blend Normal file

Binary file not shown.

BIN
ast/veh/RedKiss.blend Normal file

Binary file not shown.

BIN
ast/veh/Truck.blend Normal file

Binary file not shown.

View file

@ -0,0 +1,62 @@
# MACHINE GENERATED
import bge, bpy, sys, importlib
import mathutils
from uplogic import nodes
import math
def _initialize(owner):
network = nodes.LogicNetwork()
CON0000 = nodes.ConditionOnce()
ACT0001 = nodes.VehicleSetAttributes()
ACT0002 = nodes.ActionCreateVehicleFromParent()
ACT0003 = nodes.VehicleApplyForce()
CON0004 = nodes.ConditionKeyPressed()
CON0000.input_condition = False
CON0000.repeat = False
CON0000.reset_time = 0.5
ACT0001.condition = ACT0002.OUT
ACT0001.constraint = ACT0002.VEHICLE
ACT0001.wheelcount = 4
ACT0001.set_suspension_compression = False
ACT0001.suspension_compression = 0.0
ACT0001.set_suspension_stiffness = False
ACT0001.suspension_stiffness = 0.0
ACT0001.set_suspension_damping = False
ACT0001.suspension_damping = 0.0
ACT0001.set_tyre_friction = False
ACT0001.tyre_friction = 0.0
ACT0001.value_type = 'REAR'
ACT0002.condition = CON0000
ACT0002.game_object = "NLO:RedKissBox"
ACT0002.suspension = 0.05999999865889549
ACT0002.stiffness = 50.0
ACT0002.damping = 5.0
ACT0002.friction = 2.0
ACT0002.wheel_size = 1.0
ACT0003.condition = CON0004
ACT0003.vehicle = "NLO:RedKissBox"
ACT0003.wheelcount = 2
ACT0003.power = 1.0
ACT0003.value_type = 'REAR'
CON0004.key_code = bge.events.WKEY
CON0004.pulse = True
network.add_cell(CON0000)
network.add_cell(ACT0002)
network.add_cell(CON0004)
network.add_cell(ACT0001)
network.add_cell(ACT0003)
owner["IGNLTree_NodeTree"] = network
network._owner = owner
network.setup()
network.stopped = not owner.get('NL__NodeTree')
return network
def pulse_network(controller):
owner = controller.owner
network = owner.get("IGNLTree_NodeTree")
if network is None:
network = _initialize(owner)
if network.stopped: return
shutdown = network.evaluate()
if shutdown is True:
controller.sensors[0].repeat = False

View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

BIN
ast/veh/textures/map.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
ast/veh/textures/screen.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

62
bgelogic/NLNodeTree.py Normal file
View file

@ -0,0 +1,62 @@
# MACHINE GENERATED
import bge, bpy, sys, importlib
import mathutils
from uplogic import nodes
import math
def _initialize(owner):
network = nodes.LogicNetwork()
CON0000 = nodes.ConditionOnce()
ACT0001 = nodes.VehicleSetAttributes()
ACT0002 = nodes.ActionCreateVehicleFromParent()
ACT0003 = nodes.VehicleApplyForce()
CON0004 = nodes.ConditionKeyPressed()
CON0000.input_condition = False
CON0000.repeat = False
CON0000.reset_time = 0.5
ACT0001.condition = ACT0002.OUT
ACT0001.constraint = ACT0002.VEHICLE
ACT0001.wheelcount = 4
ACT0001.set_suspension_compression = False
ACT0001.suspension_compression = 0.0
ACT0001.set_suspension_stiffness = False
ACT0001.suspension_stiffness = 0.0
ACT0001.set_suspension_damping = False
ACT0001.suspension_damping = 0.0
ACT0001.set_tyre_friction = False
ACT0001.tyre_friction = 0.0
ACT0001.value_type = 'REAR'
ACT0002.condition = CON0000
ACT0002.game_object = "NLO:RedKissBox"
ACT0002.suspension = 0.05999999865889549
ACT0002.stiffness = 50.0
ACT0002.damping = 5.0
ACT0002.friction = 2.0
ACT0002.wheel_size = 1.0
ACT0003.condition = CON0004
ACT0003.vehicle = "NLO:RedKissBox"
ACT0003.wheelcount = 2
ACT0003.power = 1.0
ACT0003.value_type = 'REAR'
CON0004.key_code = bge.events.WKEY
CON0004.pulse = True
network.add_cell(CON0000)
network.add_cell(ACT0002)
network.add_cell(CON0004)
network.add_cell(ACT0001)
network.add_cell(ACT0003)
owner["IGNLTree_NodeTree"] = network
network._owner = owner
network.setup()
network.stopped = not owner.get('NL__NodeTree')
return network
def pulse_network(controller):
owner = controller.owner
network = owner.get("IGNLTree_NodeTree")
if network is None:
network = _initialize(owner)
if network.stopped: return
shutdown = network.evaluate()
if shutdown is True:
controller.sensors[0].repeat = False

0
bgelogic/__init__.py Normal file
View file

View file

@ -0,0 +1,43 @@
{
"name":"Dark Shadow",
"probability":1,
"type":"race-car",
"material":{"MainColor" :[0.033096, 0.033096, 0.033096],
"SecondaryColor":[1.000000, 0.147027, 0.000000]},
"wheels":[
{ "radius":0.425, "xyz":[ 0.915, -1.427, -0.150], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":true , "object":""},
{ "radius":0.425, "xyz":[-0.915, -1.427, -0.150], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":true , "object":".001"},
{ "radius":0.425, "xyz":[-0.915, 1.184, -0.150], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":false, "object":".003"},
{ "radius":0.425, "xyz":[ 0.915, 1.184, -0.150], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":false, "object":".002"}
],
"mass" : 1993 ,
"hp" : 610 ,
"torque" : 100 ,
"drag" : 0.5 ,
"roll" : -0.4 ,
"grip" : 0.3 ,
"maxturn" : 0.8 ,
"brakes" : 2.0 ,
"abs" : 0.01 ,
"downforce" : 2.0 ,
"suspention" : 100.0 ,
"suspentionDamping" : 0.8 ,
"maxrpm" : 8000 ,
"idle" : 1100 ,
"redline" : 6000 ,
"gears":[
5.00,
3.00,
2.00,
1.00,
0.75,
0.50,
0.25,
0.20,
0.15
]
}

View file

@ -0,0 +1,35 @@
{
"name":"Hatchback Model 1",
"probability":10,
"type":"street-car",
"wheels":[
{ "radius":0.383, "xyz":[ 0.919, -1.519, -0.200], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":true , "object":""},
{ "radius":0.383, "xyz":[-0.919, -1.519, -0.200], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":true , "object":".001"},
{ "radius":0.383, "xyz":[-0.919, 1.522, -0.200], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":false, "object":".003"},
{ "radius":0.383, "xyz":[ 0.919, 1.522, -0.200], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":false, "object":".002"}
],
"mass" : 1993 ,
"hp" : 50 ,
"torque" : 50 ,
"drag" : 1.5 ,
"roll" : 0.4 ,
"grip" : 0.1 ,
"maxturn" : 0.8 ,
"brakes" : 1.0 ,
"abs" : 0.1 ,
"downforce" : 0.5 ,
"suspention" : 50.0 ,
"suspentionDamping" : 0.8 ,
"maxrpm" : 6000 ,
"idle" : 1100 ,
"redline" : 5000 ,
"gears":[
5.00,
2.00,
1.00,
0.50
]
}

View file

@ -0,0 +1,43 @@
{
"name":"Neonspeedster",
"probability":1,
"type":"race-car",
"material":{"MainColor" :[0.051525, 0.514757, 1.000000],
"SecondaryColor":[0.051525, 0.514757, 1.000000]},
"wheels":[
{ "radius":0.42, "xyz":[ 0.89, -1.25, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":true , "object":""},
{ "radius":0.42, "xyz":[-0.89, -1.25, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":true , "object":".001"},
{ "radius":0.42, "xyz":[-0.89, 1.65, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":false, "object":".003"},
{ "radius":0.42, "xyz":[ 0.89, 1.65, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":false, "object":".002"}
],
"mass" : 1800 ,
"hp" : 600 ,
"torque" : 120 ,
"drag" : 0.25 ,
"roll" : -0.4 ,
"grip" : 0.3 ,
"maxturn" : 0.8 ,
"brakes" : 2.0 ,
"abs" : 0.01 ,
"downforce" : 2.0 ,
"suspention" : 200.0 ,
"suspentionDamping" : 0.6 ,
"maxrpm" : 8000 ,
"idle" : 1100 ,
"redline" : 6000 ,
"gears":[
5.00,
3.00,
2.00,
1.00,
0.75,
0.50,
0.25,
0.20,
0.15
]
}

43
cardata/RedKissBox.json Normal file
View file

@ -0,0 +1,43 @@
{
"name":"Red Kiss",
"probability":1,
"type":"race-car",
"material":{"MainColor" :[1.000000, 0.008796, 0.000000],
"SecondaryColor":[1.000000, 0.500000, 0.000000]},
"wheels":[
{ "radius":0.469, "xyz":[ 0.959, -1.333, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":true , "object":""},
{ "radius":0.469, "xyz":[-0.959, -1.333, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":true , "object":".001"},
{ "radius":0.469, "xyz":[-0.959, 1.538, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":false, "object":".003"},
{ "radius":0.469, "xyz":[ 0.959, 1.538, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":false, "object":".002"}
],
"mass" : 1800 ,
"hp" : 580 ,
"torque" : 120 ,
"drag" : 0.25 ,
"roll" : -0.4 ,
"grip" : 0.2 ,
"maxturn" : 0.8 ,
"brakes" : 2.0 ,
"abs" : 0.01 ,
"downforce" : 2.0 ,
"suspention" : 200.0 ,
"suspentionDamping" : 0.6 ,
"maxrpm" : 8000 ,
"idle" : 1100 ,
"redline" : 6000 ,
"gears":[
5.00,
3.00,
2.00,
1.00,
0.75,
0.50,
0.25,
0.20,
0.15
]
}

53
cardata/TruckBox.json Normal file
View file

@ -0,0 +1,53 @@
{
"name":"Truck",
"probability":0,
"type":"truck",
"wheels":[
{ "radius":0.565, "xyz":[ 1.19, -3.36, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":true , "object":""},
{ "radius":0.565, "xyz":[-1.19, -3.36, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":true , "object":".001"},
{ "radius":0.565, "xyz":[-1.69, 3.03, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":false, "object":".003"},
{ "radius":0.565, "xyz":[ 1.69, 3.03, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":false, "object":".002"},
{ "radius":0.565, "xyz":[-1.69, 4.22, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":false, "object":".004"},
{ "radius":0.565, "xyz":[ 1.69, 4.22, -0.100], "down":[0,0,-1], "axel":[-1,0,0], "suspensionRest": 0.2, "front":false, "object":".005"}
],
"mass" : 5000 ,
"hp" : 800 ,
"torque" : 50 ,
"drag" : 0.9 ,
"roll" : 0.4 ,
"grip" : 0.4 ,
"maxturn" : 0.8 ,
"brakes" : 2.0 ,
"abs" : 1.0 ,
"downforce" : 1.0 ,
"suspention" : 50.0 ,
"suspentionDamping" : 0.8 ,
"maxrpm" : 4000 ,
"idle" : 500 ,
"redline" : 3000 ,
"visionOffset" : -2 ,
"cameraZoom" : 5 ,
"gears":[
5.00,
4.00,
3.00,
2.50,
2.00,
1.50,
1.00,
0.85,
0.75,
0.65,
0.50,
0.35,
0.25,
0.23,
0.20,
0.15,
0.10
]
}

38
checklist.org Normal file
View file

@ -0,0 +1,38 @@
* Cars
** AI
*** Spawn System [4/4]
**** DONE Cars spawn all over the place
**** DONE Not enough cars
**** DONE Performace optimization
**** DONE Spawn Points Corrections [3/5]
- [X] Loop Around
- [X] To Racetrack
- [X] Through Sand
- [X] Deep Down
- [X] Small Round
*** AI NPC [6/6]
**** DONE Stupid driving
**** DONE Forward vision
**** DONE Avoid Going Into Walls
**** DONE Do not british
**** DONE Angry Pursuit
**** DONE Racing AI
** Controlls
*** Breaking system [1/2]
**** DONE Fix car tombling from breaking
**** TODO Fix the Handbrake, to feel better
** Camera
*** DONE Don't Roll if car is upside down
*** DONE While camera is in fly mode, track the target
*** TODO Avoid walls and stuff, to see car
* Characters
* Story
** 01_Bring_Neonspeedster_To_Racetrack [1/4]
*** DONE Paps rig
*** TODO Moria rig
*** TODO Jack rig
*** TODO Truck rig
**** TODO Make a drivable truck
**** TODO Make the thing work as truck
**** TODO See what can be removed
**** TODO Make it breakable.

BIN
fonts/Economica-Bold.ttf Normal file

Binary file not shown.

Binary file not shown.

BIN
fonts/Economica-Italic.ttf Normal file

Binary file not shown.

BIN
fonts/Economica-Regular.ttf Normal file

Binary file not shown.

94
fonts/OFL.txt Normal file
View file

@ -0,0 +1,94 @@
Copyright (c) 2012, Vicente Lamonaca (produccion.taller@gmail.com www.tipografia-montevideo.info www.tipotype.com),
with Reserved Font Name Economica.
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 540 KiB

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,79 @@
{
"speed": [
19.47047233581543 ,
28.695953369140625 ,
34.272308349609375 ,
22.839120864868164 ,
35.49073028564453 ,
36.18384552001953 ,
26.405841827392578 ,
36.80004119873047 ,
24.694549560546875 ,
32.90505599975586 ,
25.253585815429688 ,
23.290348052978516 ,
20.765544891357422 ,
29.06432342529297 ,
19.201831817626953 ,
48.21841812133789 ,
36.53797149658203 ,
17.104976654052734 ,
32.42231750488281 ,
29.689577102661133 ,
39.140628814697266 ,
46.942405700683594 ,
52.550262451171875 ,
61.05805206298828
],
"time":[
3.5653900100000016 ,
6.781268500000003 ,
8.587536806000003 ,
14.5922984 ,
18.244144163000005 ,
22.066794674000004 ,
25.262257287 ,
32.317976699 ,
35.964942449000006 ,
44.987977310000005 ,
51.12034587500001 ,
56.99959093000001 ,
60.769708648000005 ,
69.73444119000001 ,
71.18043171900001 ,
79.220370138 ,
81.71922719900002 ,
85.00884944 ,
88.32716642400001 ,
92.00067669300002 ,
94.979335297 ,
98.934810776 ,
101.61330894700001 ,
104.59028440000002
],
"rot":[
[-0.009425356984138489, -0.0032177797984331846, 2.6645872592926025] ,
[0.4339008331298828, 0.06504074484109879, 2.824570417404175] ,
[0.5393848419189453, -0.1043122187256813, 3.1088130474090576] ,
[-0.07354794442653656, -0.5006471872329712, -1.6698423624038696] ,
[-0.20410318672657013, -0.5391314029693604, -1.4937175512313843] ,
[-0.3626016676425934, -0.5246425271034241, -1.0846848487854004] ,
[-0.4815000891685486, -0.21434171497821808, -0.8064825534820557] ,
[0.013308639638125896, -0.15695986151695251, -0.5021470785140991] ,
[-0.6486340165138245, -0.5712481737136841, -0.900336503982544] ,
[-0.09834565967321396, -0.2213810682296753, -1.711607575416565] ,
[-0.4896208941936493, 0.010391822084784508, -1.1123923063278198] ,
[-0.10912516713142395, -0.20200513303279877, -0.6804932355880737] ,
[-0.3823515474796295, 0.15957728028297424, -0.527664303779602] ,
[0.09372024238109589, -0.017329612746834755, 0.5058645009994507] ,
[-0.030249271541833878, 0.26276054978370667, 0.06079315021634102] ,
[-0.1713239848613739, -0.002728884806856513, 1.0983858108520508] ,
[-0.005801045801490545, -0.02022010087966919, 0.7507718205451965] ,
[-0.4120676517486572, 0.6411003470420837, 0.5670502781867981] ,
[0.46784350275993347, 0.46227192878723145, 1.715516448020935] ,
[0.5550453662872314, 0.3693121075630188, 2.2164559364318848] ,
[0.3147442042827606, 0.16243435442447662, 2.825946092605591] ,
[0.004009793978184462, -0.004397588782012463, 2.702540397644043] ,
[0.28857335448265076, 0.1048942431807518, 2.883606433868408] ,
[0.3831179738044739, 0.08331694453954697, 2.975795269012451]
]}

View file

@ -0,0 +1,76 @@
{
"speed": [
26.358402252197266 ,
21.851234436035156 ,
22.34600830078125 ,
35.7989501953125 ,
26.217530250549316 ,
26.85378074645996 ,
33.8651123046875 ,
23.299406051635742 ,
22.026166915893555 ,
23.528913497924805 ,
26.148305892944336 ,
30.280473709106445 ,
23.370298385620117 ,
28.574520111083984 ,
29.749557495117188 ,
19.382225036621094 ,
36.2252197265625 ,
43.09573745727539 ,
46.76814270019531 ,
47.48198699951172 ,
50.24925994873047 ,
52.846805572509766 ,
30.805631637573242
],
"time":[
170.65272959100002 ,
172.79986740700002 ,
175.59592075900002 ,
178.357206599 ,
182.51325741 ,
186.291296247 ,
189.72518670600004 ,
192.36938303800002 ,
198.250241647 ,
201.33201389100003 ,
205.44794146200002 ,
209.12922035900004 ,
213.11044018900003 ,
219.506708898 ,
221.33645230900004 ,
225.15496903500002 ,
233.56188715400003 ,
235.41891638500005 ,
237.67381141600004 ,
240.81052518 ,
243.59788943300003 ,
246.41590875000003 ,
248.44874652100003
],
"rot":[
[-0.015924813225865364, 0.0011410210281610489, -0.4768390655517578] ,
[-0.010619524866342545, 0.006157155614346266, 0.819098711013794] ,
[-0.01246673334389925, 0.002614065306261182, 2.2400927543640137] ,
[-0.04152778163552284, -0.004130885470658541, 1.943183422088623] ,
[-0.04403195157647133, 0.08712327480316162, 2.8876852989196777] ,
[-0.029080595821142197, 0.13835664093494415, 2.829178810119629] ,
[0.08981640636920929, 0.15955263376235962, -2.9285950660705566] ,
[0.24162724614143372, -0.06017084792256355, 2.941547155380249] ,
[0.23552058637142181, -0.007189183495938778, 3.119412422180176] ,
[0.21812723577022552, -0.037734098732471466, 2.6612043380737305] ,
[-0.11147090047597885, -0.17597346007823944, 2.991697311401367] ,
[0.6546691656112671, -0.054870348423719406, -2.769106388092041] ,
[0.18609264492988586, -0.4377727508544922, -1.875230312347412] ,
[0.013437599875032902, -0.023461028933525085, -1.3867586851119995] ,
[0.13140811026096344, -0.08332643657922745, -1.9279202222824097] ,
[0.15664435923099518, 0.06593117117881775, -2.0268445014953613] ,
[-0.28711217641830444, 0.015364741906523705, 0.31375741958618164] ,
[-0.32474762201309204, -0.002328319475054741, 0.24374638497829437] ,
[-0.32376036047935486, -0.00781808141618967, 0.22786971926689148] ,
[-0.20297476649284363, 0.003622535616159439, 0.2503244876861572] ,
[-0.15761759877204895, -0.020702043548226357, 0.1932581514120102] ,
[-0.15772217512130737, 0.0015355173964053392, 0.25058653950691223] ,
[-0.13799037039279938, -0.017578350380063057, 0.1344577968120575]
]}

View file

@ -0,0 +1,160 @@
{
"speed": [
24.627269744873047 ,
47.092750549316406 ,
42.61936950683594 ,
37.54506301879883 ,
58.613258361816406 ,
68.0971450805664 ,
31.452539443969727 ,
43.356483459472656 ,
59.80781936645508 ,
47.419002532958984 ,
55.74909591674805 ,
58.8038330078125 ,
46.581756591796875 ,
30.18224334716797 ,
53.74342346191406 ,
61.3345947265625 ,
61.86671447753906 ,
21.49956512451172 ,
26.613754272460938 ,
37.49406051635742 ,
48.516029357910156 ,
55.17901611328125 ,
37.53427505493164 ,
17.593271255493164 ,
43.89397430419922 ,
54.7431640625 ,
18.800701141357422 ,
34.03715896606445 ,
29.884437561035156 ,
35.209720611572266 ,
44.17673873901367 ,
42.36854934692383 ,
23.197813034057617 ,
27.257816314697266 ,
47.857093811035156 ,
54.78614807128906 ,
64.80278778076172 ,
48.65629577636719 ,
60.77760696411133 ,
21.162349700927734 ,
85.32059478759766 ,
63.71363830566406 ,
45.5229377746582 ,
37.31787872314453 ,
40.94782257080078 ,
15.69291877746582 ,
52.7214241027832 ,
36.573299407958984 ,
13.764350891113281 ,
32.6483268737793 ,
49.86388397216797
],
"time":[
3.0355660160000006 ,
7.50188172 ,
11.229805571 ,
15.979854163999999 ,
19.161029008000003 ,
22.195561370000004 ,
29.374649738 ,
31.788481549 ,
36.221103097 ,
38.890305227 ,
45.323665559000005 ,
47.416093097 ,
52.92501264500001 ,
54.66389584500001 ,
61.283976491000004 ,
63.98905024800001 ,
65.123911546 ,
67.615446332 ,
71.97461295000001 ,
74.62498643200001 ,
77.40852643500001 ,
81.90872209800001 ,
85.40049763500001 ,
87.12826983900001 ,
93.41054448000001 ,
96.651941848 ,
99.944720712 ,
102.761049466 ,
105.41555318300001 ,
107.57172573900002 ,
115.534601545 ,
118.178148603 ,
119.04205402700002 ,
124.21186123600002 ,
127.666679868 ,
131.274512638 ,
133.828632973 ,
136.792306179 ,
139.015821643 ,
142.868449142 ,
149.555674804 ,
151.043801314 ,
156.667236127 ,
163.169707616 ,
166.0047752 ,
170.733802444 ,
175.361103648 ,
176.966964908 ,
178.758813312 ,
181.299940905 ,
184.953017273
],
"rot":[
[-0.05026862025260925, 0.08184890449047089, -0.8148138523101807] ,
[-0.1316002756357193, 0.0031764789018779993, -1.9675085544586182] ,
[0.26708489656448364, -0.06156376749277115, -2.7510504722595215] ,
[0.3162369728088379, 0.09000321477651596, 1.9450427293777466] ,
[0.3255309760570526, -0.010332695208489895, 1.873444676399231] ,
[0.2722633481025696, 0.024671392515301704, 1.7028207778930664] ,
[-0.005381275434046984, 0.15349845588207245, 0.8245863318443298] ,
[-0.011376403272151947, 0.014430257491767406, 0.8542606234550476] ,
[-0.0803285464644432, 9.974920249078423e-05, 1.2288496494293213] ,
[-0.07249549776315689, 0.08725707232952118, 1.8526216745376587] ,
[-0.10431861132383347, 0.04276389628648758, 1.8115432262420654] ,
[-0.062373124063014984, 0.2827167809009552, 1.517848253250122] ,
[0.2936558127403259, 0.24947433173656464, 2.574117422103882] ,
[0.02728387713432312, 0.14541742205619812, -2.128079414367676] ,
[0.019615476951003075, 0.0018755028722807765, -1.6218808889389038] ,
[-0.039600472897291183, -0.0001759183214744553, -1.4711010456085205] ,
[-0.013717529363930225, -0.00015236262697726488, -1.4960139989852905] ,
[0.010752955451607704, -0.011315465904772282, -1.9219878911972046] ,
[-0.2489994913339615, -0.005062761250883341, 0.41395682096481323] ,
[-0.1993929147720337, -0.015562037006020546, 0.3979560434818268] ,
[-0.22047235071659088, -0.10357409715652466, 0.32793688774108887] ,
[-0.19730879366397858, 0.002541373483836651, 0.19774995744228363] ,
[-0.1718272715806961, 0.032392289489507675, 0.2755044996738434] ,
[-0.13473595678806305, 0.05587274953722954, 1.063307285308838] ,
[-0.060322586447000504, -0.002062979619950056, 1.757095217704773] ,
[-0.059139054268598557, 0.010276955552399158, 1.913145661354065] ,
[-0.04730139300227165, 0.3112684488296509, -2.8238513469696045] ,
[-0.012114813551306725, 0.0024171662516891956, -2.4337821006774902] ,
[0.09516211599111557, -0.005561040714383125, -1.452688217163086] ,
[0.10693250596523285, -0.011977361515164375, -0.9787044525146484] ,
[-0.16203682124614716, 0.012190017849206924, 0.3146638572216034] ,
[-0.11242318898439407, -0.10967957228422165, -0.19336585700511932] ,
[-0.01968350261449814, -0.15010792016983032, -0.9864364862442017] ,
[-0.12329412251710892, 0.028628505766391754, -1.5601487159729004] ,
[-0.17669115960597992, -0.0020655354019254446, -1.347058653831482] ,
[-0.17644508183002472, 0.0009354822104796767, -1.3292815685272217] ,
[-0.3563596308231354, -0.09675119072198868, -1.5348401069641113] ,
[0.0772935226559639, -0.08689399063587189, -1.5763452053070068] ,
[0.01565294712781906, -0.007086094468832016, -1.6168186664581299] ,
[-0.4715840220451355, 0.7129260897636414, 2.9566893577575684] ,
[-0.207715705037117, 0.027285262942314148, -1.6732585430145264] ,
[-0.042232636362314224, -0.04647138714790344, -1.7285231351852417] ,
[0.023538127541542053, 1.1733207702636719, -2.571376085281372] ,
[0.14935921132564545, -0.056539710611104965, 2.851289749145508] ,
[0.2860586941242218, -0.09459391236305237, 2.2907943725585938] ,
[0.11912424117326736, 0.36828234791755676, 0.8598084449768066] ,
[0.20029667019844055, 0.14303922653198242, 1.5025924444198608] ,
[0.23549142479896545, -0.027062680572271347, 2.3216426372528076] ,
[0.16652050614356995, -0.39845919609069824, -2.6487646102905273] ,
[-0.021859584376215935, 0.005698161665350199, -2.2003278732299805] ,
[-0.21812351047992706, 0.07756779342889786, -1.7219876050949097]
]}

View file

@ -0,0 +1,175 @@
{
"speed": [
11.520125389099121 ,
35.4174919128418 ,
48.963592529296875 ,
59.18014907836914 ,
62.10212326049805 ,
48.34816360473633 ,
29.57212257385254 ,
32.26112747192383 ,
34.97370147705078 ,
18.7431640625 ,
24.274316787719727 ,
23.62272834777832 ,
20.690147399902344 ,
25.073972702026367 ,
33.980159759521484 ,
32.72504806518555 ,
20.377763748168945 ,
20.001949310302734 ,
21.908119201660156 ,
9.94851303100586 ,
13.313704490661621 ,
15.770674705505371 ,
18.543357849121094 ,
15.920366287231445 ,
21.7354793548584 ,
30.198137283325195 ,
36.15170669555664 ,
21.350290298461914 ,
27.91997528076172 ,
21.607690811157227 ,
22.180803298950195 ,
29.26111602783203 ,
27.72776985168457 ,
9.342388153076172 ,
19.195575714111328 ,
21.072982788085938 ,
4.100090980529785 ,
21.526302337646484 ,
28.333513259887695 ,
23.641836166381836 ,
9.200776100158691 ,
55.06287384033203 ,
53.451881408691406 ,
63.938533782958984 ,
61.43254089355469 ,
39.29024124145508 ,
55.41264724731445 ,
54.05284118652344 ,
37.15116882324219 ,
25.709457397460938 ,
29.141069412231445 ,
16.663942337036133 ,
21.69783592224121 ,
20.352880477905273 ,
26.29122543334961 ,
65.15868377685547
],
"time":[
6.4058701399999975 ,
16.299862351999998 ,
24.292330026000002 ,
29.082968635999997 ,
33.299860673 ,
36.303023109 ,
43.059633875 ,
46.018999336 ,
47.643505915 ,
51.02223038100001 ,
54.728302464 ,
58.199815298 ,
60.110697206000005 ,
63.448575584000004 ,
66.297977973 ,
68.88603403900001 ,
70.96493387199999 ,
72.02714741100002 ,
73.038448875 ,
74.848823218 ,
76.367119583 ,
78.58938322899999 ,
81.419440748 ,
85.20895058300002 ,
88.08085490100001 ,
90.03782245400001 ,
92.648943995 ,
96.424005537 ,
99.798790989 ,
102.132583444 ,
103.955840136 ,
105.996664622 ,
107.809086788 ,
110.10640624500002 ,
114.33213851900001 ,
116.07253735200001 ,
118.88573479600001 ,
121.632792472 ,
123.40774804900002 ,
126.78710064 ,
130.488984777 ,
138.40776393500002 ,
141.818720861 ,
146.24281845500002 ,
150.345210511 ,
154.745981722 ,
161.09281436 ,
169.917108689 ,
178.46524859400003 ,
180.221853685 ,
181.77062631 ,
183.85376920400003 ,
186.43360400000003 ,
188.569479843 ,
190.438454559 ,
200.18231331700002
],
"rot":[
[0.322396457195282, 0.23881563544273376, -0.5920934677124023] ,
[0.2871566116809845, -0.08072828501462936, -2.77008056640625] ,
[0.022408029064536095, -0.01136639341711998, -3.1154706478118896] ,
[0.05134904757142067, -0.004599934909492731, -3.070141553878784] ,
[-0.09269172698259354, 0.0029444443061947823, -2.9999289512634277] ,
[-0.15221868455410004, 0.024385621771216393, -3.086212635040283] ,
[-0.10805381089448929, -0.04080692678689957, -2.940916061401367] ,
[-0.009314289316534996, 0.011107872240245342, -2.244126081466675] ,
[-0.00936639029532671, -0.01191023550927639, -2.363689422607422] ,
[-0.011720740236341953, 0.004976195283234119, 2.495209217071533] ,
[-0.007899435237050056, 0.01411510817706585, -1.7536320686340332] ,
[-0.008956667967140675, -0.0006760396063327789, -0.9592467546463013] ,
[-0.24615974724292755, -0.6175566911697388, -1.5662286281585693] ,
[-0.01202403660863638, -0.0017966692103073, -1.8118407726287842] ,
[-0.01174661424010992, -0.0033297506161034107, -2.4180521965026855] ,
[-0.00354713830165565, -0.012529026716947556, -2.9205024242401123] ,
[-0.101983942091465, -0.04468701034784317, 2.6437571048736572] ,
[-0.0007664926815778017, -0.07988952100276947, 2.3414931297302246] ,
[-0.007196569349616766, 0.006172348279505968, 2.4515678882598877] ,
[-0.011907476000487804, 0.01922224648296833, -1.9352858066558838] ,
[-0.011658741161227226, 0.0006468094070442021, -1.5991077423095703] ,
[-0.0072335898876190186, 0.006306258495897055, -0.3650907576084137] ,
[0.34733378887176514, 0.0029268087819218636, -0.2777894139289856] ,
[-0.02114652842283249, -0.693382740020752, 0.04864123463630676] ,
[0.019431520253419876, -0.331204891204834, 0.3845299780368805] ,
[-0.24231138825416565, -0.3257531225681305, 0.7372809648513794] ,
[-0.13575506210327148, -0.21794818341732025, 0.9611744284629822] ,
[0.11747820675373077, -0.08134105801582336, 0.4339974522590637] ,
[-0.013516846112906933, -0.06342270225286484, 1.280249834060669] ,
[0.061240632086992264, -0.061734601855278015, 1.5704983472824097] ,
[0.006887916009873152, -0.1518782526254654, 2.22128963470459] ,
[-0.10946555435657501, -0.17215779423713684, 2.8074395656585693] ,
[-0.14479641616344452, -0.13234378397464752, -3.1260485649108887] ,
[-0.21056227385997772, 0.0864257887005806, -2.1548895835876465] ,
[-0.015288061462342739, -0.006663475185632706, -1.644439458847046] ,
[-0.003344947937875986, 0.005890160799026489, -1.9707906246185303] ,
[-0.013974298723042011, 0.04181711748242378, 0.7127384543418884] ,
[-0.011403351090848446, 0.004238484427332878, 0.35164594650268555] ,
[-0.009488762356340885, 0.008791396394371986, 0.7719141840934753] ,
[-0.6858975887298584, 1.0757564306259155, 0.4944709539413452] ,
[-0.29866576194763184, 0.06245581433176994, 0.9689251184463501] ,
[0.012169134803116322, -0.024358488619327545, 0.014703278429806232] ,
[0.13266009092330933, -0.019439812749624252, 0.21082057058811188] ,
[-0.0017350295092910528, -0.0012513829860836267, 0.08694247156381607] ,
[-0.060520339757204056, 0.009871666319668293, 0.014981088228523731] ,
[-0.10471435636281967, 0.02526852861046791, 0.15353718400001526] ,
[-0.20200301706790924, 0.021692775189876556, 0.4099411070346832] ,
[-0.2300856113433838, 0.0009850998176261783, 0.24298886954784393] ,
[-0.1363544464111328, -0.015092594549059868, 0.1626790165901184] ,
[-0.04628438130021095, -0.01569954678416252, -0.18837586045265198] ,
[-0.004813441075384617, 0.019966699182987213, 0.0415644533932209] ,
[-0.00748268561437726, 0.005573519971221685, 1.5236225128173828] ,
[-0.013280867598950863, 0.030180254951119423, 2.7995290756225586] ,
[-0.00792701356112957, 0.02658918872475624, -2.051511526107788] ,
[-0.006730733904987574, -0.017240850254893303, -2.462642192840576] ,
[0.03318160027265549, 0.007224104832857847, -2.8958749771118164]
]}

View file

@ -0,0 +1,253 @@
{
"speed": [
26.538028717041016 ,
14.077311515808105 ,
18.658981323242188 ,
13.642276763916016 ,
13.345431327819824 ,
18.702871322631836 ,
16.047119140625 ,
18.768598556518555 ,
12.635817527770996 ,
15.992992401123047 ,
20.55864906311035 ,
18.69696617126465 ,
23.134925842285156 ,
21.005451202392578 ,
10.778977394104004 ,
15.51213264465332 ,
12.688963890075684 ,
19.68726348876953 ,
21.714815139770508 ,
20.48650360107422 ,
44.844058990478516 ,
29.13050651550293 ,
14.36522388458252 ,
26.632301330566406 ,
21.141298294067383 ,
28.36482810974121 ,
34.80923080444336 ,
41.07177734375 ,
35.37945556640625 ,
35.714088439941406 ,
21.304424285888672 ,
29.58685302734375 ,
12.328302383422852 ,
24.218772888183594 ,
18.253358840942383 ,
28.568607330322266 ,
53.616416931152344 ,
66.29619598388672 ,
68.32941436767578 ,
72.90721130371094 ,
78.81604766845703 ,
79.69103240966797 ,
77.72826385498047 ,
53.93451690673828 ,
57.103511810302734 ,
55.76216125488281 ,
24.771047592163086 ,
46.022056579589844 ,
53.28487014770508 ,
73.93230438232422 ,
80.64896392822266 ,
81.385009765625 ,
80.61473846435547 ,
79.13780212402344 ,
56.18103790283203 ,
52.9852180480957 ,
49.222511291503906 ,
34.73994064331055 ,
33.99519729614258 ,
33.589481353759766 ,
32.65351867675781 ,
33.09282684326172 ,
34.04570007324219 ,
35.97509002685547 ,
47.60291290283203 ,
68.90727996826172 ,
49.79296875 ,
33.00839614868164 ,
24.07303810119629 ,
27.293289184570312 ,
34.35337829589844 ,
38.572479248046875 ,
30.301124572753906 ,
23.644100189208984 ,
39.042945861816406 ,
31.498666763305664 ,
23.266845703125 ,
23.334239959716797 ,
9.860187530517578 ,
19.592100143432617 ,
27.304677963256836 ,
45.135345458984375
],
"time":[
8.116664030000003 ,
9.965381487000002 ,
13.246677532 ,
14.635193845000003 ,
18.792129416 ,
21.382569770000003 ,
22.860451079999997 ,
26.539923041 ,
28.774392659 ,
31.181458413999998 ,
33.712839218000006 ,
35.605871269 ,
38.995907190000004 ,
40.104372484 ,
45.975803135 ,
48.299599242000006 ,
48.585197645 ,
51.896950127000004 ,
58.52263849300001 ,
59.939220689 ,
64.93012263700001 ,
69.88484050400001 ,
72.34535318100001 ,
76.931022993 ,
79.300703666 ,
82.545155674 ,
84.551670075 ,
87.96719661200001 ,
90.768797852 ,
93.62990334400001 ,
96.68967967700002 ,
107.201981458 ,
110.06563018 ,
114.26384199700001 ,
117.520456249 ,
119.38233081000001 ,
125.19056378200003 ,
126.396600135 ,
127.25683364300002 ,
128.485345913 ,
129.53639668000002 ,
130.48395716800002 ,
131.650086046 ,
132.98336374200002 ,
134.556082002 ,
136.05712032600002 ,
138.024308608 ,
141.316818229 ,
143.777475325 ,
145.001971864 ,
145.92328762900001 ,
146.834561406 ,
147.62410069700002 ,
148.593186454 ,
149.83803384700002 ,
151.67746488900002 ,
154.264217849 ,
156.53769745300002 ,
158.90166785600002 ,
161.404467962 ,
164.01867503900002 ,
166.28514362 ,
168.43718329200001 ,
170.485944127 ,
174.516517082 ,
176.295076886 ,
177.32922254200002 ,
178.51555399800003 ,
184.21800381000003 ,
189.73977150800002 ,
191.77973041 ,
194.137573862 ,
195.90127665900002 ,
198.52870619200002 ,
203.85514616600003 ,
208.135847073 ,
210.16703229700002 ,
212.60313926400002 ,
214.693184015 ,
216.738090768 ,
218.09940265600002 ,
222.297700631
],
"rot":[
[-0.011944389902055264, 0.006112223025411367, 1.700330376625061] ,
[-0.007173628080636263, 0.02288164757192135, -2.852203845977783] ,
[-0.0861905962228775, -0.10517077893018723, -1.669675588607788] ,
[0.01138912420719862, -0.19917206466197968, 2.7695469856262207] ,
[-0.018195543438196182, 0.08142709732055664, 1.8283754587173462] ,
[-0.00950363464653492, 0.07866732031106949, 2.5361087322235107] ,
[-0.0038584310095757246, 0.022968797013163567, -2.5849733352661133] ,
[0.011713280342519283, 0.0001692562800599262, -2.090550184249878] ,
[0.008348735049366951, 0.015365973114967346, -1.2970794439315796] ,
[-0.010748106054961681, 0.00412603747099638, -0.19918647408485413] ,
[-0.025385981425642967, -0.20469634234905243, 0.19799326360225677] ,
[-0.051951754838228226, -0.19977568089962006, -0.884537935256958] ,
[0.03312642127275467, 0.0024061871226876974, -1.6786614656448364] ,
[-0.00650023203343153, -0.005300144664943218, -2.0751631259918213] ,
[0.012969786301255226, -0.005354337394237518, 2.917091131210327] ,
[0.006736284587532282, 0.006057392805814743, 2.079996109008789] ,
[0.013036495074629784, 0.011535299010574818, 2.3155832290649414] ,
[-0.011130016297101974, 0.0028641719836741686, -1.0052982568740845] ,
[0.016862086951732635, -0.0015058484859764576, -0.09880482405424118] ,
[-0.004691624082624912, 0.021046828478574753, 0.6781924962997437] ,
[-0.017728032544255257, -0.0012465771287679672, 1.430189847946167] ,
[0.09602674096822739, 0.2094225287437439, 1.5242966413497925] ,
[0.005686495453119278, 0.21619883179664612, -2.740380048751831] ,
[0.07098455727100372, 0.03149515017867088, -2.9034860134124756] ,
[0.30910688638687134, -0.20950938761234283, 3.0955755710601807] ,
[0.24025997519493103, 0.20947375893592834, -1.9201265573501587] ,
[-0.017547672614455223, 0.3748147487640381, -1.0774811506271362] ,
[0.0030184010975062847, 0.10431521385908127, -0.7535775899887085] ,
[-0.003876808099448681, -0.10495706647634506, -2.004059314727783] ,
[-0.2196682244539261, -0.007554696407169104, 3.1220242977142334] ,
[-0.407574325799942, -0.22309058904647827, -3.1093294620513916] ,
[-0.012773668393492699, -0.0005817283526994288, -2.7518677711486816] ,
[-0.10252165049314499, -0.008252921514213085, -1.5677368640899658] ,
[-0.23955923318862915, -0.09994788467884064, -1.1482408046722412] ,
[-0.00963659305125475, 0.0071213580667972565, 0.3983650505542755] ,
[-0.012236895971000195, -0.0007551054586656392, 0.528429388999939] ,
[-0.011944236233830452, -0.0016313528176397085, 0.5354834198951721] ,
[-0.41956332325935364, -0.010190033353865147, 0.5716493129730225] ,
[-0.9236911535263062, -0.01155498344451189, 0.5711032748222351] ,
[-1.7139198780059814, 0.0073111592791974545, 0.5829598307609558] ,
[-2.394428014755249, 0.041423454880714417, 0.5533641576766968] ,
[-2.999908208847046, 0.016444142907857895, 0.5245150327682495] ,
[2.462455987930298, 0.007922210730612278, 0.5644753575325012] ,
[1.7629728317260742, -0.0012621483765542507, 0.5560276508331299] ,
[1.0346837043762207, -0.01906212419271469, 0.5698538422584534] ,
[0.30741551518440247, -0.0173384640365839, 0.6008566617965698] ,
[-0.0699830874800682, 0.6417710185050964, 1.5418297052383423] ,
[-0.012416953220963478, -0.0019070307025685906, 1.586891531944275] ,
[-0.02583491988480091, 0.0006539520109072328, 1.5676714181900024] ,
[-0.9542934894561768, -0.03121805749833584, 1.5464407205581665] ,
[-1.7998085021972656, 0.06815160065889359, 1.5507073402404785] ,
[-2.6492412090301514, 0.026394544169306755, 1.5490610599517822] ,
[2.914134979248047, -0.0038345723878592253, 1.5682618618011475] ,
[1.9956632852554321, -0.1380651444196701, 1.521267056465149] ,
[1.040777564048767, -0.0338020958006382, 1.5767815113067627] ,
[-0.04618873447179794, -0.029588982462882996, 1.6126329898834229] ,
[-0.03317926824092865, -0.052183810621500015, 1.629468321800232] ,
[-0.06891582161188126, -0.07569558918476105, 2.3472342491149902] ,
[-0.07659902423620224, -0.02957615628838539, 3.0788307189941406] ,
[-0.07151692360639572, -0.03721490502357483, -2.4958367347717285] ,
[-0.07168643176555634, -0.02208682894706726, -1.6576002836227417] ,
[-0.07112537324428558, -0.02289627306163311, -1.0200819969177246] ,
[-0.07321549206972122, 0.003364601405337453, -0.3980576694011688] ,
[-0.020596753805875778, 0.018566880375146866, -0.037922296673059464] ,
[-0.2480498105287552, -0.06663892418146133, -0.13459287583827972] ,
[-1.3133546113967896, 0.008962471969425678, -0.31686049699783325] ,
[-1.3110071420669556, 0.013296318240463734, -0.13220596313476562] ,
[-1.3061256408691406, -0.1864778697490692, -0.18522538244724274] ,
[1.292571783065796, -0.025291956961154938, 3.010225296020508] ,
[1.1369845867156982, 0.02480003423988819, 3.01930570602417] ,
[-0.011420882306993008, -0.014218311756849289, 3.0177178382873535] ,
[0.019959215074777603, -0.00828701350837946, 3.049135684967041] ,
[-0.0030481216963380575, 0.024305671453475952, -2.4306211471557617] ,
[-0.007101575843989849, 0.007121120113879442, -1.5782235860824585] ,
[0.12303955852985382, 0.024861041456460953, -1.0062673091888428] ,
[0.009652684442698956, -0.01020199153572321, -1.0544575452804565] ,
[-0.002112274756655097, 0.023144695907831192, -0.2179049253463745] ,
[0.16161054372787476, -0.02564871497452259, 0.12074816226959229] ,
[0.21369516849517822, 0.11316730082035065, 1.4975491762161255] ,
[0.21483078598976135, 0.04324842244386673, 1.7023143768310547] ,
[0.28562748432159424, -0.011749212630093098, 1.6832541227340698] ,
[0.012233277782797813, -0.007409573532640934, 1.5701661109924316]
]}

160
racedata/old-data-01.json Normal file
View file

@ -0,0 +1,160 @@
{
"speed": [
34.53645706176758 ,
42.18523406982422 ,
39.258819580078125 ,
36.71881866455078 ,
58.93662643432617 ,
72.29933166503906 ,
45.77790069580078 ,
41.69926071166992 ,
42.62849426269531 ,
43.45172119140625 ,
51.235660552978516 ,
31.478574752807617 ,
39.46429443359375 ,
28.128252029418945 ,
57.83876419067383 ,
62.50741958618164 ,
58.854637145996094 ,
22.849945068359375 ,
26.428817749023438 ,
36.63786697387695 ,
47.69795227050781 ,
54.362796783447266 ,
41.81144714355469 ,
14.943954467773438 ,
46.46694564819336 ,
39.81470489501953 ,
39.50140380859375 ,
37.47561264038086 ,
15.179645538330078 ,
20.929906845092773 ,
45.30957794189453 ,
23.44857406616211 ,
23.066326141357422 ,
25.70628547668457 ,
47.98323059082031 ,
54.75291061401367 ,
58.678802490234375 ,
44.3359489440918 ,
50.71199417114258 ,
61.02040481567383 ,
46.14556884765625 ,
36.1912727355957 ,
45.200992584228516 ,
26.560962677001953 ,
33.57011795043945 ,
25.442731857299805 ,
45.04869842529297 ,
21.671131134033203 ,
23.820812225341797 ,
28.113801956176758 ,
55.13059616088867
],
"time":[
3.7331726409999995 ,
10.839709940000002 ,
15.604859501 ,
21.232931573 ,
25.423423467000003 ,
29.299977412 ,
38.75026077 ,
41.63020803100001 ,
47.96183718900001 ,
52.53954244200001 ,
58.496759698000005 ,
62.853535308000005 ,
69.863829096 ,
71.044700398 ,
78.77773761 ,
81.53409601400001 ,
82.65185832200001 ,
85.32760139800001 ,
89.074524456 ,
92.084296941 ,
95.26055315500001 ,
100.65397920500001 ,
104.88031547000001 ,
106.758814842 ,
113.99198440800001 ,
117.720443904 ,
120.68088727600002 ,
123.16474497600001 ,
125.38076530100003 ,
129.732231237 ,
137.45067690500002 ,
141.032491157 ,
142.436841254 ,
144.848307046 ,
148.58897748500002 ,
152.46698020300002 ,
155.38062296 ,
158.850439759 ,
161.84902360100003 ,
166.33817853300002 ,
171.558688668 ,
174.706659002 ,
177.52119836300002 ,
181.63567185000002 ,
184.77241402400003 ,
190.474174792 ,
194.84427218500002 ,
197.623955681 ,
200.56679723200003 ,
202.875682436 ,
206.77588530600002
],
"rot":[
[-0.01624995656311512, 0.07849447429180145, -0.5860120058059692] ,
[-0.13108374178409576, 0.0036811053287237883, -1.9615410566329956] ,
[0.2670449912548065, -0.042434122413396835, -2.7690749168395996] ,
[0.33141058683395386, 0.0562259703874588, 2.039043664932251] ,
[0.3329033851623535, -0.019622452557086945, 1.9211680889129639] ,
[0.2681850492954254, -0.12282246351242065, 1.63251793384552] ,
[0.07227663695812225, 0.013098720461130142, 1.353943943977356] ,
[0.05529430881142616, -0.011405624449253082, 0.7894548773765564] ,
[-0.06097666174173355, -0.009611496701836586, 1.1667016744613647] ,
[-0.09110146760940552, -0.003160672029480338, 1.8139026165008545] ,
[-0.07910168915987015, 0.052563153207302094, 1.7210103273391724] ,
[-0.07669410854578018, 0.24394765496253967, 1.6646289825439453] ,
[0.2888643443584442, 0.19726473093032837, 2.4627699851989746] ,
[0.0036310763098299503, 0.050845541059970856, 3.0246827602386475] ,
[0.02131607010960579, 0.003683441085740924, -1.6427737474441528] ,
[-0.04108688235282898, 0.0028885663487017155, -1.4885928630828857] ,
[-0.004137610550969839, 0.01848621480166912, -1.4435324668884277] ,
[0.01292195450514555, 0.028108134865760803, -0.6352774500846863] ,
[-0.2486754208803177, 0.012429589405655861, 0.4717749059200287] ,
[-0.20020051300525665, -0.015403581783175468, 0.4037122428417206] ,
[-0.2037292718887329, -0.06907863914966583, 0.35424113273620605] ,
[-0.19704695045948029, 0.007243760861456394, 0.188624307513237] ,
[-0.19659633934497833, 0.00966715905815363, 0.1812870055437088] ,
[-0.14462502300739288, 0.11804241687059402, 0.643571138381958] ,
[-0.05990368127822876, -0.0002554748207330704, 1.7723714113235474] ,
[-0.060604702681303024, 0.003209835384041071, 1.830974817276001] ,
[-0.008336379192769527, 0.010820192284882069, 2.8646183013916016] ,
[-0.007981760427355766, 0.015732446685433388, -2.289222478866577] ,
[0.05147334933280945, -0.0643678605556488, -0.5811130404472351] ,
[0.11037056148052216, -0.0053720674477517605, -1.30815851688385] ,
[-0.1621924191713333, 0.0018318506190553308, 0.25206780433654785] ,
[-0.15930092334747314, -0.02305584028363228, 0.11540792882442474] ,
[0.010223581455647945, 0.0012618519831448793, -0.2890264391899109] ,
[-0.051978521049022675, 0.00850313063710928, -1.318840503692627] ,
[-0.17644517123699188, -0.0011852768948301673, -1.3395663499832153] ,
[-0.1761690080165863, -0.0021828312892466784, -1.3442251682281494] ,
[-0.3152637481689453, -0.07436665892601013, -1.5566202402114868] ,
[0.3682832717895508, 0.013875464908778667, -1.4670772552490234] ,
[0.017779087647795677, -0.021842246875166893, -1.6439850330352783] ,
[-0.1307658851146698, 0.0003210034337826073, -1.7973430156707764] ,
[-0.18067330121994019, 0.0007494472083635628, -1.7816379070281982] ,
[-0.07303235679864883, -0.004364720545709133, -2.101363182067871] ,
[-0.09024622291326523, -0.0003755079524125904, -2.415090799331665] ,
[0.1307559609413147, -0.0565742664039135, 3.039773464202881] ,
[0.3108542561531067, -0.08981055021286011, 2.4484992027282715] ,
[0.3178117573261261, 0.3399386405944824, 1.3576174974441528] ,
[0.22571131587028503, 0.13748253881931305, 1.5181454420089722] ,
[0.22656512260437012, 0.10890141874551773, 1.6666717529296875] ,
[0.5554865002632141, 0.16415885090827942, 2.5439395904541016] ,
[-0.0215617548674345, 0.008771177381277084, -2.2904481887817383] ,
[-0.2129850834608078, 0.016720633953809738, -1.6787928342819214]
]}

667
run.py Normal file
View file

@ -0,0 +1,667 @@
# GPL3 or any later version
# (C) J.Y.Amihud ( blenderdumbass ) 2024
# This is the launcher of the game.
import os
import subprocess
import time
import json
import threading
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from gi.repository import GLib
from Scripts.Common import *
#### MAKING THE WINDOW ####
win = Gtk.Window()
win.set_title("Dani's Race")
win.set_size_request(799, 280)
win.connect("destroy", Gtk.main_quit)
win.set_default_icon_from_file("SettingUI/icon.png")
box = Gtk.VBox()
win.add(box)
#### Building the UI itself ###
banner = Gtk.Image.new_from_file('SettingUI/banner.jpg')
box.pack_start(banner, 0,0,0)
playbox = Gtk.HBox()
box.pack_end(playbox, 1,5,5)
def play(w):
data = load_settings()
if data:
blenderplayer = data.get("blenderplayer")
command = [blenderplayer]
if data.get("fullscreen"):
command.append("-f")
else:
command.append("-w")
command.append(data.get("resolution").split(":")[0])
command.append(data.get("resolution").split(":")[1])
# The file of the game
command.append(os.getcwd()+"/assembly.blend")
# print(command)
subprocess.Popen(command)
else:
set_settings(w)
playbutton = Gtk.Button("Start Game")
playbutton.connect("clicked", play)
playbox.pack_end(playbutton, 0,5,5)
################### SETTINGS #########################
def set_settings(w):
settingsWindow = Gtk.Dialog("Dani's Race Settings",
buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
Gtk.STOCK_OK, Gtk.ResponseType.OK),
)
settingsWindow.set_size_request(400, 400)
box = settingsWindow.get_content_area()
# Scroller
scrl = Gtk.ScrolledWindow()
box.pack_start(scrl, 1,1,1)
# Actuall useful box
box = Gtk.VBox()
scrl.add(box)
# UPBGE executable
upbgebox = Gtk.HBox()
upbgelabel = Gtk.Label("UPBGE executable: ")
upbgeinput = Gtk.Entry()
upbgeinput.set_text("blenderplayer")
upbgeinput.set_tooltip_text("Location of the blenderplayer executable on the system ( should in UPBGE folder ).")
upbgebox.pack_start(upbgelabel, 0,5,5)
upbgebox.pack_start(upbgeinput, 1,5,5)
box.pack_start(upbgebox, 0,5,5)
###### GRAPHICS / COMPLEXITY #####
box.pack_start(Gtk.Label("Graphics"), 0,5,5)
# Resolution
resbox = Gtk.HBox()
resfull = Gtk.CheckButton("Fullscreen")
resfull.set_tooltip_text("Whether to run the game Fullscreen.")
resmenu = Gtk.ComboBoxText()
resmenu.set_tooltip_text("What resolution to run the game at.")
resolutions = [
"7680:4320",
"5120:2880",
"3840:2160",
"2560:1440",
"1920:1080",
"1600:900",
"1366:768",
"1280:720",
"1024:576",
"960:540",
"854:480",
"640:360"
]
for i in resolutions:
resmenu.append_text(i)
resmenu.set_active(4)
resbox.pack_start(resfull, 0,5,5)
resbox.pack_end(resmenu, 0,5,5)
box.pack_start(resbox, 0,5,5)
# Compositing
compositor = Gtk.CheckButton("Post Processing Effects")
compositor.set_tooltip_text("Bloom, sun beams, film and color grading effects.")
compositor.set_active(True)
box.pack_start(compositor, 0,5,5)
# Reflections
reflections = Gtk.CheckButton("Screen-Space Reflections")
reflections.set_tooltip_text("Pseudo-accurate reflections.")
reflections.set_active(True)
box.pack_start(reflections, 0,5,5)
# Trees, Poles, Fenses
tplbox = Gtk.HBox()
trees = Gtk.CheckButton("Trees")
trees.set_tooltip_text("Whether to spawn Trees.")
trees.set_active(True)
poles = Gtk.CheckButton("Light Poles")
poles.set_tooltip_text("Whether to spawn Light Poles.")
poles.set_active(True)
fences = Gtk.CheckButton("Fences")
fences.set_tooltip_text("Whether to spawn Metal and or Wooden fences.")
fences.set_active(True)
tplbox.pack_start(trees, 1,5,5)
tplbox.pack_start(poles, 1,5,5)
tplbox.pack_start(fences, 1,5,5)
box.pack_start(tplbox, 0,5,5)
# Amount of cars
carsbox = Gtk.HBox()
carsbox.pack_start(Gtk.Label("Traffic Density"), 0,5,5)
maxcarsadjust = Gtk.Adjustment(4, lower=1, upper=20, step_increment=1)
maxcarsinput = Gtk.SpinButton(adjustment=maxcarsadjust, digits=0)
maxcarsinput.set_tooltip_text("How many NPC cars to spawn on roads.")
carsbox.pack_end(maxcarsinput, 0,5,5)
box.pack_start(carsbox, 0,5,5)
# Sampling
samplesbox = Gtk.HBox()
sampleslabel = Gtk.Label("Main Samples: ")
samplesadjust = Gtk.Adjustment(1, lower=1, upper=64, step_increment=1)
samplesinput = Gtk.SpinButton(adjustment=samplesadjust, digits=0)
samplesinput.set_sensitive(False)
samplesinput.set_tooltip_text("How many times to render the image per frame. More gives more accurate soft shadows and anti-aliasing. Less is faster.")
samplesbox.pack_start(sampleslabel, 0,5,5)
samplesbox.pack_end(samplesinput, 0,5,5)
box.pack_start(samplesbox, 0,5,5)
# Subsurface Sampling
skinsamplesbox = Gtk.HBox()
skinsampleslabel = Gtk.Label("Skin Samples: ")
skinsamplesadjust = Gtk.Adjustment(5, lower=1, upper=64, step_increment=1)
skinsamplesinput = Gtk.SpinButton(adjustment=skinsamplesadjust, digits=0)
skinsamplesinput.set_sensitive(False)
skinsamplesinput.set_tooltip_text("How accurate the subsurface materials ( skin ) should be. More, prettier, less faster.")
skinsamplesbox.pack_start(skinsampleslabel, 0,5,5)
skinsamplesbox.pack_end(skinsamplesinput, 0,5,5)
box.pack_start(skinsamplesbox, 0,5,5)
# Volumetric sampling
box.pack_start(Gtk.HSeparator(), 0,5,5) #############################
volumesamplesbox = Gtk.HBox()
volumesampleslabel = Gtk.Label("Volumetric Samples: ")
volumesamplesadjust = Gtk.Adjustment(32, lower=1, upper=64, step_increment=1)
volumesamplesinput = Gtk.SpinButton(adjustment=volumesamplesadjust, digits=0)
volumesamplesinput.set_tooltip_text("How accurate should be fog, smoke and fire effects. More prettier, less faster.")
volumesamplesbox.pack_start(volumesampleslabel, 0,5,5)
volumesamplesbox.pack_end(volumesamplesinput, 0,5,5)
box.pack_start(volumesamplesbox, 0,5,5)
# Volumetric lighting
volumelight = Gtk.CheckButton("Volumetric Lighting")
volumelight.set_active(True)
volumelight.set_tooltip_text("Enable light to interact with volumetric materials.")
box.pack_start(volumelight, 0,5,5)
# Volumetric shadow
def show_hide_volume_shadows(w):
volumeshadowsamplesbox.set_visible( w.get_active() )
volumeshadow = Gtk.CheckButton("Volumetric Shadows")
volumeshadow.set_active(False)
volumeshadow.set_tooltip_text("Enable volumetrics to cast shadows ( Very slow ).")
volumeshadow.connect("clicked", show_hide_volume_shadows)
box.pack_start(volumeshadow, 0,5,5)
# Volumetric shadow sampling
volumeshadowsamplesbox = Gtk.HBox()
volumeshadowsampleslabel = Gtk.Label("Volumetric Shadows Samples: ")
volumeshadowsamplesadjust = Gtk.Adjustment(3, lower=1, upper=64, step_increment=1)
volumeshadowsamplesinput = Gtk.SpinButton(adjustment=volumeshadowsamplesadjust, digits=0)
volumeshadowsamplesinput.set_tooltip_text("How accurate should be volumentric shadows. More prettier, less faster.")
volumeshadowsamplesbox.pack_start(volumeshadowsampleslabel, 0,5,5)
volumeshadowsamplesbox.pack_end(volumeshadowsamplesinput, 0,5,5)
box.pack_start(volumeshadowsamplesbox, 0,5,5)
# Shadows
box.pack_start(Gtk.HSeparator(), 0,5,5) #############################
def show_hide_shadows(w):
softshadows.set_visible( w.get_active() )
contactshadows.set_visible( w.get_active() )
shadowcubebox.set_visible( w.get_active() )
shadowcascadebox.set_visible( w.get_active() )
shadows = Gtk.CheckButton("Shadows")
shadows.set_active(True)
shadows.set_tooltip_text("Whether to render Shadows.")
shadows.connect("clicked", show_hide_shadows)
box.pack_start(shadows, 0,5,5)
# Soft Shadows
softshadows = Gtk.CheckButton("Soft Shadows")
softshadows.set_active(True)
softshadows.set_tooltip_text("Whether to try rendering soft Shadows. ( Requires more than one Sample )")
box.pack_start(softshadows, 0,5,5)
# Contact Shadows
contactshadows = Gtk.CheckButton("Contact Shadows")
contactshadows.set_active(True)
contactshadows.set_tooltip_text("Render a special pass of shadows to fill up small cracks.")
box.pack_start(contactshadows, 0,5,5)
# Shadow resolution
shadowresolutions = [
"4096",
"2048",
"1024",
"512",
"256",
"128",
"64"
]
shadowcubebox = Gtk.HBox()
shadowcubelabel = Gtk.Label("Lamp Shadow Resolution: ")
shadowcubemenu = Gtk.ComboBoxText()
for i in shadowresolutions:
shadowcubemenu.append_text(i)
shadowcubemenu.set_active(3)
shadowcubebox.pack_start(shadowcubelabel,0,5,5)
shadowcubebox.pack_end(shadowcubemenu,0,5,5)
box.pack_start(shadowcubebox, 0,5,5)
# Shadow cascade size
shadowcascadebox = Gtk.HBox()
shadowcascadelabel = Gtk.Label("Sun Shadow Resolution: ")
shadowcascademenu = Gtk.ComboBoxText()
for i in shadowresolutions:
shadowcascademenu.append_text(i)
shadowcascademenu.set_active(2)
shadowcascadebox.pack_start(shadowcascadelabel,0,5,5)
shadowcascadebox.pack_end(shadowcascademenu,0,5,5)
box.pack_start(shadowcascadebox, 0,5,5)
############ CONTROLS ########################
box.pack_start(Gtk.HSeparator(), 0,5,5) #############################
box.pack_start(Gtk.Label("Controls"), 0,5,5)
def show_hide_car_controls(w):
controlboxes["veh_forward"].set_visible( not w.get_active() )
controlboxes["veh_backward"].set_visible( not w.get_active() )
controlboxes["veh_left"].set_visible( not w.get_active() )
controlboxes["veh_right"].set_visible( not w.get_active() )
carmouseguides.set_visible( w.get_active() )
carmouseshow.set_visible( w.get_active() )
controlcarmouse = Gtk.CheckButton("Control Car With a Mouse")
controlcarmouse.connect("clicked", show_hide_car_controls )
controlcarmouse.set_tooltip_text("Use the mouse to control the car. Allows for more precise input. Has a learning curve.")
box.pack_start(controlcarmouse, 0,5,5)
carmouseguides = Gtk.CheckButton("Mouse Control Guides")
carmouseguides.set_active(True)
carmouseguides.set_tooltip_text("Show guides on the screen when controlling the car with the mouse.")
box.pack_start(carmouseguides, 0,5,5)
carmouseshow = Gtk.CheckButton("Show Mouse Cursor")
carmouseshow.set_tooltip_text("Show mouse cursor when controlling the car with the mouse. ( Easier to understand than the guides, but can obstruct the view ).")
box.pack_start(carmouseshow, 0,5,5)
controlnames = {
"veh_forward" :"Drive Forward",
"veh_backward" :"Drive Backward",
"veh_left" :"Steer Left",
"veh_right" :"Steer Right",
"veh_drift" :"Handbrake",
"veh_nitro" :"Use Nitro",
"veh_resque" :"Resque During Race",
"veh_gear_up" :"Shift Gears Up",
"veh_gear_down":"Shift Gears Down",
"veh_auto_gear":"Switch Automatic Gearbox",
"veh_dynamcam" :"Switch Dynamic Camera",
"veh_upload" :"Truck Deploy Cargo",
"chr_forward" :"Walk Forward",
"chr_backward" :"Walk Backward",
"chr_left" :"Walk Left",
"chr_right" :"Walk Right",
"chr_jump" :"Jump",
"chr_get_car" :"Enter Car",
"chr_swimdown" :"Swim Down"
}
controldefaults = {
"veh_forward" :"UpArrow",
"veh_backward" :"DownArrow",
"veh_left" :"LeftArrow",
"veh_right" :"RightArrow",
"veh_drift" :"Space",
"veh_nitro" :"Z",
"veh_resque" :"BackSpace",
"veh_gear_up" :"W",
"veh_gear_down":"S",
"veh_auto_gear":"Q",
"veh_dynamcam" :"C",
"veh_upload" :"D",
"chr_forward" :"W",
"chr_backward" :"S",
"chr_left" :"A",
"chr_right" :"D",
"chr_jump" :"Space",
"chr_get_car" :"Enter",
"chr_swimdown" :"LShift"
}
controlwidgets = {}
controlboxes = {}
for control in controlnames:
cbox = Gtk.HBox()
box.pack_start(cbox, 0,5,5)
controlboxes[control] = cbox
cbox.pack_start(Gtk.Label(controlnames[control]), 0,5,5)
controlwidgets[control] = Gtk.ComboBoxText()
cbox.pack_end(controlwidgets[control], 0,5,5)
for key in keycodes:
controlwidgets[control].append_text(key)
controlwidgets[control].set_active( list(keycodes.keys()).index(controldefaults[control]) )
######## NETWORK ######
box.pack_start(Gtk.HSeparator(), 0,5,5) #############################
box.pack_start(Gtk.Label("Multiplayer"), 0,5,5)
def show_hide_multiplayer(w):
hostbox.set_visible( w.get_active() )
usernamebox.set_visible( w.get_active() )
multiplayerroombox.set_visible( w.get_active() )
multiplayer = Gtk.CheckButton("Multiplayer")
multiplayer.connect("clicked", show_hide_multiplayer)
box.pack_start(multiplayer, 0,5,5)
hostbox = Gtk.HBox()
hostbox.pack_start(Gtk.Label("Hostname:"), 0,5,5)
hostname = Gtk.Entry()
hostbox.pack_end(hostname, 0,5,5)
box.pack_start(hostbox, 0,5,5)
usernamebox = Gtk.HBox()
usernamebox.pack_start(Gtk.Label("Username:"),0,5,5)
username = Gtk.Entry()
usernamebox.pack_end(username,0,5,5)
box.pack_start(usernamebox, 0,5,5)
multiplayerroombox = Gtk.HBox()
multiplayerroombox.pack_start(Gtk.Label("Room:"),0,5,5)
multiplayerroom = Gtk.Entry()
multiplayerroombox.pack_end(multiplayerroom,0,5,5)
box.pack_start(multiplayerroombox, 0,5,5)
######### TIME ########
box.pack_start(Gtk.HSeparator(), 0,5,5) #############################
box.pack_start(Gtk.Label("In Game Time"), 0,5,5)
clockspeedbox = Gtk.HBox()
clockspeedbox.pack_start(Gtk.Label("In Game Clock Speed:"), 0,5,5)
clockspeedadjustment = Gtk.Adjustment(20, lower=0.1, upper=10000, step_increment=0.1)
clockspeedentry = Gtk.SpinButton(adjustment=clockspeedadjustment, digits=2)
clockspeedentry.set_tooltip_text("How much the clock in the game is faster than the real clock. 1 is real time speed. 10 is ten times faster.")
clockspeedbox.pack_end(clockspeedentry, 0,5,5)
box.pack_start(clockspeedbox, 0,5,5)
############################################# DEV SETTINGS #####################
box.pack_start(Gtk.HSeparator(), 0,5,5) #############################
box.pack_start(Gtk.Label("For Developers"), 0,5,5)
def show_hide_devmode(w):
devmode_cheats.set_visible( w.get_active() )
devmode_visible_rays.set_visible( w.get_active() )
if not w.get_active():
devmode_cheats.set_active( False )
devmode_visible_rays.set_active( False )
devmode = Gtk.CheckButton("Developer Mode")
devmode.set_tooltip_text("Developer mode is mode used in development of the game.")
box.pack_start(devmode, 0,5,5)
devmode.connect("clicked", show_hide_devmode )
devmode_cheats = Gtk.CheckButton("Developer Keyboard Cheatcodes")
devmode_cheats.set_tooltip_text("Enable keyboards cheat codes, for testing purposes.")
box.pack_start(devmode_cheats, 0,5,5)
devmode_visible_rays = Gtk.CheckButton("Developer Visible Rays")
devmode_visible_rays.set_tooltip_text("Show the rays that are used for AIs to see.")
box.pack_start(devmode_visible_rays, 0,5,5)
################################################################################
# Loading settings
data = load_settings()
if data:
upbgeinput.set_text( data.get("blenderplayer", "blenderplayer") )
resfull.set_active( data.get("fullscreen", False ) )
resmenu.set_active( resolutions.index( data.get("resolution", "1920:1080" ) ) )
compositor.set_active( data.get("compositor", True ) )
reflections.set_active( data.get("reflections", True ) )
trees.set_active( data.get("trees", True ) )
poles.set_active( data.get("poles", True ) )
fences.set_active( data.get("fences", True ) )
samplesadjust.set_value( data.get("samples", 1 ) )
skinsamplesadjust.set_value( data.get("skinsamples", 5 ) )
volumesamplesadjust.set_value( data.get("volumesamples", 32 ) )
volumelight.set_active( data.get("volumelight", True ) )
volumeshadow.set_active( data.get("volumeshadow", False ) )
volumeshadowsamplesadjust.set_value( data.get("volshadsampl", 3 ) )
shadows.set_active( data.get("shadows", True ) )
softshadows.set_active( data.get("softshadows", True ) )
contactshadows.set_active( data.get("cntctshadows", True ) )
shadowcubemenu.set_active( shadowresolutions.index( data.get("shadowslamps", "512" ) ) )
shadowcascademenu.set_active( shadowresolutions.index( data.get("shadowssun", "1024" ) ) )
devmode.set_active( data.get("devmode", False ) )
devmode_cheats.set_active( data.get("dev-cheats", False ) )
devmode_visible_rays.set_active(data.get("dev-rays", False ) )
clockspeedadjustment.set_value( data.get("clockspeed", 20.0 ) )
controlcarmouse.set_active( data.get("veh_mouse", False ) )
maxcarsadjust.set_value( data.get("maxcars", 4 ) )
carmouseguides.set_active( data.get("veh_mouse_guides",True ) )
carmouseshow.set_active( data.get("veh_mouse_cursor",False ) )
multiplayer.set_active( data.get("multiplayer", False ) )
hostname.set_text( data.get("mp-host", "http://localhost:6969") )
username.set_text( data.get("mp-name", "Dani" ) )
multiplayerroom.set_text( data.get("mp-room", "Main" ) )
for control in controlwidgets:
try:
controlwidgets[control].set_active( list(keycodes.keys()).index(data.get(control)) )
except:
controlwidgets[control].set_active( list(keycodes.keys()).index(controldefaults[control]) )
settingsWindow.show_all()
show_hide_shadows(shadows)
show_hide_volume_shadows(volumeshadow)
show_hide_devmode(devmode)
show_hide_car_controls(controlcarmouse)
show_hide_multiplayer(multiplayer)
response = settingsWindow.run()
if response == Gtk.ResponseType.OK:
folder = get_settings_folder()
f = folder+"/config.json"
data = {"blenderplayer":upbgeinput.get_text(),#
"fullscreen" :resfull.get_active(),#
"resolution" :resmenu.get_active_text(),#
"compositor" :compositor.get_active(),#
"reflections" :reflections.get_active(),#
"trees" :trees.get_active(),#
"poles" :poles.get_active(),#
"fences" :fences.get_active(),#
"samples" :int(samplesadjust.get_value()),#
"skinsamples" :int(skinsamplesadjust.get_value()),#
"volumesamples":int(volumesamplesadjust.get_value()),#
"volumelight" :volumelight.get_active(),#
"volumeshadow" :volumeshadow.get_active(),#
"volshadsampl" :int(volumeshadowsamplesadjust.get_value()),#
"shadows" :shadows.get_active(), #
"softshadows" :softshadows.get_active(),#
"cntctshadows" :contactshadows.get_active(),#
"shadowslamps" :shadowcubemenu.get_active_text(),#
"shadowssun" :shadowcascademenu.get_active_text(), #
"devmode" :devmode.get_active(),
"dev-cheats" :devmode_cheats.get_active(),
"dev-rays" :devmode_visible_rays.get_active(),
"clockspeed" :clockspeedadjustment.get_value(),
"veh_mouse" :controlcarmouse.get_active(),
"maxcars" :int(maxcarsadjust.get_value()),
"veh_mouse_guides":carmouseguides.get_active(),
"veh_mouse_cursor":carmouseshow.get_active(),
"multiplayer" :multiplayer.get_active(),
"mp-host" :hostname.get_text(),
"mp-name" :username.get_text(),
"mp-room" :multiplayerroom.get_text()
}
for control in controlwidgets:
data[control] = controlwidgets[control].get_active_text()
with open(f, "w") as save:
json.dump(data, save, indent=4, sort_keys=True)
settingsWindow.destroy()
settingsbutton = Gtk.Button("Settings")
settingsbutton.connect("clicked", set_settings)
settingsbutton.set_relief(Gtk.ReliefStyle.NONE)
playbox.pack_end(settingsbutton, 0,5,5)
def get_settings_folder():
game = "danisrace"
try:
data_dir = os.environ["XDG_DATA_HOME"] + "/" + game
except:
data_dir = os.path.expanduser("~/.local/share/"+game)
try:
os.makedirs(data_dir)
except:
pass
return data_dir
def load_settings():
folder = get_settings_folder()
f = folder+"/config.json"
try:
with open(f) as o:
return json.load(o)
except: return None
#### Launching he ui ######
win.show_all()
Gtk.main()

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

BIN
sfx/active.ogg Normal file

Binary file not shown.

BIN
sfx/ambiance/forest.ogg Normal file

Binary file not shown.

BIN
sfx/ambiance/water.ogg Normal file

Binary file not shown.

BIN
sfx/boom.ogg Normal file

Binary file not shown.

BIN
sfx/checkpoint.ogg Normal file

Binary file not shown.

BIN
sfx/door.ogg Normal file

Binary file not shown.

BIN
sfx/drift.ogg Normal file

Binary file not shown.

Binary file not shown.

BIN
sfx/engines/redkiss.ogg Normal file

Binary file not shown.

BIN
sfx/engines/regular.ogg Normal file

Binary file not shown.

BIN
sfx/engines/truck.ogg Normal file

Binary file not shown.

BIN
sfx/fixtool.ogg Normal file

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show more