├── .gitignore ├── LICENSE ├── README.md ├── assets ├── CC-BY-NC-SA.txt ├── Thumbs.db ├── fonts │ └── Aldrich-Regular.ttf ├── music │ ├── track1.ogg │ ├── track10.ogg │ ├── track2.ogg │ ├── track3.ogg │ ├── track4.ogg │ ├── track5.ogg │ ├── track6.ogg │ ├── track7.ogg │ ├── track8.ogg │ └── track9.ogg ├── objects │ ├── asteroid1-radar.png │ ├── asteroid1.png │ └── asteroid2.png ├── palettes.svg ├── particles │ ├── VFX-0-Circle.png │ ├── VFX-0-Star.png │ ├── VFX-1-Star.png │ ├── particle.png │ ├── particle3.png │ ├── particles-0.png │ ├── particles.atlas │ ├── smallsquare.png │ └── smokeparticle.png ├── projectiles │ ├── bullet-14px.png │ ├── bullet-6px.png │ ├── bullet-8px.png │ ├── rocket-14px.png │ ├── rocket-6px.png │ └── rocket-8px.png ├── shaders │ ├── poscolorshader.glsl │ ├── positionrotatecolorscale.glsl │ ├── positionrotatecolorshader.glsl │ └── positionrotateshader.glsl ├── ships │ ├── Cruiser.png │ ├── probe.png │ ├── probelight.png │ ├── ship1-radar.png │ ├── ship1-shields.png │ ├── ship1.png │ ├── ship2.png │ ├── ship3.png │ ├── ship5.png │ ├── ship6.png │ ├── ship7.png │ └── ship8.png ├── soundfx │ ├── asteroidhitasteroid.ogg │ ├── asteroidhitasteroid.wav │ ├── asteroidhitship.ogg │ ├── blaster │ │ ├── hit.wav │ │ ├── reload-end.wav │ │ ├── reload-laser.wav │ │ └── shoot.wav │ ├── bulletfire.ogg │ ├── bullethitasteroid.ogg │ ├── bullethitbullet.ogg │ ├── enemyshipenterarea.ogg │ ├── explosion.wav │ ├── hit2.wav │ ├── lazerhitraw.wav │ ├── probepickup.ogg │ ├── rifle │ │ ├── hit.wav │ │ ├── reload-begin.ogg │ │ ├── reload-begin.wav │ │ ├── reload-end.ogg │ │ ├── reload-end.wav │ │ ├── reload.wav │ │ ├── shoot.ogg │ │ └── shoot.wav │ ├── rocketexplosion.ogg │ ├── rocketfire.ogg │ ├── shipengine.wav │ ├── shipexplosion.ogg │ ├── shiphit.wav │ ├── shiphitbybullet.ogg │ └── shotgun │ │ ├── hit.wav │ │ ├── reload-begin.wav │ │ ├── reload-end.wav │ │ └── shoot.wav ├── ui_elements │ ├── asteroid-icon.png │ ├── bulleticon-down.png │ ├── bulleticon-normal.png │ ├── forward-shippanel-icon.png │ ├── left-shippanel-icon.png │ ├── probe-icon.png │ ├── right-shippanel-icon.png │ ├── rocketicon-down.png │ ├── rocketicon-normal.png │ ├── ship-icon.png │ └── unexplored-icon.png └── vfx │ ├── asteroidexplosion.kep │ ├── blaster_projectile.kep │ ├── engine1.kep │ ├── engine2.kep │ ├── engine3.kep │ ├── orb_explosion.kep │ └── shipexplosion.kep ├── background_generator.py ├── colors.py ├── generate_assets.py ├── generate_triangulated_polygons.py ├── geometry.py ├── grid_generation.py ├── main.py ├── noise ├── kivent_noise │ ├── __init__.py │ ├── cnoise.pxd │ ├── include │ │ └── simplexnoise.h │ ├── noise.pyx │ └── src │ │ └── simplexnoise.cpp └── setup.py ├── systems ├── __init__.py ├── asteroids.py ├── explosions.py ├── globalmap.py ├── player.py ├── shield.py └── ships.py ├── triangulated_models ├── circle_100_10.kem ├── circle_200_10.kem ├── circle_400_30.kem └── circle_800_50.kem ├── ui_elements.py ├── utils.py └── yacs.kv /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | *.egg-info/ 23 | .installed.cfg 24 | *.egg 25 | 26 | # PyInstaller 27 | # Usually these files are written by a python script from a template 28 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 29 | *.manifest 30 | *.spec 31 | 32 | # Installer logs 33 | pip-log.txt 34 | pip-delete-this-directory.txt 35 | 36 | # Unit test / coverage reports 37 | htmlcov/ 38 | .tox/ 39 | .coverage 40 | .coverage.* 41 | .cache 42 | nosetests.xml 43 | coverage.xml 44 | *,cover 45 | 46 | # Translations 47 | *.mo 48 | *.pot 49 | 50 | # Django stuff: 51 | *.log 52 | 53 | # Sphinx documentation 54 | docs/_build/ 55 | 56 | # PyBuilder 57 | target/ 58 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Kovak 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # YACS 2 | You Are the Captain of a Spaceship - Game Created with Kivy and KivEnt 3 | 4 | The code in this repository is MIT licensed. The art assets, music, and sound fx 5 | found in the assets folder are under a Creative Commons Non-Commercial Share-A-Like 6 | license. This means you are free to modify the game in any way you choose and 7 | share that with anyone you feel like, however, if you do modify the art assets 8 | please allow others to in turn modify your modifications. The code is less 9 | restrictively licensed, unless mentioned otherwise in the files. The noise 10 | module has some GPL code, as does one of the dependencies of the triangulation 11 | code. 12 | -------------------------------------------------------------------------------- /assets/CC-BY-NC-SA.txt: -------------------------------------------------------------------------------- 1 | Creative Commons Legal Code 2 | 3 | Attribution-NonCommercial-ShareAlike 3.0 Unported 4 | 5 | CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE 6 | LEGAL SERVICES. DISTRIBUTION OF THIS LICENSE DOES NOT CREATE AN 7 | ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS 8 | INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES 9 | REGARDING THE INFORMATION PROVIDED, AND DISCLAIMS LIABILITY FOR 10 | DAMAGES RESULTING FROM ITS USE. 11 | 12 | License 13 | 14 | THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE 15 | COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY 16 | COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS 17 | AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED. 18 | 19 | BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE 20 | TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY 21 | BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS 22 | CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND 23 | CONDITIONS. 24 | 25 | 1. Definitions 26 | 27 | a. "Adaptation" means a work based upon the Work, or upon the Work and 28 | other pre-existing works, such as a translation, adaptation, 29 | derivative work, arrangement of music or other alterations of a 30 | literary or artistic work, or phonogram or performance and includes 31 | cinematographic adaptations or any other form in which the Work may be 32 | recast, transformed, or adapted including in any form recognizably 33 | derived from the original, except that a work that constitutes a 34 | Collection will not be considered an Adaptation for the purpose of 35 | this License. For the avoidance of doubt, where the Work is a musical 36 | work, performance or phonogram, the synchronization of the Work in 37 | timed-relation with a moving image ("synching") will be considered an 38 | Adaptation for the purpose of this License. 39 | b. "Collection" means a collection of literary or artistic works, such as 40 | encyclopedias and anthologies, or performances, phonograms or 41 | broadcasts, or other works or subject matter other than works listed 42 | in Section 1(g) below, which, by reason of the selection and 43 | arrangement of their contents, constitute intellectual creations, in 44 | which the Work is included in its entirety in unmodified form along 45 | with one or more other contributions, each constituting separate and 46 | independent works in themselves, which together are assembled into a 47 | collective whole. A work that constitutes a Collection will not be 48 | considered an Adaptation (as defined above) for the purposes of this 49 | License. 50 | c. "Distribute" means to make available to the public the original and 51 | copies of the Work or Adaptation, as appropriate, through sale or 52 | other transfer of ownership. 53 | d. "License Elements" means the following high-level license attributes 54 | as selected by Licensor and indicated in the title of this License: 55 | Attribution, Noncommercial, ShareAlike. 56 | e. "Licensor" means the individual, individuals, entity or entities that 57 | offer(s) the Work under the terms of this License. 58 | f. "Original Author" means, in the case of a literary or artistic work, 59 | the individual, individuals, entity or entities who created the Work 60 | or if no individual or entity can be identified, the publisher; and in 61 | addition (i) in the case of a performance the actors, singers, 62 | musicians, dancers, and other persons who act, sing, deliver, declaim, 63 | play in, interpret or otherwise perform literary or artistic works or 64 | expressions of folklore; (ii) in the case of a phonogram the producer 65 | being the person or legal entity who first fixes the sounds of a 66 | performance or other sounds; and, (iii) in the case of broadcasts, the 67 | organization that transmits the broadcast. 68 | g. "Work" means the literary and/or artistic work offered under the terms 69 | of this License including without limitation any production in the 70 | literary, scientific and artistic domain, whatever may be the mode or 71 | form of its expression including digital form, such as a book, 72 | pamphlet and other writing; a lecture, address, sermon or other work 73 | of the same nature; a dramatic or dramatico-musical work; a 74 | choreographic work or entertainment in dumb show; a musical 75 | composition with or without words; a cinematographic work to which are 76 | assimilated works expressed by a process analogous to cinematography; 77 | a work of drawing, painting, architecture, sculpture, engraving or 78 | lithography; a photographic work to which are assimilated works 79 | expressed by a process analogous to photography; a work of applied 80 | art; an illustration, map, plan, sketch or three-dimensional work 81 | relative to geography, topography, architecture or science; a 82 | performance; a broadcast; a phonogram; a compilation of data to the 83 | extent it is protected as a copyrightable work; or a work performed by 84 | a variety or circus performer to the extent it is not otherwise 85 | considered a literary or artistic work. 86 | h. "You" means an individual or entity exercising rights under this 87 | License who has not previously violated the terms of this License with 88 | respect to the Work, or who has received express permission from the 89 | Licensor to exercise rights under this License despite a previous 90 | violation. 91 | i. "Publicly Perform" means to perform public recitations of the Work and 92 | to communicate to the public those public recitations, by any means or 93 | process, including by wire or wireless means or public digital 94 | performances; to make available to the public Works in such a way that 95 | members of the public may access these Works from a place and at a 96 | place individually chosen by them; to perform the Work to the public 97 | by any means or process and the communication to the public of the 98 | performances of the Work, including by public digital performance; to 99 | broadcast and rebroadcast the Work by any means including signs, 100 | sounds or images. 101 | j. "Reproduce" means to make copies of the Work by any means including 102 | without limitation by sound or visual recordings and the right of 103 | fixation and reproducing fixations of the Work, including storage of a 104 | protected performance or phonogram in digital form or other electronic 105 | medium. 106 | 107 | 2. Fair Dealing Rights. Nothing in this License is intended to reduce, 108 | limit, or restrict any uses free from copyright or rights arising from 109 | limitations or exceptions that are provided for in connection with the 110 | copyright protection under copyright law or other applicable laws. 111 | 112 | 3. License Grant. Subject to the terms and conditions of this License, 113 | Licensor hereby grants You a worldwide, royalty-free, non-exclusive, 114 | perpetual (for the duration of the applicable copyright) license to 115 | exercise the rights in the Work as stated below: 116 | 117 | a. to Reproduce the Work, to incorporate the Work into one or more 118 | Collections, and to Reproduce the Work as incorporated in the 119 | Collections; 120 | b. to create and Reproduce Adaptations provided that any such Adaptation, 121 | including any translation in any medium, takes reasonable steps to 122 | clearly label, demarcate or otherwise identify that changes were made 123 | to the original Work. For example, a translation could be marked "The 124 | original work was translated from English to Spanish," or a 125 | modification could indicate "The original work has been modified."; 126 | c. to Distribute and Publicly Perform the Work including as incorporated 127 | in Collections; and, 128 | d. to Distribute and Publicly Perform Adaptations. 129 | 130 | The above rights may be exercised in all media and formats whether now 131 | known or hereafter devised. The above rights include the right to make 132 | such modifications as are technically necessary to exercise the rights in 133 | other media and formats. Subject to Section 8(f), all rights not expressly 134 | granted by Licensor are hereby reserved, including but not limited to the 135 | rights described in Section 4(e). 136 | 137 | 4. Restrictions. The license granted in Section 3 above is expressly made 138 | subject to and limited by the following restrictions: 139 | 140 | a. You may Distribute or Publicly Perform the Work only under the terms 141 | of this License. You must include a copy of, or the Uniform Resource 142 | Identifier (URI) for, this License with every copy of the Work You 143 | Distribute or Publicly Perform. You may not offer or impose any terms 144 | on the Work that restrict the terms of this License or the ability of 145 | the recipient of the Work to exercise the rights granted to that 146 | recipient under the terms of the License. You may not sublicense the 147 | Work. You must keep intact all notices that refer to this License and 148 | to the disclaimer of warranties with every copy of the Work You 149 | Distribute or Publicly Perform. When You Distribute or Publicly 150 | Perform the Work, You may not impose any effective technological 151 | measures on the Work that restrict the ability of a recipient of the 152 | Work from You to exercise the rights granted to that recipient under 153 | the terms of the License. This Section 4(a) applies to the Work as 154 | incorporated in a Collection, but this does not require the Collection 155 | apart from the Work itself to be made subject to the terms of this 156 | License. If You create a Collection, upon notice from any Licensor You 157 | must, to the extent practicable, remove from the Collection any credit 158 | as required by Section 4(d), as requested. If You create an 159 | Adaptation, upon notice from any Licensor You must, to the extent 160 | practicable, remove from the Adaptation any credit as required by 161 | Section 4(d), as requested. 162 | b. You may Distribute or Publicly Perform an Adaptation only under: (i) 163 | the terms of this License; (ii) a later version of this License with 164 | the same License Elements as this License; (iii) a Creative Commons 165 | jurisdiction license (either this or a later license version) that 166 | contains the same License Elements as this License (e.g., 167 | Attribution-NonCommercial-ShareAlike 3.0 US) ("Applicable License"). 168 | You must include a copy of, or the URI, for Applicable License with 169 | every copy of each Adaptation You Distribute or Publicly Perform. You 170 | may not offer or impose any terms on the Adaptation that restrict the 171 | terms of the Applicable License or the ability of the recipient of the 172 | Adaptation to exercise the rights granted to that recipient under the 173 | terms of the Applicable License. You must keep intact all notices that 174 | refer to the Applicable License and to the disclaimer of warranties 175 | with every copy of the Work as included in the Adaptation You 176 | Distribute or Publicly Perform. When You Distribute or Publicly 177 | Perform the Adaptation, You may not impose any effective technological 178 | measures on the Adaptation that restrict the ability of a recipient of 179 | the Adaptation from You to exercise the rights granted to that 180 | recipient under the terms of the Applicable License. This Section 4(b) 181 | applies to the Adaptation as incorporated in a Collection, but this 182 | does not require the Collection apart from the Adaptation itself to be 183 | made subject to the terms of the Applicable License. 184 | c. You may not exercise any of the rights granted to You in Section 3 185 | above in any manner that is primarily intended for or directed toward 186 | commercial advantage or private monetary compensation. The exchange of 187 | the Work for other copyrighted works by means of digital file-sharing 188 | or otherwise shall not be considered to be intended for or directed 189 | toward commercial advantage or private monetary compensation, provided 190 | there is no payment of any monetary compensation in con-nection with 191 | the exchange of copyrighted works. 192 | d. If You Distribute, or Publicly Perform the Work or any Adaptations or 193 | Collections, You must, unless a request has been made pursuant to 194 | Section 4(a), keep intact all copyright notices for the Work and 195 | provide, reasonable to the medium or means You are utilizing: (i) the 196 | name of the Original Author (or pseudonym, if applicable) if supplied, 197 | and/or if the Original Author and/or Licensor designate another party 198 | or parties (e.g., a sponsor institute, publishing entity, journal) for 199 | attribution ("Attribution Parties") in Licensor's copyright notice, 200 | terms of service or by other reasonable means, the name of such party 201 | or parties; (ii) the title of the Work if supplied; (iii) to the 202 | extent reasonably practicable, the URI, if any, that Licensor 203 | specifies to be associated with the Work, unless such URI does not 204 | refer to the copyright notice or licensing information for the Work; 205 | and, (iv) consistent with Section 3(b), in the case of an Adaptation, 206 | a credit identifying the use of the Work in the Adaptation (e.g., 207 | "French translation of the Work by Original Author," or "Screenplay 208 | based on original Work by Original Author"). The credit required by 209 | this Section 4(d) may be implemented in any reasonable manner; 210 | provided, however, that in the case of a Adaptation or Collection, at 211 | a minimum such credit will appear, if a credit for all contributing 212 | authors of the Adaptation or Collection appears, then as part of these 213 | credits and in a manner at least as prominent as the credits for the 214 | other contributing authors. For the avoidance of doubt, You may only 215 | use the credit required by this Section for the purpose of attribution 216 | in the manner set out above and, by exercising Your rights under this 217 | License, You may not implicitly or explicitly assert or imply any 218 | connection with, sponsorship or endorsement by the Original Author, 219 | Licensor and/or Attribution Parties, as appropriate, of You or Your 220 | use of the Work, without the separate, express prior written 221 | permission of the Original Author, Licensor and/or Attribution 222 | Parties. 223 | e. For the avoidance of doubt: 224 | 225 | i. Non-waivable Compulsory License Schemes. In those jurisdictions in 226 | which the right to collect royalties through any statutory or 227 | compulsory licensing scheme cannot be waived, the Licensor 228 | reserves the exclusive right to collect such royalties for any 229 | exercise by You of the rights granted under this License; 230 | ii. Waivable Compulsory License Schemes. In those jurisdictions in 231 | which the right to collect royalties through any statutory or 232 | compulsory licensing scheme can be waived, the Licensor reserves 233 | the exclusive right to collect such royalties for any exercise by 234 | You of the rights granted under this License if Your exercise of 235 | such rights is for a purpose or use which is otherwise than 236 | noncommercial as permitted under Section 4(c) and otherwise waives 237 | the right to collect royalties through any statutory or compulsory 238 | licensing scheme; and, 239 | iii. Voluntary License Schemes. The Licensor reserves the right to 240 | collect royalties, whether individually or, in the event that the 241 | Licensor is a member of a collecting society that administers 242 | voluntary licensing schemes, via that society, from any exercise 243 | by You of the rights granted under this License that is for a 244 | purpose or use which is otherwise than noncommercial as permitted 245 | under Section 4(c). 246 | f. Except as otherwise agreed in writing by the Licensor or as may be 247 | otherwise permitted by applicable law, if You Reproduce, Distribute or 248 | Publicly Perform the Work either by itself or as part of any 249 | Adaptations or Collections, You must not distort, mutilate, modify or 250 | take other derogatory action in relation to the Work which would be 251 | prejudicial to the Original Author's honor or reputation. Licensor 252 | agrees that in those jurisdictions (e.g. Japan), in which any exercise 253 | of the right granted in Section 3(b) of this License (the right to 254 | make Adaptations) would be deemed to be a distortion, mutilation, 255 | modification or other derogatory action prejudicial to the Original 256 | Author's honor and reputation, the Licensor will waive or not assert, 257 | as appropriate, this Section, to the fullest extent permitted by the 258 | applicable national law, to enable You to reasonably exercise Your 259 | right under Section 3(b) of this License (right to make Adaptations) 260 | but not otherwise. 261 | 262 | 5. Representations, Warranties and Disclaimer 263 | 264 | UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING AND TO THE 265 | FULLEST EXTENT PERMITTED BY APPLICABLE LAW, LICENSOR OFFERS THE WORK AS-IS 266 | AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE 267 | WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT 268 | LIMITATION, WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 269 | PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, 270 | ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT 271 | DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED 272 | WARRANTIES, SO THIS EXCLUSION MAY NOT APPLY TO YOU. 273 | 274 | 6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE 275 | LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR 276 | ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES 277 | ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS 278 | BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 279 | 280 | 7. Termination 281 | 282 | a. This License and the rights granted hereunder will terminate 283 | automatically upon any breach by You of the terms of this License. 284 | Individuals or entities who have received Adaptations or Collections 285 | from You under this License, however, will not have their licenses 286 | terminated provided such individuals or entities remain in full 287 | compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will 288 | survive any termination of this License. 289 | b. Subject to the above terms and conditions, the license granted here is 290 | perpetual (for the duration of the applicable copyright in the Work). 291 | Notwithstanding the above, Licensor reserves the right to release the 292 | Work under different license terms or to stop distributing the Work at 293 | any time; provided, however that any such election will not serve to 294 | withdraw this License (or any other license that has been, or is 295 | required to be, granted under the terms of this License), and this 296 | License will continue in full force and effect unless terminated as 297 | stated above. 298 | 299 | 8. Miscellaneous 300 | 301 | a. Each time You Distribute or Publicly Perform the Work or a Collection, 302 | the Licensor offers to the recipient a license to the Work on the same 303 | terms and conditions as the license granted to You under this License. 304 | b. Each time You Distribute or Publicly Perform an Adaptation, Licensor 305 | offers to the recipient a license to the original Work on the same 306 | terms and conditions as the license granted to You under this License. 307 | c. If any provision of this License is invalid or unenforceable under 308 | applicable law, it shall not affect the validity or enforceability of 309 | the remainder of the terms of this License, and without further action 310 | by the parties to this agreement, such provision shall be reformed to 311 | the minimum extent necessary to make such provision valid and 312 | enforceable. 313 | d. No term or provision of this License shall be deemed waived and no 314 | breach consented to unless such waiver or consent shall be in writing 315 | and signed by the party to be charged with such waiver or consent. 316 | e. This License constitutes the entire agreement between the parties with 317 | respect to the Work licensed here. There are no understandings, 318 | agreements or representations with respect to the Work not specified 319 | here. Licensor shall not be bound by any additional provisions that 320 | may appear in any communication from You. This License may not be 321 | modified without the mutual written agreement of the Licensor and You. 322 | f. The rights granted under, and the subject matter referenced, in this 323 | License were drafted utilizing the terminology of the Berne Convention 324 | for the Protection of Literary and Artistic Works (as amended on 325 | September 28, 1979), the Rome Convention of 1961, the WIPO Copyright 326 | Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 327 | and the Universal Copyright Convention (as revised on July 24, 1971). 328 | These rights and subject matter take effect in the relevant 329 | jurisdiction in which the License terms are sought to be enforced 330 | according to the corresponding provisions of the implementation of 331 | those treaty provisions in the applicable national law. If the 332 | standard suite of rights granted under applicable copyright law 333 | includes additional rights not granted under this License, such 334 | additional rights are deemed to be included in the License; this 335 | License is not intended to restrict the license of any rights under 336 | applicable law. 337 | 338 | 339 | Creative Commons Notice 340 | 341 | Creative Commons is not a party to this License, and makes no warranty 342 | whatsoever in connection with the Work. Creative Commons will not be 343 | liable to You or any party on any legal theory for any damages 344 | whatsoever, including without limitation any general, special, 345 | incidental or consequential damages arising in connection to this 346 | license. Notwithstanding the foregoing two (2) sentences, if Creative 347 | Commons has expressly identified itself as the Licensor hereunder, it 348 | shall have all rights and obligations of Licensor. 349 | 350 | Except for the limited purpose of indicating to the public that the 351 | Work is licensed under the CCPL, Creative Commons does not authorize 352 | the use by either party of the trademark "Creative Commons" or any 353 | related trademark or logo of Creative Commons without the prior 354 | written consent of Creative Commons. Any permitted use will be in 355 | compliance with Creative Commons' then-current trademark usage 356 | guidelines, as may be published on its website or otherwise made 357 | available upon request from time to time. For the avoidance of doubt, 358 | this trademark restriction does not form part of this License. 359 | 360 | Creative Commons may be contacted at https://creativecommons.org/. 361 | 362 | -------------------------------------------------------------------------------- /assets/Thumbs.db: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/Thumbs.db -------------------------------------------------------------------------------- /assets/fonts/Aldrich-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/fonts/Aldrich-Regular.ttf -------------------------------------------------------------------------------- /assets/music/track1.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/music/track1.ogg -------------------------------------------------------------------------------- /assets/music/track10.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/music/track10.ogg -------------------------------------------------------------------------------- /assets/music/track2.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/music/track2.ogg -------------------------------------------------------------------------------- /assets/music/track3.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/music/track3.ogg -------------------------------------------------------------------------------- /assets/music/track4.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/music/track4.ogg -------------------------------------------------------------------------------- /assets/music/track5.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/music/track5.ogg -------------------------------------------------------------------------------- /assets/music/track6.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/music/track6.ogg -------------------------------------------------------------------------------- /assets/music/track7.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/music/track7.ogg -------------------------------------------------------------------------------- /assets/music/track8.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/music/track8.ogg -------------------------------------------------------------------------------- /assets/music/track9.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/music/track9.ogg -------------------------------------------------------------------------------- /assets/objects/asteroid1-radar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/objects/asteroid1-radar.png -------------------------------------------------------------------------------- /assets/objects/asteroid1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/objects/asteroid1.png -------------------------------------------------------------------------------- /assets/objects/asteroid2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/objects/asteroid2.png -------------------------------------------------------------------------------- /assets/palettes.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 23 | 27 | 31 | 35 | 39 | 40 | 50 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | 80 | 81 | 82 | 102 | 104 | 105 | 107 | image/svg+xml 108 | 110 | 111 | 112 | 113 | 114 | 118 | 125 | 132 | 139 | 146 | 153 | 160 | 167 | 174 | 181 | 188 | 195 | 202 | 209 | 216 | 223 | 230 | 237 | 244 | 251 | 258 | 265 | 272 | 279 | 286 | 293 | 300 | 307 | 314 | 321 | 328 | 335 | 342 | 349 | 356 | 363 | 370 | 377 | 384 | 391 | 398 | 405 | 406 | 407 | -------------------------------------------------------------------------------- /assets/particles/VFX-0-Circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/particles/VFX-0-Circle.png -------------------------------------------------------------------------------- /assets/particles/VFX-0-Star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/particles/VFX-0-Star.png -------------------------------------------------------------------------------- /assets/particles/VFX-1-Star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/particles/VFX-1-Star.png -------------------------------------------------------------------------------- /assets/particles/particle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/particles/particle.png -------------------------------------------------------------------------------- /assets/particles/particle3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/particles/particle3.png -------------------------------------------------------------------------------- /assets/particles/particles-0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/particles/particles-0.png -------------------------------------------------------------------------------- /assets/particles/particles.atlas: -------------------------------------------------------------------------------- 1 | {"particles-0.png": {"VFX-0-Circle": [70, 94, 32, 32], "smokeparticle": [36, 94, 32, 32], "VFX-0-Star": [2, 60, 32, 32], "particle": [2, 94, 32, 32], "VFX-1-Star": [36, 60, 32, 32]}} -------------------------------------------------------------------------------- /assets/particles/smallsquare.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/particles/smallsquare.png -------------------------------------------------------------------------------- /assets/particles/smokeparticle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/particles/smokeparticle.png -------------------------------------------------------------------------------- /assets/projectiles/bullet-14px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/projectiles/bullet-14px.png -------------------------------------------------------------------------------- /assets/projectiles/bullet-6px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/projectiles/bullet-6px.png -------------------------------------------------------------------------------- /assets/projectiles/bullet-8px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/projectiles/bullet-8px.png -------------------------------------------------------------------------------- /assets/projectiles/rocket-14px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/projectiles/rocket-14px.png -------------------------------------------------------------------------------- /assets/projectiles/rocket-6px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/projectiles/rocket-6px.png -------------------------------------------------------------------------------- /assets/projectiles/rocket-8px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/projectiles/rocket-8px.png -------------------------------------------------------------------------------- /assets/shaders/poscolorshader.glsl: -------------------------------------------------------------------------------- 1 | ---VERTEX SHADER--- 2 | #ifdef GL_ES 3 | precision highp float; 4 | #endif 5 | 6 | /* Outputs to the fragment shader */ 7 | varying vec4 frag_color; 8 | 9 | /* vertex attributes */ 10 | attribute vec2 pos; 11 | attribute vec4 v_color; 12 | 13 | 14 | /* uniform variables */ 15 | uniform mat4 modelview_mat; 16 | uniform mat4 projection_mat; 17 | uniform vec4 color; 18 | uniform float opacity; 19 | 20 | void main (void) { 21 | frag_color = v_color*color*vec4(1., 1., 1., opacity); 22 | vec4 pos = vec4(pos.xy, 0.0, 1.0); 23 | gl_Position = projection_mat * modelview_mat * pos; 24 | 25 | } 26 | 27 | 28 | ---FRAGMENT SHADER--- 29 | #ifdef GL_ES 30 | precision highp float; 31 | #endif 32 | 33 | /* Outputs from the vertex shader */ 34 | varying vec4 frag_color; 35 | 36 | void main (void){ 37 | gl_FragColor = frag_color; 38 | } 39 | -------------------------------------------------------------------------------- /assets/shaders/positionrotatecolorscale.glsl: -------------------------------------------------------------------------------- 1 | ---VERTEX SHADER--- 2 | #ifdef GL_ES 3 | precision highp float; 4 | #endif 5 | 6 | /* Outputs to the fragment shader */ 7 | varying vec4 frag_color; 8 | varying vec2 tex_coord0; 9 | 10 | /* vertex attributes */ 11 | attribute vec2 pos; 12 | attribute vec2 uvs; 13 | attribute vec2 center; 14 | attribute vec2 scale; 15 | attribute vec4 v_color; 16 | attribute float rotate; 17 | 18 | /* uniform variables */ 19 | uniform mat4 modelview_mat; 20 | uniform mat4 projection_mat; 21 | uniform vec4 color; 22 | uniform float opacity; 23 | 24 | void main (void) { 25 | frag_color = v_color * color * vec4(1., 1., 1., opacity); 26 | tex_coord0 = uvs; 27 | float a_sin = sin(rotate); 28 | float a_cos = cos(rotate); 29 | mat4 rot_mat = mat4(a_cos, -a_sin, 0.0, 0.0, 30 | a_sin, a_cos, 0.0, 0.0, 31 | 0.0, 0.0, 1.0, 0.0, 32 | 0.0, 0.0, 0.0, 1.0 ); 33 | mat4 trans_mat = mat4(1.0, 0.0, 0.0, center.x, 34 | 0.0, 1.0, 0.0, center.y, 35 | 0.0, 0.0, 1.0, 0.0, 36 | 0.0, 0.0, 0.0, 1.0); 37 | vec4 t_pos = vec4(pos.xy*scale.xy, 0.0, 1.0); 38 | vec4 trans_pos = t_pos * rot_mat * trans_mat; 39 | gl_Position = projection_mat * modelview_mat * trans_pos; 40 | 41 | } 42 | 43 | 44 | ---FRAGMENT SHADER--- 45 | #ifdef GL_ES 46 | precision highp float; 47 | #endif 48 | 49 | /* Outputs from the vertex shader */ 50 | varying vec4 frag_color; 51 | varying vec2 tex_coord0; 52 | 53 | /* uniform texture samplers */ 54 | uniform sampler2D texture0; 55 | 56 | void main (void){ 57 | gl_FragColor = frag_color * texture2D(texture0, tex_coord0); 58 | } 59 | -------------------------------------------------------------------------------- /assets/shaders/positionrotatecolorshader.glsl: -------------------------------------------------------------------------------- 1 | ---VERTEX SHADER--- 2 | #ifdef GL_ES 3 | precision highp float; 4 | #endif 5 | 6 | /* Outputs to the fragment shader */ 7 | varying vec4 frag_color; 8 | varying vec2 tex_coord0; 9 | 10 | /* vertex attributes */ 11 | attribute vec2 pos; 12 | attribute vec2 uvs; 13 | attribute float rot; 14 | attribute vec2 center; 15 | attribute vec4 v_color; 16 | 17 | /* uniform variables */ 18 | uniform mat4 modelview_mat; 19 | uniform mat4 projection_mat; 20 | uniform vec4 color; 21 | uniform float opacity; 22 | 23 | void main (void) { 24 | frag_color = v_color * color * vec4(1.0, 1., 1.0, opacity); 25 | tex_coord0 = uvs; 26 | float a_sin = sin(rot); 27 | float a_cos = cos(rot); 28 | mat4 rot_mat = mat4(a_cos, -a_sin, 0.0, 0.0, 29 | a_sin, a_cos, 0.0, 0.0, 30 | 0.0, 0.0, 1.0, 0.0, 31 | 0.0, 0.0, 0.0, 1.0 ); 32 | mat4 trans_mat = mat4(1.0, 0.0, 0.0, center.x, 33 | 0.0, 1.0, 0.0, center.y, 34 | 0.0, 0.0, 1.0, 0.0, 35 | 0.0, 0.0, 0.0, 1.0); 36 | vec4 new_pos = vec4(pos.xy, 0.0, 1.0); 37 | vec4 trans_pos = new_pos * rot_mat * trans_mat; 38 | gl_Position = projection_mat * modelview_mat * trans_pos; 39 | 40 | } 41 | 42 | 43 | ---FRAGMENT SHADER--- 44 | #ifdef GL_ES 45 | precision highp float; 46 | #endif 47 | 48 | /* Outputs from the vertex shader */ 49 | varying vec4 frag_color; 50 | varying vec2 tex_coord0; 51 | 52 | /* uniform texture samplers */ 53 | uniform sampler2D texture0; 54 | 55 | void main (void){ 56 | gl_FragColor = frag_color * texture2D(texture0, tex_coord0); 57 | } 58 | -------------------------------------------------------------------------------- /assets/shaders/positionrotateshader.glsl: -------------------------------------------------------------------------------- 1 | ---VERTEX SHADER--- 2 | #ifdef GL_ES 3 | precision highp float; 4 | #endif 5 | 6 | /* Outputs to the fragment shader */ 7 | varying vec4 frag_color; 8 | varying vec2 tex_coord0; 9 | 10 | /* vertex attributes */ 11 | attribute vec2 pos; 12 | attribute vec2 uvs; 13 | attribute float rot; 14 | attribute vec2 center; 15 | 16 | /* uniform variables */ 17 | uniform mat4 modelview_mat; 18 | uniform mat4 projection_mat; 19 | uniform vec4 color; 20 | uniform float opacity; 21 | 22 | void main (void) { 23 | frag_color = color * vec4(1.0, 1., 1.0, opacity); 24 | tex_coord0 = uvs; 25 | float a_sin = sin(rot); 26 | float a_cos = cos(rot); 27 | mat4 rot_mat = mat4(a_cos, -a_sin, 0.0, 0.0, 28 | a_sin, a_cos, 0.0, 0.0, 29 | 0.0, 0.0, 1.0, 0.0, 30 | 0.0, 0.0, 0.0, 1.0 ); 31 | mat4 trans_mat = mat4(1.0, 0.0, 0.0, center.x, 32 | 0.0, 1.0, 0.0, center.y, 33 | 0.0, 0.0, 1.0, 0.0, 34 | 0.0, 0.0, 0.0, 1.0); 35 | vec4 new_pos = vec4(pos.xy, 0.0, 1.0); 36 | vec4 trans_pos = new_pos * rot_mat * trans_mat; 37 | gl_Position = projection_mat * modelview_mat * trans_pos; 38 | 39 | } 40 | 41 | 42 | ---FRAGMENT SHADER--- 43 | #ifdef GL_ES 44 | precision highp float; 45 | #endif 46 | 47 | /* Outputs from the vertex shader */ 48 | varying vec4 frag_color; 49 | varying vec2 tex_coord0; 50 | 51 | /* uniform texture samplers */ 52 | uniform sampler2D texture0; 53 | 54 | void main (void){ 55 | gl_FragColor = frag_color * texture2D(texture0, tex_coord0); 56 | } 57 | -------------------------------------------------------------------------------- /assets/ships/Cruiser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ships/Cruiser.png -------------------------------------------------------------------------------- /assets/ships/probe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ships/probe.png -------------------------------------------------------------------------------- /assets/ships/probelight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ships/probelight.png -------------------------------------------------------------------------------- /assets/ships/ship1-radar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ships/ship1-radar.png -------------------------------------------------------------------------------- /assets/ships/ship1-shields.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ships/ship1-shields.png -------------------------------------------------------------------------------- /assets/ships/ship1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ships/ship1.png -------------------------------------------------------------------------------- /assets/ships/ship2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ships/ship2.png -------------------------------------------------------------------------------- /assets/ships/ship3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ships/ship3.png -------------------------------------------------------------------------------- /assets/ships/ship5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ships/ship5.png -------------------------------------------------------------------------------- /assets/ships/ship6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ships/ship6.png -------------------------------------------------------------------------------- /assets/ships/ship7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ships/ship7.png -------------------------------------------------------------------------------- /assets/ships/ship8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ships/ship8.png -------------------------------------------------------------------------------- /assets/soundfx/asteroidhitasteroid.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/asteroidhitasteroid.ogg -------------------------------------------------------------------------------- /assets/soundfx/asteroidhitasteroid.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/asteroidhitasteroid.wav -------------------------------------------------------------------------------- /assets/soundfx/asteroidhitship.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/asteroidhitship.ogg -------------------------------------------------------------------------------- /assets/soundfx/blaster/hit.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/blaster/hit.wav -------------------------------------------------------------------------------- /assets/soundfx/blaster/reload-end.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/blaster/reload-end.wav -------------------------------------------------------------------------------- /assets/soundfx/blaster/reload-laser.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/blaster/reload-laser.wav -------------------------------------------------------------------------------- /assets/soundfx/blaster/shoot.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/blaster/shoot.wav -------------------------------------------------------------------------------- /assets/soundfx/bulletfire.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/bulletfire.ogg -------------------------------------------------------------------------------- /assets/soundfx/bullethitasteroid.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/bullethitasteroid.ogg -------------------------------------------------------------------------------- /assets/soundfx/bullethitbullet.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/bullethitbullet.ogg -------------------------------------------------------------------------------- /assets/soundfx/enemyshipenterarea.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/enemyshipenterarea.ogg -------------------------------------------------------------------------------- /assets/soundfx/explosion.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/explosion.wav -------------------------------------------------------------------------------- /assets/soundfx/hit2.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/hit2.wav -------------------------------------------------------------------------------- /assets/soundfx/lazerhitraw.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/lazerhitraw.wav -------------------------------------------------------------------------------- /assets/soundfx/probepickup.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/probepickup.ogg -------------------------------------------------------------------------------- /assets/soundfx/rifle/hit.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/rifle/hit.wav -------------------------------------------------------------------------------- /assets/soundfx/rifle/reload-begin.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/rifle/reload-begin.ogg -------------------------------------------------------------------------------- /assets/soundfx/rifle/reload-begin.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/rifle/reload-begin.wav -------------------------------------------------------------------------------- /assets/soundfx/rifle/reload-end.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/rifle/reload-end.ogg -------------------------------------------------------------------------------- /assets/soundfx/rifle/reload-end.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/rifle/reload-end.wav -------------------------------------------------------------------------------- /assets/soundfx/rifle/reload.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/rifle/reload.wav -------------------------------------------------------------------------------- /assets/soundfx/rifle/shoot.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/rifle/shoot.ogg -------------------------------------------------------------------------------- /assets/soundfx/rifle/shoot.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/rifle/shoot.wav -------------------------------------------------------------------------------- /assets/soundfx/rocketexplosion.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/rocketexplosion.ogg -------------------------------------------------------------------------------- /assets/soundfx/rocketfire.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/rocketfire.ogg -------------------------------------------------------------------------------- /assets/soundfx/shipengine.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/shipengine.wav -------------------------------------------------------------------------------- /assets/soundfx/shipexplosion.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/shipexplosion.ogg -------------------------------------------------------------------------------- /assets/soundfx/shiphit.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/shiphit.wav -------------------------------------------------------------------------------- /assets/soundfx/shiphitbybullet.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/shiphitbybullet.ogg -------------------------------------------------------------------------------- /assets/soundfx/shotgun/hit.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/shotgun/hit.wav -------------------------------------------------------------------------------- /assets/soundfx/shotgun/reload-begin.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/shotgun/reload-begin.wav -------------------------------------------------------------------------------- /assets/soundfx/shotgun/reload-end.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/shotgun/reload-end.wav -------------------------------------------------------------------------------- /assets/soundfx/shotgun/shoot.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/soundfx/shotgun/shoot.wav -------------------------------------------------------------------------------- /assets/ui_elements/asteroid-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ui_elements/asteroid-icon.png -------------------------------------------------------------------------------- /assets/ui_elements/bulleticon-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ui_elements/bulleticon-down.png -------------------------------------------------------------------------------- /assets/ui_elements/bulleticon-normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ui_elements/bulleticon-normal.png -------------------------------------------------------------------------------- /assets/ui_elements/forward-shippanel-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ui_elements/forward-shippanel-icon.png -------------------------------------------------------------------------------- /assets/ui_elements/left-shippanel-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ui_elements/left-shippanel-icon.png -------------------------------------------------------------------------------- /assets/ui_elements/probe-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ui_elements/probe-icon.png -------------------------------------------------------------------------------- /assets/ui_elements/right-shippanel-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ui_elements/right-shippanel-icon.png -------------------------------------------------------------------------------- /assets/ui_elements/rocketicon-down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ui_elements/rocketicon-down.png -------------------------------------------------------------------------------- /assets/ui_elements/rocketicon-normal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ui_elements/rocketicon-normal.png -------------------------------------------------------------------------------- /assets/ui_elements/ship-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ui_elements/ship-icon.png -------------------------------------------------------------------------------- /assets/ui_elements/unexplored-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/assets/ui_elements/unexplored-icon.png -------------------------------------------------------------------------------- /assets/vfx/asteroidexplosion.kep: -------------------------------------------------------------------------------- 1 | (dp1 2 | S'end_rotation_variance' 3 | p2 4 | F360 5 | sS'radial_acceleration_variance' 6 | p3 7 | F0 8 | sS'life_span_variance' 9 | p4 10 | F0 11 | sS'start_rotation_variance' 12 | p5 13 | F0 14 | sS'rotate_per_second_variance' 15 | p6 16 | F0 17 | sS'end_scale' 18 | p7 19 | F0.5 20 | sS'paused' 21 | p8 22 | I00 23 | sS'start_scale' 24 | p9 25 | F1.7000000476837158 26 | sS'speed' 27 | p10 28 | F50 29 | sS'life_span' 30 | p11 31 | F1 32 | sS'max_radius_variance' 33 | p12 34 | F0 35 | sS'gravity' 36 | p13 37 | (lp14 38 | F0 39 | aF0 40 | asS'texture' 41 | p15 42 | S'particle3' 43 | p16 44 | sS'tangential_acceleration' 45 | p17 46 | F0 47 | sS'pos_offset' 48 | p18 49 | (lp19 50 | F0 51 | aF0 52 | asS'min_radius' 53 | p20 54 | F0 55 | sS'emit_angle_offset' 56 | p21 57 | F0 58 | sS'pos_variance' 59 | p22 60 | (lp23 61 | F0 62 | aF0 63 | asS'start_color_variance' 64 | p24 65 | (lp25 66 | I0 67 | aI0 68 | aI0 69 | aI0 70 | asS'number_of_particles' 71 | p26 72 | I30 73 | sS'effect_name' 74 | p27 75 | S'effect_test' 76 | p28 77 | sS'start_rotation' 78 | p29 79 | F0 80 | sS'emit_angle_variance' 81 | p30 82 | F360 83 | sS'radial_acceleration' 84 | p31 85 | F-73 86 | sS'end_scale_variance' 87 | p32 88 | F0.25 89 | sS'end_color' 90 | p33 91 | (lp34 92 | I158 93 | aI158 94 | aI158 95 | aI255 96 | asS'max_radius' 97 | p35 98 | F25 99 | sS'speed_variance' 100 | p36 101 | F0 102 | sS'rotate_per_second' 103 | p37 104 | F0 105 | sS'start_color' 106 | p38 107 | (lp39 108 | I133 109 | aI133 110 | aI133 111 | aI0 112 | asS'end_rotation' 113 | p40 114 | F0 115 | sS'emitter_type' 116 | p41 117 | I0 118 | sS'tangential_acceleration_variance' 119 | p42 120 | F0 121 | sS'end_color_variance' 122 | p43 123 | (lp44 124 | I0 125 | aI0 126 | aI0 127 | aI0 128 | asS'start_scale_variance' 129 | p45 130 | F0.10000000149011612 131 | s. -------------------------------------------------------------------------------- /assets/vfx/blaster_projectile.kep: -------------------------------------------------------------------------------- 1 | (dp1 2 | S'end_rotation_variance' 3 | p2 4 | F0 5 | sS'radial_acceleration_variance' 6 | p3 7 | F0 8 | sS'life_span_variance' 9 | p4 10 | F0 11 | sS'start_rotation_variance' 12 | p5 13 | F0 14 | sS'rotate_per_second_variance' 15 | p6 16 | F0 17 | sS'end_scale' 18 | p7 19 | F2.25 20 | sS'paused' 21 | p8 22 | I00 23 | sS'start_scale' 24 | p9 25 | F1.1000000238418579 26 | sS'speed' 27 | p10 28 | F50 29 | sS'life_span' 30 | p11 31 | F0.10000000149011612 32 | sS'max_radius_variance' 33 | p12 34 | F0 35 | sS'gravity' 36 | p13 37 | (lp14 38 | F0 39 | aF0 40 | asS'texture' 41 | p15 42 | S'particle' 43 | p16 44 | sS'tangential_acceleration' 45 | p17 46 | F0 47 | sS'pos_offset' 48 | p18 49 | (lp19 50 | F0 51 | aF0 52 | asS'min_radius' 53 | p20 54 | F0 55 | sS'emit_angle_offset' 56 | p21 57 | F180 58 | sS'pos_variance' 59 | p22 60 | (lp23 61 | F0 62 | aF0 63 | asS'start_color_variance' 64 | p24 65 | (lp25 66 | I0 67 | aI0 68 | aI0 69 | aI0 70 | asS'number_of_particles' 71 | p26 72 | I10 73 | sS'effect_name' 74 | p27 75 | S'effect_test' 76 | p28 77 | sS'start_rotation' 78 | p29 79 | F0 80 | sS'emit_angle_variance' 81 | p30 82 | F0 83 | sS'radial_acceleration' 84 | p31 85 | F0 86 | sS'end_scale_variance' 87 | p32 88 | F1.2400000095367432 89 | sS'end_color' 90 | p33 91 | (lp34 92 | I255 93 | aI0 94 | aI255 95 | aI0 96 | asS'max_radius' 97 | p35 98 | F25 99 | sS'speed_variance' 100 | p36 101 | F0 102 | sS'rotate_per_second' 103 | p37 104 | F0 105 | sS'start_color' 106 | p38 107 | (lp39 108 | I0 109 | aI110 110 | aI255 111 | aI255 112 | asS'end_rotation' 113 | p40 114 | F0 115 | sS'emitter_type' 116 | p41 117 | I0 118 | sS'tangential_acceleration_variance' 119 | p42 120 | F0 121 | sS'end_color_variance' 122 | p43 123 | (lp44 124 | I0 125 | aI0 126 | aI0 127 | aI0 128 | asS'start_scale_variance' 129 | p45 130 | F0.20000000298023224 131 | s. -------------------------------------------------------------------------------- /assets/vfx/engine1.kep: -------------------------------------------------------------------------------- 1 | (dp1 2 | S'end_rotation_variance' 3 | p2 4 | F72 5 | sS'radial_acceleration_variance' 6 | p3 7 | F0 8 | sS'life_span_variance' 9 | p4 10 | F0 11 | sS'start_rotation_variance' 12 | p5 13 | F0 14 | sS'rotate_per_second_variance' 15 | p6 16 | F0 17 | sS'end_scale' 18 | p7 19 | F0.40000000596046448 20 | sS'paused' 21 | p8 22 | I00 23 | sS'start_scale' 24 | p9 25 | F2 26 | sS'speed' 27 | p10 28 | F95 29 | sS'life_span' 30 | p11 31 | F1.25 32 | sS'max_radius_variance' 33 | p12 34 | F0 35 | sS'gravity' 36 | p13 37 | (lp14 38 | F0 39 | aF0 40 | asS'texture' 41 | p15 42 | S'particle' 43 | p16 44 | sS'tangential_acceleration' 45 | p17 46 | F0 47 | sS'pos_offset' 48 | p18 49 | (lp19 50 | F0 51 | aF0 52 | asS'min_radius' 53 | p20 54 | F0 55 | sS'emit_angle_offset' 56 | p21 57 | F0 58 | sS'pos_variance' 59 | p22 60 | (lp23 61 | F0 62 | aF0 63 | asS'start_color_variance' 64 | p24 65 | (lp25 66 | I34 67 | aI0 68 | aI0 69 | aI0 70 | asS'number_of_particles' 71 | p26 72 | I50 73 | sS'effect_name' 74 | p27 75 | S'effect_test' 76 | p28 77 | sS'start_rotation' 78 | p29 79 | F0 80 | sS'emit_angle_variance' 81 | p30 82 | F18 83 | sS'radial_acceleration' 84 | p31 85 | F0 86 | sS'end_scale_variance' 87 | p32 88 | F0 89 | sS'end_color' 90 | p33 91 | (lp34 92 | I255 93 | aI205 94 | aI22 95 | aI255 96 | asS'max_radius' 97 | p35 98 | F25 99 | sS'speed_variance' 100 | p36 101 | F0 102 | sS'rotate_per_second' 103 | p37 104 | F0 105 | sS'start_color' 106 | p38 107 | (lp39 108 | I255 109 | aI71 110 | aI0 111 | aI215 112 | asS'end_rotation' 113 | p40 114 | F0 115 | sS'emitter_type' 116 | p41 117 | I0 118 | sS'tangential_acceleration_variance' 119 | p42 120 | F23 121 | sS'end_color_variance' 122 | p43 123 | (lp44 124 | I0 125 | aI0 126 | aI0 127 | aI0 128 | asS'start_scale_variance' 129 | p45 130 | F1 131 | s. -------------------------------------------------------------------------------- /assets/vfx/engine2.kep: -------------------------------------------------------------------------------- 1 | (dp1 2 | S'end_rotation_variance' 3 | p2 4 | F72 5 | sS'radial_acceleration_variance' 6 | p3 7 | F0 8 | sS'life_span_variance' 9 | p4 10 | F0 11 | sS'start_rotation_variance' 12 | p5 13 | F0 14 | sS'rotate_per_second_variance' 15 | p6 16 | F0 17 | sS'end_scale' 18 | p7 19 | F0.40000000596046448 20 | sS'paused' 21 | p8 22 | I00 23 | sS'start_scale' 24 | p9 25 | F2 26 | sS'speed' 27 | p10 28 | F95 29 | sS'life_span' 30 | p11 31 | F0.75 32 | sS'max_radius_variance' 33 | p12 34 | F0 35 | sS'gravity' 36 | p13 37 | (lp14 38 | F0 39 | aF0 40 | asS'texture' 41 | p15 42 | S'particle' 43 | p16 44 | sS'tangential_acceleration' 45 | p17 46 | F0 47 | sS'pos_offset' 48 | p18 49 | (lp19 50 | F0 51 | aF0 52 | asS'min_radius' 53 | p20 54 | F0 55 | sS'emit_angle_offset' 56 | p21 57 | F0 58 | sS'pos_variance' 59 | p22 60 | (lp23 61 | F0 62 | aF0 63 | asS'start_color_variance' 64 | p24 65 | (lp25 66 | I67 67 | aI0 68 | aI0 69 | aI32 70 | asS'number_of_particles' 71 | p26 72 | I50 73 | sS'effect_name' 74 | p27 75 | S'effect_test' 76 | p28 77 | sS'start_rotation' 78 | p29 79 | F0 80 | sS'emit_angle_variance' 81 | p30 82 | F18 83 | sS'radial_acceleration' 84 | p31 85 | F-363 86 | sS'end_scale_variance' 87 | p32 88 | F0 89 | sS'end_color' 90 | p33 91 | (lp34 92 | I0 93 | aI182 94 | aI255 95 | aI255 96 | asS'max_radius' 97 | p35 98 | F25 99 | sS'speed_variance' 100 | p36 101 | F0 102 | sS'rotate_per_second' 103 | p37 104 | F0 105 | sS'start_color' 106 | p38 107 | (lp39 108 | I255 109 | aI255 110 | aI255 111 | aI0 112 | asS'end_rotation' 113 | p40 114 | F0 115 | sS'emitter_type' 116 | p41 117 | I0 118 | sS'tangential_acceleration_variance' 119 | p42 120 | F0 121 | sS'end_color_variance' 122 | p43 123 | (lp44 124 | I0 125 | aI53 126 | aI0 127 | aI0 128 | asS'start_scale_variance' 129 | p45 130 | F1 131 | s. -------------------------------------------------------------------------------- /assets/vfx/engine3.kep: -------------------------------------------------------------------------------- 1 | (dp1 2 | S'end_rotation_variance' 3 | p2 4 | F72 5 | sS'radial_acceleration_variance' 6 | p3 7 | F0 8 | sS'life_span_variance' 9 | p4 10 | F0 11 | sS'start_rotation_variance' 12 | p5 13 | F0 14 | sS'rotate_per_second_variance' 15 | p6 16 | F0 17 | sS'end_scale' 18 | p7 19 | F0.40000000596046448 20 | sS'paused' 21 | p8 22 | I00 23 | sS'start_scale' 24 | p9 25 | F2 26 | sS'speed' 27 | p10 28 | F95 29 | sS'life_span' 30 | p11 31 | F0.75 32 | sS'max_radius_variance' 33 | p12 34 | F0 35 | sS'gravity' 36 | p13 37 | (lp14 38 | F0 39 | aF0 40 | asS'texture' 41 | p15 42 | S'particle' 43 | p16 44 | sS'tangential_acceleration' 45 | p17 46 | F0 47 | sS'pos_offset' 48 | p18 49 | (lp19 50 | F0 51 | aF0 52 | asS'min_radius' 53 | p20 54 | F0 55 | sS'emit_angle_offset' 56 | p21 57 | F0 58 | sS'pos_variance' 59 | p22 60 | (lp23 61 | F0 62 | aF0 63 | asS'start_color_variance' 64 | p24 65 | (lp25 66 | I67 67 | aI0 68 | aI0 69 | aI32 70 | asS'number_of_particles' 71 | p26 72 | I50 73 | sS'effect_name' 74 | p27 75 | S'effect_test' 76 | p28 77 | sS'start_rotation' 78 | p29 79 | F0 80 | sS'emit_angle_variance' 81 | p30 82 | F18 83 | sS'radial_acceleration' 84 | p31 85 | F82 86 | sS'end_scale_variance' 87 | p32 88 | F0 89 | sS'end_color' 90 | p33 91 | (lp34 92 | I0 93 | aI182 94 | aI255 95 | aI255 96 | asS'max_radius' 97 | p35 98 | F25 99 | sS'speed_variance' 100 | p36 101 | F0 102 | sS'rotate_per_second' 103 | p37 104 | F0 105 | sS'start_color' 106 | p38 107 | (lp39 108 | I255 109 | aI255 110 | aI255 111 | aI0 112 | asS'end_rotation' 113 | p40 114 | F0 115 | sS'emitter_type' 116 | p41 117 | I0 118 | sS'tangential_acceleration_variance' 119 | p42 120 | F0 121 | sS'end_color_variance' 122 | p43 123 | (lp44 124 | I0 125 | aI53 126 | aI0 127 | aI0 128 | asS'start_scale_variance' 129 | p45 130 | F1 131 | s. -------------------------------------------------------------------------------- /assets/vfx/orb_explosion.kep: -------------------------------------------------------------------------------- 1 | (dp1 2 | S'end_rotation_variance' 3 | p2 4 | F0 5 | sS'radial_acceleration_variance' 6 | p3 7 | F0 8 | sS'life_span_variance' 9 | p4 10 | F0 11 | sS'start_rotation_variance' 12 | p5 13 | F0 14 | sS'rotate_per_second_variance' 15 | p6 16 | F0 17 | sS'end_scale' 18 | p7 19 | F2.9600000381469727 20 | sS'paused' 21 | p8 22 | I00 23 | sS'start_scale' 24 | p9 25 | F0.86000001430511475 26 | sS'speed' 27 | p10 28 | F50 29 | sS'life_span' 30 | p11 31 | F0.30000001192092896 32 | sS'max_radius_variance' 33 | p12 34 | F0 35 | sS'gravity' 36 | p13 37 | (lp14 38 | F0 39 | aF0 40 | asS'texture' 41 | p15 42 | S'particle' 43 | p16 44 | sS'tangential_acceleration' 45 | p17 46 | F0 47 | sS'pos_offset' 48 | p18 49 | (lp19 50 | F0 51 | aF0 52 | asS'min_radius' 53 | p20 54 | F0 55 | sS'emit_angle_offset' 56 | p21 57 | F180 58 | sS'pos_variance' 59 | p22 60 | (lp23 61 | F0 62 | aF0 63 | asS'start_color_variance' 64 | p24 65 | (lp25 66 | I0 67 | aI0 68 | aI0 69 | aI0 70 | asS'number_of_particles' 71 | p26 72 | I24 73 | sS'effect_name' 74 | p27 75 | S'effect_test' 76 | p28 77 | sS'start_rotation' 78 | p29 79 | F0 80 | sS'emit_angle_variance' 81 | p30 82 | F360 83 | sS'radial_acceleration' 84 | p31 85 | F0 86 | sS'end_scale_variance' 87 | p32 88 | F0.72000002861022949 89 | sS'end_color' 90 | p33 91 | (lp34 92 | I255 93 | aI0 94 | aI255 95 | aI59 96 | asS'max_radius' 97 | p35 98 | F25 99 | sS'speed_variance' 100 | p36 101 | F0 102 | sS'rotate_per_second' 103 | p37 104 | F0 105 | sS'start_color' 106 | p38 107 | (lp39 108 | I0 109 | aI110 110 | aI255 111 | aI209 112 | asS'end_rotation' 113 | p40 114 | F0 115 | sS'emitter_type' 116 | p41 117 | I1 118 | sS'tangential_acceleration_variance' 119 | p42 120 | F0 121 | sS'end_color_variance' 122 | p43 123 | (lp44 124 | I0 125 | aI0 126 | aI0 127 | aI69 128 | asS'start_scale_variance' 129 | p45 130 | F0.20000000298023224 131 | s. -------------------------------------------------------------------------------- /assets/vfx/shipexplosion.kep: -------------------------------------------------------------------------------- 1 | (dp1 2 | S'end_rotation_variance' 3 | p2 4 | F0 5 | sS'radial_acceleration_variance' 6 | p3 7 | F0 8 | sS'life_span_variance' 9 | p4 10 | F0 11 | sS'start_rotation_variance' 12 | p5 13 | F176 14 | sS'rotate_per_second_variance' 15 | p6 16 | F0 17 | sS'end_scale' 18 | p7 19 | F2.8499999046325684 20 | sS'paused' 21 | p8 22 | I00 23 | sS'start_scale' 24 | p9 25 | F3.2899999618530273 26 | sS'speed' 27 | p10 28 | F103 29 | sS'life_span' 30 | p11 31 | F1.5 32 | sS'max_radius_variance' 33 | p12 34 | F0 35 | sS'gravity' 36 | p13 37 | (lp14 38 | F0 39 | aF0 40 | asS'texture' 41 | p15 42 | S'particle' 43 | p16 44 | sS'tangential_acceleration' 45 | p17 46 | F0 47 | sS'pos_offset' 48 | p18 49 | (lp19 50 | F0 51 | aF0 52 | asS'min_radius' 53 | p20 54 | F0 55 | sS'emit_angle_offset' 56 | p21 57 | F0 58 | sS'pos_variance' 59 | p22 60 | (lp23 61 | F20 62 | aF20 63 | asS'start_color_variance' 64 | p24 65 | (lp25 66 | I0 67 | aI69 68 | aI0 69 | aI0 70 | asS'number_of_particles' 71 | p26 72 | I45 73 | sS'effect_name' 74 | p27 75 | S'effect_test' 76 | p28 77 | sS'start_rotation' 78 | p29 79 | F0 80 | sS'emit_angle_variance' 81 | p30 82 | F360 83 | sS'radial_acceleration' 84 | p31 85 | F-176 86 | sS'end_scale_variance' 87 | p32 88 | F1.0399999618530273 89 | sS'end_color' 90 | p33 91 | (lp34 92 | I255 93 | aI0 94 | aI0 95 | aI255 96 | asS'max_radius' 97 | p35 98 | F25 99 | sS'speed_variance' 100 | p36 101 | F0 102 | sS'rotate_per_second' 103 | p37 104 | F0 105 | sS'start_color' 106 | p38 107 | (lp39 108 | I255 109 | aI215 110 | aI0 111 | aI100 112 | asS'end_rotation' 113 | p40 114 | F0 115 | sS'emitter_type' 116 | p41 117 | I0 118 | sS'tangential_acceleration_variance' 119 | p42 120 | F68 121 | sS'end_color_variance' 122 | p43 123 | (lp44 124 | I0 125 | aI0 126 | aI0 127 | aI0 128 | asS'start_scale_variance' 129 | p45 130 | F1.2000000476837158 131 | s. -------------------------------------------------------------------------------- /colors.py: -------------------------------------------------------------------------------- 1 | from random import choice, uniform, randrange 2 | from utils import iweighted_choice 3 | 4 | color_palettes = { 5 | 'violot': { 6 | 1: (246, 225, 255), 7 | 2: (235, 192, 253), 8 | 3: (173, 0, 242), 9 | 4: (111, 42, 124), 10 | 5: (28, 19, 27), 11 | }, 12 | 'indigo': { 13 | 1: (233, 225, 255), 14 | 2: (200, 181, 252), 15 | 3: (89, 29, 255), 16 | 4: (72, 49, 142), 17 | 5: (32, 29, 41), 18 | }, 19 | 'blue': { 20 | 1: (225, 241, 255), 21 | 2: (190, 223, 253), 22 | 3: (43, 153, 255), 23 | 4: (49, 87, 135), 24 | 5: (28, 32, 40), 25 | }, 26 | 'aqua': { 27 | 1: (225, 255, 249), 28 | 2: (190, 254, 243), 29 | 3: (0, 221, 176), 30 | 4: (30, 91, 78), 31 | 5: (21, 30, 28), 32 | }, 33 | 'green': { 34 | 1: (233, 255, 225), 35 | 2: (214, 254, 188), 36 | 3: (93, 226, 0), 37 | 4: (76, 116, 33), 38 | 5: (34, 41, 29), 39 | }, 40 | 'yellow': { 41 | 1: (252, 255, 225), 42 | 2: (249, 254, 186), 43 | 3: (223, 251, 63), 44 | 4: (155, 147, 41), 45 | 5: (41, 44, 20), 46 | }, 47 | 'orange': { 48 | 1: (255, 239, 225), 49 | 2: (253, 220, 189), 50 | 3: (255, 123, 8), 51 | 4: (149, 65, 42), 52 | 5: (58, 29, 22), 53 | }, 54 | } 55 | 56 | color_choices = [key for key in color_palettes] 57 | sun_choices = ['orange', 'yellow', 'aqua', 'blue'] 58 | 59 | def get_color1_choice_from_val(val): 60 | if val <= .25: 61 | return 'orange' 62 | elif val <= .5: 63 | return 'yellow' 64 | elif val <= .75: 65 | return 'aqua' 66 | else: 67 | return 'blue' 68 | 69 | def get_color2_choice_from_val(val): 70 | if val <= .25: 71 | return 'yellow' 72 | elif val <= .5: 73 | return 'orange' 74 | elif val <= .75: 75 | return 'blue' 76 | else: 77 | return 'aqua' 78 | 79 | def gen_star_color_levels(color): 80 | color_palette = color_palettes[color] 81 | color0 = list(color_palette[1]) 82 | color0.append(255) 83 | color1 = list(color_palette[2]) 84 | color1.append(255) 85 | color2 = list(color_palette[3]) 86 | color2.append(255) 87 | 88 | return {0: color0, 1: color1, 2: color2, 3: (color2[0], color2[1], 89 | color2[3], 0)} 90 | 91 | def gen_color_palette( 92 | divisions, color1, color2, max_step, color_swaps, 93 | do_alpha=False, alpha_low_cutoff=0., alpha_high_cutoff=1., 94 | alpha_range=(100, 200), 95 | level_choices=[(1, 1), (2, 1), (3, 1), (4, 1), (5, 1)] 96 | ): 97 | current_point = 0. 98 | palette = [] 99 | pal_a = palette.append 100 | swap_every = divisions // color_swaps 101 | swap_count = 0 102 | current_color = color1 103 | current_level = 5 104 | direction_choices = [0, 1, 1] 105 | direction = 0 106 | for x in range(divisions): 107 | color = list(color_palettes[current_color][current_level]) 108 | if do_alpha: 109 | if current_point < alpha_low_cutoff or ( 110 | current_point > alpha_high_cutoff): 111 | alpha_v = 0 112 | else: 113 | alpha_v = randrange(alpha_range[0], alpha_range[1]) 114 | color.append(alpha_v) 115 | pal_a((current_point, color)) 116 | current_point = uniform(current_point + max_step/2., 117 | current_point + max_step) 118 | if x == divisions - 2: 119 | current_point = 1. 120 | if current_point > 1.: 121 | current_point == 1. 122 | last_level = current_level 123 | while current_level == last_level: 124 | current_level = iweighted_choice(level_choices) 125 | swap_count += 1 126 | if swap_count >= swap_every: 127 | swap_count = 0 128 | if current_color == color1: 129 | current_color = color2 130 | else: 131 | current_color = color1 132 | return palette -------------------------------------------------------------------------------- /generate_assets.py: -------------------------------------------------------------------------------- 1 | from geometry import draw_layered_regular_polygon 2 | 3 | def generate_shield_model(radius, width): 4 | radius_color_dict = {1: (radius, (255, 255, 255, 0)), 5 | 2: (2., (255, 255, 255, 0)), 6 | 2: (.4*width, (255, 255, 255, 125)), 7 | 3: (.1*width, (255, 255, 255, 255)), 8 | 4: (.4*width, (255, 255, 255, 125)), 9 | 5: (2.,(255, 255, 255, 0))} 10 | return draw_layered_regular_polygon((0., 0.), 5, 32, (0, 0, 0, 0), 11 | radius_color_dict) -------------------------------------------------------------------------------- /generate_triangulated_polygons.py: -------------------------------------------------------------------------------- 1 | import triangle 2 | from numpy import array 3 | from math import pi, cos, sin 4 | from random import randint 5 | 6 | def triangulate_regular_polygon(sides, radius, pos, size): 7 | x, y = pos 8 | angle = 2 * pi / sides 9 | all_verts = [] 10 | all_verts_a = all_verts.append 11 | r = radius 12 | for s in range(sides): 13 | new_pos = x + r * sin(s * angle), y + r * cos(s * angle) 14 | all_verts_a(new_pos) 15 | A = {'vertices':array(all_verts)} 16 | command = 'cqa' + size + 'YY' 17 | B = triangle.triangulate(A, command) 18 | tri_indices = B['triangles'] 19 | new_indices = [] 20 | new_vertices = {} 21 | tri_verts = B['vertices'] 22 | new_ex = new_indices.extend 23 | ind_count = 0 24 | for tri in tri_indices: 25 | new_ex((tri[0], tri[1], tri[2])) 26 | ind_count += 3 27 | vert_count = 0 28 | for i, tvert in enumerate(tri_verts): 29 | new_vertices[i] = { 30 | 'pos': [tvert[0], tvert[1]], 31 | 'v_color': [255, 255, 255, 255] 32 | } 33 | vert_count += 1 34 | return {'indices': new_indices, 'vertices': new_vertices, 35 | 'vert_count': vert_count, 'ind_count': ind_count} 36 | 37 | 38 | def create_triangulated_polygon_model( 39 | model_manager, sides, radius, area, name 40 | ): 41 | t = triangulate_regular_polygon(sides,radius, (0., 0.), area) 42 | model_name = model_manager.load_model('vertex_format_2f4ub', 43 | t['vert_count'], t['ind_count'], name, 44 | indices=t['indices'], vertices=t['vertices']) 45 | return model_name 46 | 47 | def generate_and_save_various_models( 48 | model_manager, radii=[], areas=[], sides=40 49 | ): 50 | for radius in radii: 51 | for area in areas: 52 | name = 'circle_' + str(int(radius)) + '_' + area 53 | model_name = create_triangulated_polygon_model( 54 | model_manager, sides, radius, area, name 55 | ) 56 | model_manager.pickle_model(model_name, 'triangulated_models') 57 | 58 | def pregenerate_models(model_manager): 59 | generate_and_save_various_models( 60 | model_manager, radii=[100., 200.,], areas=['5', '10', '20'] 61 | ) 62 | generate_and_save_various_models( 63 | model_manager, radii=[400.], areas=['10', '20', '30'], sides=60 64 | ) 65 | generate_and_save_various_models( 66 | model_manager, radii=[800.], areas=['25', '35', '50'], sides=100 67 | ) -------------------------------------------------------------------------------- /geometry.py: -------------------------------------------------------------------------------- 1 | from math import pi, cos, sin 2 | 3 | def draw_offset_layered_regular_polygon(pos, levels, sides, 4 | middle_color, radius_color_dict): 5 | ''' 6 | radius_color_dict = {'level#': (even_r, odd_r), (r,g,b,a))} 7 | ''' 8 | x, y = pos 9 | angle = 2 * pi / sides 10 | all_verts = {} 11 | all_verts[0] = {'pos': pos, 'v_color': middle_color} 12 | r_total_e = 0 13 | r_total_o = 0 14 | i = 0 15 | indices = [] 16 | vert_count = 1 17 | ind_count = 0 18 | ind_ext = indices.extend 19 | for count in range(levels): 20 | level = i + 1 21 | rs, color = radius_color_dict[level] 22 | even_r, odd_r = rs 23 | for s in range(sides): 24 | r = odd_r if not s % 2 else even_r 25 | r_total = r_total_o if not s % 2 else r_total_e 26 | new_pos = list((x + (r + r_total) * sin(s * angle), 27 | y + (r + r_total) * cos(s * angle))) 28 | all_verts[vert_count] = {'pos': new_pos, 'v_color': color} 29 | vert_count += 1 30 | r_total_e += even_r 31 | r_total_o += odd_r 32 | c = 1 #side number we are on in loop 33 | if level == 1: 34 | for each in range(sides): 35 | if c < sides: 36 | ind_ext((c, 0, c+1)) 37 | else: 38 | ind_ext((c, 0, 1)) 39 | ind_count += 3 40 | c += 1 41 | else: 42 | for each in range(sides): 43 | offset = sides*(i-1) 44 | if c < sides: 45 | ind_ext((c+sides+offset, c+sides+1+offset, c+offset)) 46 | ind_ext((c+offset, c+1+offset, c+sides+1+offset)) 47 | else: 48 | ind_ext((c+sides+offset, sides+1+offset, sides+offset)) 49 | ind_ext((sides+offset, 1+offset, sides+1+offset)) 50 | ind_count += 6 51 | c += 1 52 | i += 1 53 | return {'indices': indices, 'vertices': all_verts, 54 | 'vert_count': vert_count, 'ind_count': ind_count} 55 | 56 | def draw_layered_regular_polygon(pos, levels, sides, middle_color, 57 | radius_color_dict): 58 | ''' 59 | radius_color_dict = {level#: (r, (r,g,b,a))} 60 | ''' 61 | x, y = pos 62 | angle = 2 * pi / sides 63 | all_verts = {} 64 | all_verts[0] = {'pos': pos, 'v_color': middle_color} 65 | r_total = 0 66 | i = 0 67 | indices = [] 68 | vert_count = 1 69 | ind_count = 0 70 | ind_ext = indices.extend 71 | for count in range(levels): 72 | level = i + 1 73 | r, color = radius_color_dict[level] 74 | for s in range(sides): 75 | new_pos = list((x + (r + r_total) * sin(s * angle), 76 | y + (r + r_total) * cos(s * angle))) 77 | all_verts[vert_count] = {'pos': new_pos, 'v_color': color} 78 | vert_count += 1 79 | r_total += r 80 | c = 1 #side number we are on in loop 81 | if level == 1: 82 | for each in range(sides): 83 | if c < sides: 84 | ind_ext((c, 0, c+1)) 85 | else: 86 | ind_ext((c, 0, 1)) 87 | ind_count += 3 88 | c += 1 89 | else: 90 | for each in range(sides): 91 | offset = sides*(i-1) 92 | if c < sides: 93 | ind_ext((c+sides+offset, c+sides+1+offset, c+offset)) 94 | ind_ext((c+offset, c+1+offset, c+sides+1+offset)) 95 | else: 96 | ind_ext((c+sides+offset, sides+1+offset, sides+offset)) 97 | ind_ext((sides+offset, 1+offset, sides+1+offset)) 98 | ind_count += 6 99 | c += 1 100 | i += 1 101 | return {'indices': indices, 'vertices': all_verts, 102 | 'vert_count': vert_count, 'ind_count': ind_count} 103 | 104 | def draw_colored_layered_grid(spacing, line_width, fade_width, cells, color, 105 | middle_color, fade_color): 106 | #draw centered around 0, 0 107 | pos = (0, 0) 108 | hs = spacing/2. 109 | hf = fade_width/2. 110 | line_spacing = line_width+fade_width 111 | total_size = line_spacing*cells + spacing*(cells) 112 | print('total size is', total_size) 113 | total_gap = total_size/cells 114 | starting_pos = ( 115 | pos[0] + line_spacing/2. + hs - total_size/2., 116 | pos[1] + line_spacing/2. + hs - total_size/2. 117 | ) 118 | all_verts = {} 119 | indices = [] 120 | vert_count = 0 121 | ind_count = 0 122 | ind_e = indices.extend 123 | for x_count in range(cells): 124 | for y_count in range(cells): 125 | x_offset = total_gap*x_count 126 | y_offset = total_gap*y_count 127 | vert_count += 17 128 | initial_point = ( 129 | starting_pos[0] + x_offset, starting_pos[1] + y_offset) 130 | ix, iy = initial_point 131 | a = 17*x_count + 17*y_count*cells 132 | prev_ax = a - 17 133 | prev_ay = a - 17*cells 134 | # calculate vertex positions 135 | a_vert = {'pos': (ix, iy), 'v_color': middle_color} 136 | b_vert = {'pos': (ix - hs, iy - hs), 'v_color': color} 137 | c_vert = {'pos': (ix, iy - hs), 'v_color': middle_color} 138 | d_vert = {'pos': (ix + hs, iy - hs), 'v_color': color} 139 | e_vert = {'pos': (ix - hs, iy), 'v_color': middle_color} 140 | f_vert = {'pos': (ix + hs, iy), 'v_color': middle_color} 141 | g_vert = {'pos': (ix - hs, iy + hs), 'v_color': color} 142 | h_vert = {'pos': (ix, iy + hs), 'v_color': middle_color} 143 | i_vert = {'pos': (ix + hs, iy + hs), 'v_color': color} 144 | j_vert = {'pos': (ix - hs - hf, iy - hs - hf), 145 | 'v_color': fade_color} 146 | k_vert = {'pos': (ix, iy - hs - hf), 'v_color': fade_color} 147 | l_vert = {'pos': (ix + hs + hf, iy - hs - hf), 148 | 'v_color': fade_color} 149 | m_vert = {'pos': (ix - hs - hf, iy), 'v_color': fade_color} 150 | n_vert = {'pos': (ix + hs + hf, iy), 'v_color': fade_color} 151 | o_vert = {'pos': (ix - hs - hf, iy + hs + hf), 152 | 'v_color': fade_color} 153 | p_vert = {'pos': (ix, iy + hs + hf), 'v_color': fade_color} 154 | q_vert = {'pos': (ix + hs + hf, iy + hs + hf), 155 | 'v_color': fade_color} 156 | # calculate indexes 157 | b = a+1 158 | c = a+2 159 | d = a+3 160 | e = a+4 161 | f = a+5 162 | g = a+6 163 | h = a+7 164 | i = a+8 165 | j = a+9 166 | k = a+10 167 | l = a+11 168 | m = a+12 169 | n= a+13 170 | o = a+14 171 | p = a+15 172 | q = a+16 173 | all_verts[a] = a_vert 174 | all_verts[b] = b_vert 175 | all_verts[c] = c_vert 176 | all_verts[d] = d_vert 177 | all_verts[e] = e_vert 178 | all_verts[f] = f_vert 179 | all_verts[g] = g_vert 180 | all_verts[h] = h_vert 181 | all_verts[i] = i_vert 182 | all_verts[j] = j_vert 183 | all_verts[k] = k_vert 184 | all_verts[l] = l_vert 185 | all_verts[m] = m_vert 186 | all_verts[n] = n_vert 187 | all_verts[o] = o_vert 188 | all_verts[p] = p_vert 189 | all_verts[q] = q_vert 190 | if x_count > 0: 191 | pxf = prev_ax+5 192 | pxi = prev_ax+8 193 | pxd = prev_ax+3 194 | ind_e([pxf, pxi, g, g, pxf, e, e, b, pxf, pxf, pxd, b]) 195 | ind_count += 12 196 | if y_count > 0: 197 | pyh = prev_ay+7 198 | pyg = prev_ay+6 199 | pyi = prev_ay+8 200 | ind_e([pyh, pyg, b, b, c, pyh, pyh, pyi, d, d, pyh, c]) 201 | ind_count += 12 202 | ind_e([ 203 | a, e, c, 204 | c, b, e, 205 | e, g, h, 206 | h, e, a, 207 | a, f, h, 208 | h, i, f, 209 | f, a, c, 210 | c, d, f,]) 211 | ind_count += 24 212 | if x_count == 0 and y_count == 0: 213 | ind_e([ 214 | m, e, b, 215 | b, m, j, 216 | j, b, k, 217 | k, b, c, 218 | m, e, g, 219 | g, m, o, 220 | c, d, k, 221 | k, l, d, 222 | ]) 223 | ind_count += 24 224 | if x_count == cells-1 and y_count == cells-1: 225 | ind_e([ 226 | o, p, g, 227 | g, p, h, 228 | h, p, i, 229 | i, p, q, 230 | q, i, n, 231 | n, i, f, 232 | f, n, d, 233 | d, n, l, 234 | ]) 235 | ind_count += 24 236 | if x_count == cells-1 and y_count == 0: 237 | ind_e([ 238 | q, n, i, 239 | i, n, f, 240 | f, n, d, 241 | d, n, l, 242 | l, d, k, 243 | k, d, c, 244 | c, k, b, 245 | b, k, j 246 | ]) 247 | ind_count += 24 248 | if x_count == 0 and y_count == cells-1: 249 | ind_e([ 250 | j, b, m, 251 | m, b, e, 252 | e, m, g, 253 | g, m, o, 254 | o, g, p, 255 | p, g, h, 256 | h, p, i, 257 | i, p, q, 258 | ]) 259 | ind_count += 24 260 | if y_count > 0 and 0 <= x_count <= cells-1: 261 | pyo = prev_ay+14 262 | pyg = prev_ay+6 263 | pyq = prev_ay+16 264 | pyi = prev_ay+8 265 | ind_e([ 266 | j, b, pyg, 267 | pyg, j, pyo, 268 | d, l, pyi, 269 | pyi, l, pyq, 270 | ]) 271 | ind_count += 12 272 | if x_count > 0 and 0 <= y_count <= cells-1: 273 | pxi = prev_ax+8 274 | pxq = prev_ax+16 275 | pxl = prev_ax+11 276 | pxd = prev_ax+3 277 | ind_e([ 278 | pxd, pxl, j, 279 | j, pxd, b, 280 | pxq, pxi, o, 281 | o, pxi, g 282 | ]) 283 | ind_count += 12 284 | if y_count == 0 and 0 < x_count < cells-1: 285 | ind_e([ 286 | b, j, k, 287 | k, b, c, 288 | c, d, k, 289 | k, d, l, 290 | ]) 291 | ind_count += 12 292 | if x_count == 0 and 0 < y_count < cells-1: 293 | ind_e([ 294 | g, o, m, 295 | m, g, e, 296 | e, m, b, 297 | b, m, j, 298 | ]) 299 | ind_count += 12 300 | if y_count == cells-1 and 0 < x_count < cells-1: 301 | ind_e([ 302 | o, g, p, 303 | p, g, h, 304 | h, p, i, 305 | i, p, q, 306 | ]) 307 | ind_count += 12 308 | if x_count == cells-1 and 0 < y_count < cells-1: 309 | ind_e([ 310 | q, i, n, 311 | n, i, f, 312 | f, n, d, 313 | d, n, l, 314 | ]) 315 | ind_count += 12 316 | 317 | return {'indices': indices, 'vertices': all_verts, 318 | 'vert_count': vert_count, 'ind_count': ind_count} 319 | 320 | 321 | def draw_irregular_polygon(points, color): 322 | center = (0., 0.) 323 | vertices = {} 324 | vertices[0] = {'pos': center, 'v_color': color} 325 | indices = [] 326 | count = len(points) 327 | for index, point in enumerate(points): 328 | vertices[index+1] = {'pos': point, 'v_color': color} 329 | if index < count: 330 | indices.extend([0, index+1, index+2]) 331 | else: 332 | indices.extend([index+1, 0, 1]) 333 | return {'indices': indices, 'vertices': vertices, 334 | 'vert_count': len(vertices), 'ind_count': len(indices)} 335 | 336 | 337 | def draw_colored_grid(pos, spacing, width, cells, color, middle_color): 338 | total_gap = width+spacing 339 | total_size = total_gap*cells 340 | hs = spacing/2. 341 | starting_pos = pos[0] - total_size/2., pos[1] - total_size/2. 342 | all_verts = {} 343 | indices = [] 344 | vert_count = 0 345 | ind_count = 0 346 | ind_e = indices.extend 347 | for x_count in range(cells): 348 | for y_count in range(cells): 349 | x_offset = total_gap*x_count 350 | y_offset = total_gap*y_count 351 | vert_count += 9 352 | initial_point = ( 353 | starting_pos[0] + x_offset, starting_pos[1] + y_offset) 354 | ix, iy = initial_point 355 | a = 9*x_count + 9*y_count*cells 356 | prev_ax = a - 9 357 | prev_ay = a - 9*cells 358 | # calculate vertex positions 359 | a_vert = {'pos': (ix, iy), 'v_color': middle_color} 360 | b_vert = {'pos': (ix - hs, iy - hs), 'v_color': color} 361 | c_vert = {'pos': (ix, iy - hs), 'v_color': middle_color} 362 | d_vert = {'pos': (ix + hs, iy - hs), 'v_color': color} 363 | e_vert = {'pos': (ix - hs, iy), 'v_color': middle_color} 364 | f_vert = {'pos': (ix + hs, iy), 'v_color': middle_color} 365 | g_vert = {'pos': (ix - hs, iy + hs), 'v_color': color} 366 | h_vert = {'pos': (ix, iy + hs), 'v_color': middle_color} 367 | i_vert = {'pos': (ix + hs, iy + hs), 'v_color': color} 368 | # calculate indexes 369 | b = a+1 370 | c = a+2 371 | d = a+3 372 | e = a+4 373 | f = a+5 374 | g = a+6 375 | h = a+7 376 | i = a+8 377 | all_verts[a] = a_vert 378 | all_verts[b] = b_vert 379 | all_verts[c] = c_vert 380 | all_verts[d] = d_vert 381 | all_verts[e] = e_vert 382 | all_verts[f] = f_vert 383 | all_verts[g] = g_vert 384 | all_verts[h] = h_vert 385 | all_verts[i] = i_vert 386 | if x_count > 0: 387 | pxf = prev_ax+5 388 | pxi = prev_ax+8 389 | pxd = prev_ax+3 390 | ind_e([pxf, pxi, g, g, pxf, e, e, b, pxf, pxf, pxd, b]) 391 | ind_count += 12 392 | if y_count > 0: 393 | pyh = prev_ay+7 394 | pyg = prev_ay+6 395 | pyi = prev_ay+8 396 | ind_e([pyh, pyg, b, b, c, pyh, pyh, pyi, d, d, pyh, c]) 397 | ind_count += 12 398 | ind_e([ 399 | a, e, c, 400 | c, b, e, 401 | e, g, h, 402 | h, e, a, 403 | a, f, h, 404 | h, i, f, 405 | f, a, c, 406 | c, d, f]) 407 | ind_count += 24 408 | return {'indices': indices, 'vertices': all_verts, 409 | 'vert_count': vert_count, 'ind_count': ind_count} 410 | -------------------------------------------------------------------------------- /grid_generation.py: -------------------------------------------------------------------------------- 1 | from geometry import draw_colored_layered_grid 2 | 3 | def load_grid(gameworld, model_data, name, do_copy=True): 4 | return gameworld.model_manager.load_model('vertex_format_2f4ub', 5 | model_data['vert_count'], 6 | model_data['ind_count'], name, 7 | indices=model_data['indices'], 8 | vertices=model_data['vertices'], 9 | do_copy=do_copy) 10 | 11 | def get_grid_sizes(size, pos, cell_count, border_size, line_width, fade_width): 12 | line_space = (line_width + fade_width) 13 | border_space = size[0] - 2*border_size, size[1] - 2*border_size 14 | smallest_edge = min(border_space) 15 | usable_space = smallest_edge - cell_count*line_space 16 | cell_size = usable_space/(cell_count-1) 17 | leftovers = (size[0] - smallest_edge, size[1] - smallest_edge) 18 | pos = (pos[0] + size[0]/2., 19 | pos[1] + size[1]/2.) 20 | return (cell_size, pos) 21 | 22 | def generate_grid(border_width, line_width, line_fade_width, size, 23 | pos, cells, outer_color, inner_color): 24 | cell_size, board_pos = get_grid_sizes( 25 | size, pos, cells, border_width, line_width, line_fade_width 26 | ) 27 | grid_data = draw_colored_layered_grid( 28 | line_width, cell_size, line_fade_width, 29 | cells, outer_color, inner_color, outer_color[0:3] + [0] 30 | ) 31 | return board_pos, grid_data, cell_size 32 | -------------------------------------------------------------------------------- /noise/kivent_noise/__init__.py: -------------------------------------------------------------------------------- 1 | from kivent_noise import noise -------------------------------------------------------------------------------- /noise/kivent_noise/cnoise.pxd: -------------------------------------------------------------------------------- 1 | cdef extern from "simplexnoise.h": 2 | cdef float scaled_octave_noise_2d(float octaves, float persistence, 3 | float scale, float loBound, float hiBound, float x, float y) -------------------------------------------------------------------------------- /noise/kivent_noise/include/simplexnoise.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007-2012 Eliot Eshelman 2 | * 3 | * This program is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | */ 17 | 18 | 19 | #ifndef SIMPLEX_H_ 20 | #define SIMPLEX_H_ 21 | 22 | 23 | /* 2D, 3D and 4D Simplex Noise functions return 'random' values in (-1, 1). 24 | 25 | This algorithm was originally designed by Ken Perlin, but my code has been 26 | adapted from the implementation written by Stefan Gustavson (stegu@itn.liu.se) 27 | 28 | Raw Simplex noise functions return the value generated by Ken's algorithm. 29 | 30 | Scaled Raw Simplex noise functions adjust the range of values returned from the 31 | traditional (-1, 1) to whichever bounds are passed to the function. 32 | 33 | Multi-Octave Simplex noise functions compine multiple noise values to create a 34 | more complex result. Each successive layer of noise is adjusted and scaled. 35 | 36 | Scaled Multi-Octave Simplex noise functions scale the values returned from the 37 | traditional (-1,1) range to whichever range is passed to the function. 38 | 39 | In many cases, you may think you only need a 1D noise function, but in practice 40 | 2D is almost always better. For instance, if you're using the current frame 41 | number as the parameter for the noise, all objects will end up with the same 42 | noise value at each frame. By adding a second parameter on the second 43 | dimension, you can ensure that each gets a unique noise value and they don't 44 | all look identical. 45 | */ 46 | 47 | 48 | // Multi-octave Simplex noise 49 | // For each octave, a higher frequency/lower amplitude function will be added to the original. 50 | // The higher the persistence [0-1], the more of each succeeding octave will be added. 51 | float octave_noise_2d(const float octaves, 52 | const float persistence, 53 | const float scale, 54 | const float x, 55 | const float y); 56 | float octave_noise_3d(const float octaves, 57 | const float persistence, 58 | const float scale, 59 | const float x, 60 | const float y, 61 | const float z); 62 | float octave_noise_4d(const float octaves, 63 | const float persistence, 64 | const float scale, 65 | const float x, 66 | const float y, 67 | const float z, 68 | const float w); 69 | 70 | 71 | // Scaled Multi-octave Simplex noise 72 | // The result will be between the two parameters passed. 73 | float scaled_octave_noise_2d( const float octaves, 74 | const float persistence, 75 | const float scale, 76 | const float loBound, 77 | const float hiBound, 78 | const float x, 79 | const float y); 80 | float scaled_octave_noise_3d( const float octaves, 81 | const float persistence, 82 | const float scale, 83 | const float loBound, 84 | const float hiBound, 85 | const float x, 86 | const float y, 87 | const float z); 88 | float scaled_octave_noise_4d( const float octaves, 89 | const float persistence, 90 | const float scale, 91 | const float loBound, 92 | const float hiBound, 93 | const float x, 94 | const float y, 95 | const float z, 96 | const float w); 97 | 98 | // Scaled Raw Simplex noise 99 | // The result will be between the two parameters passed. 100 | float scaled_raw_noise_2d( const float loBound, 101 | const float hiBound, 102 | const float x, 103 | const float y); 104 | float scaled_raw_noise_3d( const float loBound, 105 | const float hiBound, 106 | const float x, 107 | const float y, 108 | const float z); 109 | float scaled_raw_noise_4d( const float loBound, 110 | const float hiBound, 111 | const float x, 112 | const float y, 113 | const float z, 114 | const float w); 115 | 116 | 117 | // Raw Simplex noise - a single noise value. 118 | float raw_noise_2d(const float x, const float y); 119 | float raw_noise_3d(const float x, const float y, const float z); 120 | float raw_noise_4d(const float x, const float y, const float, const float w); 121 | 122 | 123 | int fastfloor(const float x); 124 | 125 | float dot(const int* g, const float x, const float y); 126 | float dot(const int* g, const float x, const float y, const float z); 127 | float dot(const int* g, const float x, const float y, const float z, const float w); 128 | 129 | 130 | // The gradients are the midpoints of the vertices of a cube. 131 | static const int grad3[12][3] = { 132 | {1,1,0}, {-1,1,0}, {1,-1,0}, {-1,-1,0}, 133 | {1,0,1}, {-1,0,1}, {1,0,-1}, {-1,0,-1}, 134 | {0,1,1}, {0,-1,1}, {0,1,-1}, {0,-1,-1} 135 | }; 136 | 137 | 138 | // The gradients are the midpoints of the vertices of a hypercube. 139 | static const int grad4[32][4]= { 140 | {0,1,1,1}, {0,1,1,-1}, {0,1,-1,1}, {0,1,-1,-1}, 141 | {0,-1,1,1}, {0,-1,1,-1}, {0,-1,-1,1}, {0,-1,-1,-1}, 142 | {1,0,1,1}, {1,0,1,-1}, {1,0,-1,1}, {1,0,-1,-1}, 143 | {-1,0,1,1}, {-1,0,1,-1}, {-1,0,-1,1}, {-1,0,-1,-1}, 144 | {1,1,0,1}, {1,1,0,-1}, {1,-1,0,1}, {1,-1,0,-1}, 145 | {-1,1,0,1}, {-1,1,0,-1}, {-1,-1,0,1}, {-1,-1,0,-1}, 146 | {1,1,1,0}, {1,1,-1,0}, {1,-1,1,0}, {1,-1,-1,0}, 147 | {-1,1,1,0}, {-1,1,-1,0}, {-1,-1,1,0}, {-1,-1,-1,0} 148 | }; 149 | 150 | 151 | // Permutation table. The same list is repeated twice. 152 | static const int perm[512] = { 153 | 151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142, 154 | 8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117, 155 | 35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71, 156 | 134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41, 157 | 55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208, 89, 158 | 18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226, 159 | 250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182, 160 | 189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43, 161 | 172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97, 162 | 228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239, 163 | 107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254, 164 | 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180, 165 | 166 | 151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142, 167 | 8,99,37,240,21,10,23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117, 168 | 35,11,32,57,177,33,88,237,149,56,87,174,20,125,136,171,168,68,175,74,165,71, 169 | 134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,133,230,220,105,92,41, 170 | 55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208, 89, 171 | 18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226, 172 | 250,124,123,5,202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182, 173 | 189,28,42,223,183,170,213,119,248,152,2,44,154,163,70,221,153,101,155,167,43, 174 | 172,9,129,22,39,253,19,98,108,110,79,113,224,232,178,185,112,104,218,246,97, 175 | 228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249,14,239, 176 | 107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254, 177 | 138,236,205,93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180 178 | }; 179 | 180 | 181 | // A lookup table to traverse the simplex around a given point in 4D. 182 | static const int simplex[64][4] = { 183 | {0,1,2,3},{0,1,3,2},{0,0,0,0},{0,2,3,1},{0,0,0,0},{0,0,0,0},{0,0,0,0},{1,2,3,0}, 184 | {0,2,1,3},{0,0,0,0},{0,3,1,2},{0,3,2,1},{0,0,0,0},{0,0,0,0},{0,0,0,0},{1,3,2,0}, 185 | {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}, 186 | {1,2,0,3},{0,0,0,0},{1,3,0,2},{0,0,0,0},{0,0,0,0},{0,0,0,0},{2,3,0,1},{2,3,1,0}, 187 | {1,0,2,3},{1,0,3,2},{0,0,0,0},{0,0,0,0},{0,0,0,0},{2,0,3,1},{0,0,0,0},{2,1,3,0}, 188 | {0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0},{0,0,0,0}, 189 | {2,0,1,3},{0,0,0,0},{0,0,0,0},{0,0,0,0},{3,0,1,2},{3,0,2,1},{0,0,0,0},{3,1,2,0}, 190 | {2,1,0,3},{0,0,0,0},{0,0,0,0},{0,0,0,0},{3,1,0,2},{0,0,0,0},{3,2,0,1},{3,2,1,0} 191 | }; 192 | 193 | 194 | #endif /*SIMPLEX_H_*/ 195 | -------------------------------------------------------------------------------- /noise/kivent_noise/noise.pyx: -------------------------------------------------------------------------------- 1 | from kivent_noise cimport cnoise 2 | 3 | def scaled_octave_noise_2d(float octaves, float persistence, float scale, 4 | float lo_bound, float hi_bound, float x, float y): 5 | return cnoise.scaled_octave_noise_2d(octaves, persistence, scale, lo_bound, 6 | hi_bound, x, y) 7 | -------------------------------------------------------------------------------- /noise/kivent_noise/src/simplexnoise.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 2007-2012 Eliot Eshelman 2 | * 3 | * This program is free software: you can redistribute it and/or modify 4 | * it under the terms of the GNU General Public License as published by 5 | * the Free Software Foundation, either version 3 of the License, or 6 | * (at your option) any later version. 7 | * 8 | * This program is distributed in the hope that it will be useful, 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 | * GNU General Public License for more details. 12 | * 13 | * You should have received a copy of the GNU General Public License 14 | * along with this program. If not, see . 15 | * 16 | */ 17 | 18 | 19 | #include 20 | 21 | #include "simplexnoise.h" 22 | 23 | 24 | /* 2D, 3D and 4D Simplex Noise functions return 'random' values in (-1, 1). 25 | 26 | This algorithm was originally designed by Ken Perlin, but my code has been 27 | adapted from the implementation written by Stefan Gustavson (stegu@itn.liu.se) 28 | 29 | Raw Simplex noise functions return the value generated by Ken's algorithm. 30 | 31 | Scaled Raw Simplex noise functions adjust the range of values returned from the 32 | traditional (-1, 1) to whichever bounds are passed to the function. 33 | 34 | Multi-Octave Simplex noise functions compine multiple noise values to create a 35 | more complex result. Each successive layer of noise is adjusted and scaled. 36 | 37 | Scaled Multi-Octave Simplex noise functions scale the values returned from the 38 | traditional (-1,1) range to whichever range is passed to the function. 39 | 40 | In many cases, you may think you only need a 1D noise function, but in practice 41 | 2D is almost always better. For instance, if you're using the current frame 42 | number as the parameter for the noise, all objects will end up with the same 43 | noise value at each frame. By adding a second parameter on the second 44 | dimension, you can ensure that each gets a unique noise value and they don't 45 | all look identical. 46 | */ 47 | 48 | 49 | // 2D Multi-octave Simplex noise. 50 | // 51 | // For each octave, a higher frequency/lower amplitude function will be added to the original. 52 | // The higher the persistence [0-1], the more of each succeeding octave will be added. 53 | float octave_noise_2d( const float octaves, const float persistence, const float scale, const float x, const float y ) { 54 | float total = 0; 55 | float frequency = scale; 56 | float amplitude = 1; 57 | 58 | // We have to keep track of the largest possible amplitude, 59 | // because each octave adds more, and we need a value in [-1, 1]. 60 | float maxAmplitude = 0; 61 | 62 | for( int i=0; i < octaves; i++ ) { 63 | total += raw_noise_2d( x * frequency, y * frequency ) * amplitude; 64 | 65 | frequency *= 2; 66 | maxAmplitude += amplitude; 67 | amplitude *= persistence; 68 | } 69 | 70 | return total / maxAmplitude; 71 | } 72 | 73 | 74 | // 3D Multi-octave Simplex noise. 75 | // 76 | // For each octave, a higher frequency/lower amplitude function will be added to the original. 77 | // The higher the persistence [0-1], the more of each succeeding octave will be added. 78 | float octave_noise_3d( const float octaves, const float persistence, const float scale, const float x, const float y, const float z ) { 79 | float total = 0; 80 | float frequency = scale; 81 | float amplitude = 1; 82 | 83 | // We have to keep track of the largest possible amplitude, 84 | // because each octave adds more, and we need a value in [-1, 1]. 85 | float maxAmplitude = 0; 86 | 87 | for( int i=0; i < octaves; i++ ) { 88 | total += raw_noise_3d( x * frequency, y * frequency, z * frequency ) * amplitude; 89 | 90 | frequency *= 2; 91 | maxAmplitude += amplitude; 92 | amplitude *= persistence; 93 | } 94 | 95 | return total / maxAmplitude; 96 | } 97 | 98 | 99 | // 4D Multi-octave Simplex noise. 100 | // 101 | // For each octave, a higher frequency/lower amplitude function will be added to the original. 102 | // The higher the persistence [0-1], the more of each succeeding octave will be added. 103 | float octave_noise_4d( const float octaves, const float persistence, const float scale, const float x, const float y, const float z, const float w ) { 104 | float total = 0; 105 | float frequency = scale; 106 | float amplitude = 1; 107 | 108 | // We have to keep track of the largest possible amplitude, 109 | // because each octave adds more, and we need a value in [-1, 1]. 110 | float maxAmplitude = 0; 111 | 112 | for( int i=0; i < octaves; i++ ) { 113 | total += raw_noise_4d( x * frequency, y * frequency, z * frequency, w * frequency ) * amplitude; 114 | 115 | frequency *= 2; 116 | maxAmplitude += amplitude; 117 | amplitude *= persistence; 118 | } 119 | 120 | return total / maxAmplitude; 121 | } 122 | 123 | 124 | 125 | // 2D Scaled Multi-octave Simplex noise. 126 | // 127 | // Returned value will be between loBound and hiBound. 128 | float scaled_octave_noise_2d( const float octaves, const float persistence, const float scale, const float loBound, const float hiBound, const float x, const float y ) { 129 | return octave_noise_2d(octaves, persistence, scale, x, y) * (hiBound - loBound) / 2 + (hiBound + loBound) / 2; 130 | } 131 | 132 | 133 | // 3D Scaled Multi-octave Simplex noise. 134 | // 135 | // Returned value will be between loBound and hiBound. 136 | float scaled_octave_noise_3d( const float octaves, const float persistence, const float scale, const float loBound, const float hiBound, const float x, const float y, const float z ) { 137 | return octave_noise_3d(octaves, persistence, scale, x, y, z) * (hiBound - loBound) / 2 + (hiBound + loBound) / 2; 138 | } 139 | 140 | // 4D Scaled Multi-octave Simplex noise. 141 | // 142 | // Returned value will be between loBound and hiBound. 143 | float scaled_octave_noise_4d( const float octaves, const float persistence, const float scale, const float loBound, const float hiBound, const float x, const float y, const float z, const float w ) { 144 | return octave_noise_4d(octaves, persistence, scale, x, y, z, w) * (hiBound - loBound) / 2 + (hiBound + loBound) / 2; 145 | } 146 | 147 | 148 | 149 | // 2D Scaled Simplex raw noise. 150 | // 151 | // Returned value will be between loBound and hiBound. 152 | float scaled_raw_noise_2d( const float loBound, const float hiBound, const float x, const float y ) { 153 | return raw_noise_2d(x, y) * (hiBound - loBound) / 2 + (hiBound + loBound) / 2; 154 | } 155 | 156 | 157 | // 3D Scaled Simplex raw noise. 158 | // 159 | // Returned value will be between loBound and hiBound. 160 | float scaled_raw_noise_3d( const float loBound, const float hiBound, const float x, const float y, const float z ) { 161 | return raw_noise_3d(x, y, z) * (hiBound - loBound) / 2 + (hiBound + loBound) / 2; 162 | } 163 | 164 | // 4D Scaled Simplex raw noise. 165 | // 166 | // Returned value will be between loBound and hiBound. 167 | float scaled_raw_noise_4d( const float loBound, const float hiBound, const float x, const float y, const float z, const float w ) { 168 | return raw_noise_4d(x, y, z, w) * (hiBound - loBound) / 2 + (hiBound + loBound) / 2; 169 | } 170 | 171 | 172 | 173 | // 2D raw Simplex noise 174 | float raw_noise_2d( const float x, const float y ) { 175 | // Noise contributions from the three corners 176 | float n0, n1, n2; 177 | 178 | // Skew the input space to determine which simplex cell we're in 179 | float F2 = 0.5 * (sqrtf(3.0) - 1.0); 180 | // Hairy factor for 2D 181 | float s = (x + y) * F2; 182 | int i = fastfloor( x + s ); 183 | int j = fastfloor( y + s ); 184 | 185 | float G2 = (3.0 - sqrtf(3.0)) / 6.0; 186 | float t = (i + j) * G2; 187 | // Unskew the cell origin back to (x,y) space 188 | float X0 = i-t; 189 | float Y0 = j-t; 190 | // The x,y distances from the cell origin 191 | float x0 = x-X0; 192 | float y0 = y-Y0; 193 | 194 | // For the 2D case, the simplex shape is an equilateral triangle. 195 | // Determine which simplex we are in. 196 | int i1, j1; // Offsets for second (middle) corner of simplex in (i,j) coords 197 | if(x0>y0) {i1=1; j1=0;} // lower triangle, XY order: (0,0)->(1,0)->(1,1) 198 | else {i1=0; j1=1;} // upper triangle, YX order: (0,0)->(0,1)->(1,1) 199 | 200 | // A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and 201 | // a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where 202 | // c = (3-sqrt(3))/6 203 | float x1 = x0 - i1 + G2; // Offsets for middle corner in (x,y) unskewed coords 204 | float y1 = y0 - j1 + G2; 205 | float x2 = x0 - 1.0 + 2.0 * G2; // Offsets for last corner in (x,y) unskewed coords 206 | float y2 = y0 - 1.0 + 2.0 * G2; 207 | 208 | // Work out the hashed gradient indices of the three simplex corners 209 | int ii = i & 255; 210 | int jj = j & 255; 211 | int gi0 = perm[ii+perm[jj]] % 12; 212 | int gi1 = perm[ii+i1+perm[jj+j1]] % 12; 213 | int gi2 = perm[ii+1+perm[jj+1]] % 12; 214 | 215 | // Calculate the contribution from the three corners 216 | float t0 = 0.5 - x0*x0-y0*y0; 217 | if(t0<0) n0 = 0.0; 218 | else { 219 | t0 *= t0; 220 | n0 = t0 * t0 * dot(grad3[gi0], x0, y0); // (x,y) of grad3 used for 2D gradient 221 | } 222 | 223 | float t1 = 0.5 - x1*x1-y1*y1; 224 | if(t1<0) n1 = 0.0; 225 | else { 226 | t1 *= t1; 227 | n1 = t1 * t1 * dot(grad3[gi1], x1, y1); 228 | } 229 | 230 | float t2 = 0.5 - x2*x2-y2*y2; 231 | if(t2<0) n2 = 0.0; 232 | else { 233 | t2 *= t2; 234 | n2 = t2 * t2 * dot(grad3[gi2], x2, y2); 235 | } 236 | 237 | // Add contributions from each corner to get the final noise value. 238 | // The result is scaled to return values in the interval [-1,1]. 239 | return 70.0 * (n0 + n1 + n2); 240 | } 241 | 242 | 243 | // 3D raw Simplex noise 244 | float raw_noise_3d( const float x, const float y, const float z ) { 245 | float n0, n1, n2, n3; // Noise contributions from the four corners 246 | 247 | // Skew the input space to determine which simplex cell we're in 248 | float F3 = 1.0/3.0; 249 | float s = (x+y+z)*F3; // Very nice and simple skew factor for 3D 250 | int i = fastfloor(x+s); 251 | int j = fastfloor(y+s); 252 | int k = fastfloor(z+s); 253 | 254 | float G3 = 1.0/6.0; // Very nice and simple unskew factor, too 255 | float t = (i+j+k)*G3; 256 | float X0 = i-t; // Unskew the cell origin back to (x,y,z) space 257 | float Y0 = j-t; 258 | float Z0 = k-t; 259 | float x0 = x-X0; // The x,y,z distances from the cell origin 260 | float y0 = y-Y0; 261 | float z0 = z-Z0; 262 | 263 | // For the 3D case, the simplex shape is a slightly irregular tetrahedron. 264 | // Determine which simplex we are in. 265 | int i1, j1, k1; // Offsets for second corner of simplex in (i,j,k) coords 266 | int i2, j2, k2; // Offsets for third corner of simplex in (i,j,k) coords 267 | 268 | if(x0>=y0) { 269 | if(y0>=z0) { i1=1; j1=0; k1=0; i2=1; j2=1; k2=0; } // X Y Z order 270 | else if(x0>=z0) { i1=1; j1=0; k1=0; i2=1; j2=0; k2=1; } // X Z Y order 271 | else { i1=0; j1=0; k1=1; i2=1; j2=0; k2=1; } // Z X Y order 272 | } 273 | else { // x0 y0) ? 32 : 0; 370 | int c2 = (x0 > z0) ? 16 : 0; 371 | int c3 = (y0 > z0) ? 8 : 0; 372 | int c4 = (x0 > w0) ? 4 : 0; 373 | int c5 = (y0 > w0) ? 2 : 0; 374 | int c6 = (z0 > w0) ? 1 : 0; 375 | int c = c1 + c2 + c3 + c4 + c5 + c6; 376 | 377 | int i1, j1, k1, l1; // The integer offsets for the second simplex corner 378 | int i2, j2, k2, l2; // The integer offsets for the third simplex corner 379 | int i3, j3, k3, l3; // The integer offsets for the fourth simplex corner 380 | 381 | // simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some order. 382 | // Many values of c will never occur, since e.g. x>y>z>w makes x=3 ? 1 : 0; 387 | j1 = simplex[c][1]>=3 ? 1 : 0; 388 | k1 = simplex[c][2]>=3 ? 1 : 0; 389 | l1 = simplex[c][3]>=3 ? 1 : 0; 390 | // The number 2 in the "simplex" array is at the second largest coordinate. 391 | i2 = simplex[c][0]>=2 ? 1 : 0; 392 | j2 = simplex[c][1]>=2 ? 1 : 0; 393 | k2 = simplex[c][2]>=2 ? 1 : 0; 394 | l2 = simplex[c][3]>=2 ? 1 : 0; 395 | // The number 1 in the "simplex" array is at the second smallest coordinate. 396 | i3 = simplex[c][0]>=1 ? 1 : 0; 397 | j3 = simplex[c][1]>=1 ? 1 : 0; 398 | k3 = simplex[c][2]>=1 ? 1 : 0; 399 | l3 = simplex[c][3]>=1 ? 1 : 0; 400 | // The fifth corner has all coordinate offsets = 1, so no need to look that up. 401 | 402 | float x1 = x0 - i1 + G4; // Offsets for second corner in (x,y,z,w) coords 403 | float y1 = y0 - j1 + G4; 404 | float z1 = z0 - k1 + G4; 405 | float w1 = w0 - l1 + G4; 406 | float x2 = x0 - i2 + 2.0*G4; // Offsets for third corner in (x,y,z,w) coords 407 | float y2 = y0 - j2 + 2.0*G4; 408 | float z2 = z0 - k2 + 2.0*G4; 409 | float w2 = w0 - l2 + 2.0*G4; 410 | float x3 = x0 - i3 + 3.0*G4; // Offsets for fourth corner in (x,y,z,w) coords 411 | float y3 = y0 - j3 + 3.0*G4; 412 | float z3 = z0 - k3 + 3.0*G4; 413 | float w3 = w0 - l3 + 3.0*G4; 414 | float x4 = x0 - 1.0 + 4.0*G4; // Offsets for last corner in (x,y,z,w) coords 415 | float y4 = y0 - 1.0 + 4.0*G4; 416 | float z4 = z0 - 1.0 + 4.0*G4; 417 | float w4 = w0 - 1.0 + 4.0*G4; 418 | 419 | // Work out the hashed gradient indices of the five simplex corners 420 | int ii = i & 255; 421 | int jj = j & 255; 422 | int kk = k & 255; 423 | int ll = l & 255; 424 | int gi0 = perm[ii+perm[jj+perm[kk+perm[ll]]]] % 32; 425 | int gi1 = perm[ii+i1+perm[jj+j1+perm[kk+k1+perm[ll+l1]]]] % 32; 426 | int gi2 = perm[ii+i2+perm[jj+j2+perm[kk+k2+perm[ll+l2]]]] % 32; 427 | int gi3 = perm[ii+i3+perm[jj+j3+perm[kk+k3+perm[ll+l3]]]] % 32; 428 | int gi4 = perm[ii+1+perm[jj+1+perm[kk+1+perm[ll+1]]]] % 32; 429 | 430 | // Calculate the contribution from the five corners 431 | float t0 = 0.6 - x0*x0 - y0*y0 - z0*z0 - w0*w0; 432 | if(t0<0) n0 = 0.0; 433 | else { 434 | t0 *= t0; 435 | n0 = t0 * t0 * dot(grad4[gi0], x0, y0, z0, w0); 436 | } 437 | 438 | float t1 = 0.6 - x1*x1 - y1*y1 - z1*z1 - w1*w1; 439 | if(t1<0) n1 = 0.0; 440 | else { 441 | t1 *= t1; 442 | n1 = t1 * t1 * dot(grad4[gi1], x1, y1, z1, w1); 443 | } 444 | 445 | float t2 = 0.6 - x2*x2 - y2*y2 - z2*z2 - w2*w2; 446 | if(t2<0) n2 = 0.0; 447 | else { 448 | t2 *= t2; 449 | n2 = t2 * t2 * dot(grad4[gi2], x2, y2, z2, w2); 450 | } 451 | 452 | float t3 = 0.6 - x3*x3 - y3*y3 - z3*z3 - w3*w3; 453 | if(t3<0) n3 = 0.0; 454 | else { 455 | t3 *= t3; 456 | n3 = t3 * t3 * dot(grad4[gi3], x3, y3, z3, w3); 457 | } 458 | 459 | float t4 = 0.6 - x4*x4 - y4*y4 - z4*z4 - w4*w4; 460 | if(t4<0) n4 = 0.0; 461 | else { 462 | t4 *= t4; 463 | n4 = t4 * t4 * dot(grad4[gi4], x4, y4, z4, w4); 464 | } 465 | 466 | // Sum up and scale the result to cover the range [-1,1] 467 | return 27.0 * (n0 + n1 + n2 + n3 + n4); 468 | } 469 | 470 | 471 | int fastfloor( const float x ) { return x > 0 ? (int) x : (int) x - 1; } 472 | 473 | float dot( const int* g, const float x, const float y ) { return g[0]*x + g[1]*y; } 474 | float dot( const int* g, const float x, const float y, const float z ) { return g[0]*x + g[1]*y + g[2]*z; } 475 | float dot( const int* g, const float x, const float y, const float z, const float w ) { return g[0]*x + g[1]*y + g[2]*z + g[3]*w; } 476 | -------------------------------------------------------------------------------- /noise/setup.py: -------------------------------------------------------------------------------- 1 | from os import environ, remove 2 | from os.path import dirname, join, isfile 3 | from distutils.core import setup 4 | from distutils.extension import Extension 5 | try: 6 | from Cython.Build import cythonize 7 | from Cython.Distutils import build_ext 8 | have_cython = True 9 | except ImportError: 10 | have_cython = False 11 | import sys 12 | 13 | platform = sys.platform 14 | if platform == 'win32': 15 | cstdarg = '-std=gnu99' 16 | else: 17 | cstdarg = '-std=c99' 18 | 19 | do_clear_existing = True 20 | 21 | include_dir = join(dirname(__file__), 'kivent_noise', 'include') 22 | 23 | noise_modules = { 24 | 'kivent_noise.noise': ['kivent_noise/noise.pyx', 25 | 'kivent_noise/src/simplexnoise.cpp'], 26 | } 27 | 28 | noise_modules_c = { 29 | 'kivent_noise.noise': ['kivent_noise/noise.c', 30 | 'kivent_noise/src/simplexnoise.cpp'], 31 | } 32 | 33 | check_for_removal = [ 34 | 'kivent_noise/noise.c', 35 | ] 36 | 37 | 38 | 39 | def build_ext(ext_name, files, 40 | include_dirs=[include_dir]): 41 | return Extension(ext_name, files, include_dirs, 42 | extra_compile_args=['-ffast-math',], 43 | language="c++") 44 | 45 | extensions = [] 46 | noise_extensions = [] 47 | cmdclass = {} 48 | 49 | def build_extensions_for_modules_cython(ext_list, modules): 50 | ext_a = ext_list.append 51 | for module_name in modules: 52 | ext = build_ext(module_name, modules[module_name]) 53 | if environ.get('READTHEDOCS', None) == 'True': 54 | ext.pyrex_directives = {'embedsignature': True} 55 | ext_a(ext) 56 | return cythonize(ext_list) 57 | 58 | def build_extensions_for_modules(ext_list, modules): 59 | ext_a = ext_list.append 60 | for module_name in modules: 61 | ext = build_ext(module_name, modules[module_name]) 62 | if environ.get('READTHEDOCS', None) == 'True': 63 | ext.pyrex_directives = {'embedsignature': True} 64 | ext_a(ext) 65 | return ext_list 66 | 67 | if have_cython: 68 | if do_clear_existing: 69 | for file_name in check_for_removal: 70 | if isfile(file_name): 71 | remove(file_name) 72 | noise_extensions = build_extensions_for_modules_cython( 73 | noise_extensions, noise_modules) 74 | else: 75 | noise_extensions = build_extensions_for_modules(noise_extensions, 76 | noise_modules_c) 77 | 78 | setup( 79 | name='KivEnt noise', 80 | description='''A game engine for the Kivy Framework. 81 | https://github.com/Kovak/KivEnt for more info.''', 82 | author='Jacob Kovac', 83 | author_email='kovac1066@gmail.com', 84 | ext_modules=noise_extensions, 85 | cmdclass=cmdclass, 86 | packages=[ 87 | 'kivent_noise', 88 | ], 89 | package_dir={'kivent_noise': 'kivent_noise'}) 90 | -------------------------------------------------------------------------------- /systems/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Kovak/YACS/cfb9edd27363eccb9b7f4aefd3b59074efafb979/systems/__init__.py -------------------------------------------------------------------------------- /systems/asteroids.py: -------------------------------------------------------------------------------- 1 | from kivent_core.systems.gamesystem import GameSystem 2 | from kivy.properties import BooleanProperty, StringProperty, ObjectProperty 3 | from kivy.factory import Factory 4 | import math 5 | 6 | class AsteroidTemplate(object): 7 | 8 | def __init__(self, collision_type, max_velocity, max_angular_velocity, 9 | mass, radius, texture, model_key, health, armor, ship_collision_sound, 10 | asteroid_collision_sound, radar_model, radar_texture): 11 | self.collision_type = collision_type 12 | self.max_velocity = max_velocity 13 | self.max_angular_velocity = max_angular_velocity 14 | self.mass = mass 15 | self.radius = radius 16 | self.texture = texture 17 | self.model_key = model_key 18 | self.health = health 19 | self.armor = armor 20 | self.ship_collision_sound = ship_collision_sound 21 | self.asteroid_collision_sound = asteroid_collision_sound 22 | self.radar_model_key = radar_model 23 | self.radar_texture = radar_texture 24 | 25 | class AsteroidSystem(GameSystem): 26 | updateable = BooleanProperty(False) 27 | do_components = BooleanProperty(True) 28 | system_id = StringProperty("asteroids") 29 | explosion_system = ObjectProperty(None) 30 | player_system = ObjectProperty(None) 31 | is_clearing = BooleanProperty(False) 32 | 33 | def __init__(self, **kwargs): 34 | super(AsteroidSystem, self).__init__(**kwargs) 35 | self.template_register = {} 36 | 37 | 38 | def register_template(self, template_name, collision_type, 39 | max_velocity=250., max_angular_velocity=math.radians(200.), mass=50., 40 | radius=30., texture=None, model_key=None, health=15., armor=2., 41 | ship_collision_sound=-1, asteroid_collision_sound=-1, radar_model=None, 42 | radar_texture=None): 43 | self.template_register[template_name] = AsteroidTemplate( 44 | collision_type, max_velocity, max_angular_velocity, mass, radius, 45 | texture, model_key, health, armor, ship_collision_sound, 46 | asteroid_collision_sound, radar_model, radar_texture 47 | ) 48 | 49 | def spawn_explosion(self, entity_id): 50 | if not self.is_clearing: 51 | position = self.gameworld.entities[entity_id].position 52 | self.explosion_system.spawn_object_from_template( 53 | 'asteroid_explosion', position.pos 54 | ) 55 | 56 | def on_collision_begin_asteroid_ship(self, space, arbiter): 57 | asteroid_id = arbiter.shapes[0].body.data 58 | ship_id = arbiter.shapes[1].body.data 59 | entities = self.gameworld.entities 60 | asteroid_entity = entities[asteroid_id] 61 | #ship_entity = entities[ship_id] 62 | ship_collision_sound = asteroid_entity.asteroids.ship_collision_sound 63 | if ship_collision_sound != -1: 64 | volume_scale = self.player_system.get_distance_from_player_scalar( 65 | asteroid_entity.position.pos, max_distance=250.) 66 | self.gameworld.sound_manager.play_direct(ship_collision_sound, 67 | volume_scale) 68 | return True 69 | 70 | def on_collision_begin_asteroid_asteroid(self, space, arbiter): 71 | asteroid_id = arbiter.shapes[0].body.data 72 | asteroid2_id = arbiter.shapes[1].body.data 73 | entities = self.gameworld.entities 74 | asteroid_entity = entities[asteroid_id] 75 | #ship_entity = entities[ship_id] 76 | asteroid_comp = asteroid_entity.asteroids 77 | asteroid_collision_sound = asteroid_comp.asteroid_collision_sound 78 | if asteroid_collision_sound != -1: 79 | volume_scale = self.player_system.get_distance_from_player_scalar( 80 | asteroid_entity.position.pos, max_distance=250.) 81 | self.gameworld.sound_manager.play_direct( 82 | asteroid_collision_sound, volume_scale) 83 | return True 84 | 85 | def spawn_object_from_template(self, template_name, position, rotation=0., 86 | velocity=(0., 0.), angular_velocity=0.): 87 | template = self.template_register[template_name] 88 | shape_dict = { 89 | 'inner_radius': 0, 'outer_radius': template.radius, 90 | 'mass': template.mass, 'offset': (0, 0) 91 | } 92 | col_shape = { 93 | 'shape_type': 'circle', 'elasticity': .5, 94 | 'collision_type': template.collision_type, 95 | 'shape_info': shape_dict, 'friction': 1.0 96 | } 97 | col_shapes = [col_shape] 98 | physics_component = { 99 | 'main_shape': 'circle', 100 | 'velocity': velocity, 101 | 'position': position, 'angle': rotation, 102 | 'angular_velocity': angular_velocity, 103 | 'vel_limit': template.max_velocity, 104 | 'ang_vel_limit': template.max_angular_velocity, 105 | 'mass': template.mass, 'col_shapes': col_shapes 106 | } 107 | combat_stats_component = { 108 | 'health': template.health, 'armor': template.armor, 109 | 'destruction_callback': self.spawn_explosion, 110 | } 111 | create_component_dict = { 112 | 'cymunk_physics': physics_component, 113 | 'rotate_renderer': { 114 | 'texture': template.texture, 'model_key': template.model_key, 115 | }, 116 | 'position': position, 117 | 'rotate': rotation, 118 | 'radar_color': (150, 120, 120, 255), 119 | 'radar_renderer': {'model_key': template.radar_model_key, 120 | 'texture': template.radar_texture}, 121 | 'combat_stats': combat_stats_component, 122 | 'asteroids': { 123 | 'ship_collision_sound': template.ship_collision_sound, 124 | 'asteroid_collision_sound': template.asteroid_collision_sound, 125 | 'max_damage': 40., 126 | 'speed_mag': 1000., 127 | } 128 | } 129 | component_order = [ 130 | 'position', 'rotate', 'cymunk_physics', 'rotate_renderer', 131 | 'combat_stats', 'asteroids', 'radar_color', 'radar_renderer' 132 | ] 133 | return self.gameworld.init_entity( 134 | create_component_dict, component_order 135 | ) 136 | 137 | Factory.register("AsteroidSystem", cls=AsteroidSystem) -------------------------------------------------------------------------------- /systems/explosions.py: -------------------------------------------------------------------------------- 1 | from kivent_core.systems.gamesystem import GameSystem 2 | from kivy.properties import DictProperty, BooleanProperty, StringProperty 3 | from kivy.factory import Factory 4 | 5 | 6 | class ExplosionTemplate(object): 7 | def __init__(self, explosion_name, pause_time, remove_time): 8 | self.explosion_name = explosion_name 9 | self.pause_time = pause_time 10 | self.remove_time = pause_time + remove_time 11 | 12 | 13 | class ExplosionSystem(GameSystem): 14 | updateable = BooleanProperty(True) 15 | do_components = BooleanProperty(True) 16 | system_id = StringProperty("explosions") 17 | 18 | def __init__(self, **kwargs): 19 | super(ExplosionSystem, self).__init__(**kwargs) 20 | self.template_register = {} 21 | 22 | def init_component(self, component_index, entity_id, zone, args): 23 | '''Override this function to provide custom logic for setting up your 24 | component, by default each key, val pair of args will be setattr on 25 | the component.''' 26 | component = self.components[component_index] 27 | component.entity_id = entity_id 28 | component.current_time = 0 29 | component.pause_time = args.get('pause_time') 30 | 31 | def update(self, dt): 32 | entities = self.gameworld.entities 33 | for component in self.components: 34 | if component is not None: 35 | entity_id = component.entity_id 36 | entity = entities[entity_id] 37 | comp = entity.explosions 38 | comp.current_time += dt 39 | if comp.current_time >= comp.pause_time: 40 | entity.emitters.emitters[0].paused = True 41 | 42 | def register_template(self, template_name, explosion_name, pause_time, 43 | remove_time): 44 | self.template_register[template_name] = ExplosionTemplate( 45 | explosion_name, pause_time, remove_time 46 | ) 47 | 48 | def spawn_object_from_template(self, template_name, position, rotation=0.): 49 | template = self.template_register[template_name] 50 | create_component_dict = { 51 | 'position': position, 52 | 'rotate': rotation, 53 | 'emitters': [template.explosion_name], 54 | 'explosions': {'pause_time': template.pause_time}, 55 | 'lifespan': {'lifespan': template.remove_time}, 56 | } 57 | component_order = [ 58 | 'position', 'rotate', 'emitters', 'explosions', 'lifespan', 59 | ] 60 | return self.gameworld.init_entity( 61 | create_component_dict, component_order, 62 | ) 63 | 64 | Factory.register("ExplosionSystem", cls=ExplosionSystem) -------------------------------------------------------------------------------- /systems/globalmap.py: -------------------------------------------------------------------------------- 1 | from kivent_core.systems.gamesystem import GameSystem 2 | from kivy.factory import Factory 3 | from kivy.properties import NumericProperty, StringProperty, BooleanProperty 4 | from grid_generation import load_grid, generate_grid 5 | from background_generator import ZoneInfo 6 | from random import random, randint, choice, uniform, randrange, sample, seed 7 | from math import radians 8 | from kivent_core.managers.resource_managers import texture_manager 9 | from utils import get_asset_path 10 | from colors import color_choices 11 | 12 | class GlobalMapSystem(GameSystem): 13 | world_size = NumericProperty(10) 14 | margin = NumericProperty(100.) 15 | system_id = StringProperty('global_map') 16 | do_components = BooleanProperty(False) 17 | world_x = NumericProperty(0) 18 | world_y = NumericProperty(0) 19 | cell_size = NumericProperty(150.) 20 | grid_border_width = NumericProperty(0.) 21 | grid_line_width = NumericProperty(2.) 22 | grid_fade_width = NumericProperty(1.) 23 | 24 | def __init__(self, **kwargs): 25 | super(GlobalMapSystem, self).__init__(**kwargs) 26 | self.zone_infos = {} 27 | self.star_names = {} 28 | self.visited = [] 29 | 30 | def setup(self, world_seed, background_generator): 31 | self.world_seed = world_seed 32 | self.background_generator = background_generator 33 | self.setup_grid() 34 | self.setup_map_stars() 35 | self.setup_zones() 36 | self.setup_map_asteroids() 37 | self.setup_unexplored_icon() 38 | self.setup_map_planets() 39 | 40 | def add_zone_to_visited(self, zone_pos): 41 | self.visited.append(zone_pos) 42 | 43 | def setup_unexplored_icon(self): 44 | texture_name = texture_manager.load_image( 45 | get_asset_path('assets', 'ui_elements', 'unexplored-icon.png') 46 | ) 47 | model_manager = self.gameworld.model_manager 48 | self.unexplored_icon = model_manager.load_textured_rectangle( 49 | 'vertex_format_4f', 64, 64, 'unexplored-icon', 50 | '4f_unexplored-icon', 51 | ) 52 | model = model_manager.models[self.unexplored_icon] 53 | vt1 = model[0] 54 | vt2 = model[1] 55 | vt3 = model[2] 56 | vt4 = model[3] 57 | u1, v1 = vt1.uvs 58 | u2, v2 = vt2.uvs 59 | u3, v3 = vt3.uvs 60 | u4, v4 = vt4.uvs 61 | vt1.uvs = (u1, v3) 62 | vt2.uvs = (u2, v4) 63 | vt3.uvs = (u3, v1) 64 | vt4.uvs = (u4, v2) 65 | self.unexplored_texture = 'unexplored-icon' 66 | 67 | 68 | def setup_grid(self): 69 | outer_color = [150, 0, 100, 100] 70 | inner_color = [150, 0, 100, 255] 71 | grid_size = self.world_size 72 | actual_size = grid_size*self.cell_size, grid_size*self.cell_size 73 | actual_pos = (0., 0.) 74 | grid_offset, grid_data, cell_size = generate_grid( 75 | self.grid_border_width, 76 | self.grid_line_width, 77 | self.grid_fade_width, 78 | actual_size, 79 | actual_pos, grid_size + 1, 80 | outer_color, inner_color 81 | ) 82 | self.actual_cell_size = cell_size 83 | self.grid_model = load_grid(self.gameworld, grid_data, 'world_grid') 84 | self.grid_offset = grid_offset 85 | 86 | def setup_map_planets(self): 87 | world_seed = self.world_seed 88 | seed(world_seed.get_global_map_planet_seed()) 89 | background_generator = self.background_generator 90 | planets = {} 91 | model_manager = self.gameworld.model_manager 92 | planets['tiny'] = background_generator.generate_planets( 93 | 100, 100, 100, 40, 94 | 'tiny_map_planet', 95 | 'triangulated_models/circle_100_10.kem', 96 | ) 97 | for model_name in planets['tiny']: 98 | background_generator.draw_planet_simple(model_name, 150, 99 | choice(color_choices), 100 | choice(color_choices)) 101 | model = model_manager.models[model_name] 102 | model.mult_all_vertex_attribute('pos', uniform(.04, .06)) 103 | planets['small'] = background_generator.generate_planets( 104 | 100, 100, 100, 30, 105 | 'small_map_planet', 106 | 'triangulated_models/circle_100_10.kem', 107 | ) 108 | for model_name in planets['small']: 109 | background_generator.draw_planet_simple(model_name, 150, 110 | choice(color_choices), 111 | choice(color_choices)) 112 | model = model_manager.models[model_name] 113 | model.mult_all_vertex_attribute('pos', uniform(.06, .08)) 114 | planets['medium'] = background_generator.generate_planets( 115 | 100, 100, 100, 30, 116 | 'medium_map_planet', 117 | 'triangulated_models/circle_100_10.kem', 118 | ) 119 | for model_name in planets['medium']: 120 | background_generator.draw_planet_simple(model_name, 150, 121 | choice(color_choices), 122 | choice(color_choices)) 123 | model = model_manager.models[model_name] 124 | model.mult_all_vertex_attribute('pos', uniform(.08, .1)) 125 | planets['large'] = background_generator.generate_planets( 126 | 100, 100, 100, 20, 127 | 'large_map_planet', 128 | 'triangulated_models/circle_100_10.kem', 129 | ) 130 | for model_name in planets['large']: 131 | background_generator.draw_planet_simple(model_name, 150, 132 | choice(color_choices), 133 | choice(color_choices)) 134 | model = model_manager.models[model_name] 135 | model.mult_all_vertex_attribute('pos', uniform(.1, .12)) 136 | self.planets = planets 137 | 138 | 139 | def setup_map_stars(self): 140 | stars = self.star_names 141 | background_generator = self.background_generator 142 | generate_star = background_generator.generate_star 143 | generate_offset_star = background_generator.generate_offset_star 144 | stars['tiny_star'] = generate_star('tiny_map_star', 4, 'blue', 3.5) 145 | stars['small_star'] = generate_star('small_map_star', 34, 146 | 'blue', 4.5) 147 | stars['medium_star'] = generate_offset_star('medium_map_star', 16, 148 | 'blue', 4.0, 5.0) 149 | stars['large_star'] = generate_offset_star('large_star', 24, 150 | 'blue', 4., 5.5) 151 | 152 | def setup_map_asteroids(self): 153 | model_manager = self.gameworld.model_manager 154 | self.asteroid_model = model_manager.load_textured_rectangle( 155 | 'vertex_format_4f', 14, 14, 'asteroid1-radar', '4f_asteroid_map', 156 | ) 157 | self.asteroid_texture = 'asteroid1-radar' 158 | 159 | def draw_unexplored_icon(self, pos): 160 | create_dict = { 161 | 'position': pos, 162 | 'rotate': 0., 163 | 'color': (255, 255, 255, 255), 164 | 'global_map_renderer2': {'model_key': self.unexplored_icon, 165 | 'texture': self.unexplored_texture} 166 | } 167 | self.gameworld.init_entity(create_dict, 168 | ['position', 'rotate', 'color', 169 | 'global_map_renderer2']) 170 | 171 | def draw_planet(self, pos, planet_model): 172 | create_dict = { 173 | 'position': pos, 174 | 'global_map_planet_renderer': {'model_key': planet_model} 175 | } 176 | self.gameworld.init_entity(create_dict, 177 | ['position', 'global_map_planet_renderer']) 178 | 179 | def draw_asteroid(self, pos, rotate): 180 | create_dict = { 181 | 'position': pos, 182 | 'rotate': rotate, 183 | 'color': (155, 155, 155, 255), 184 | 'global_map_renderer2': {'model_key': self.asteroid_model, 185 | 'texture': self.asteroid_texture} 186 | } 187 | self.gameworld.init_entity(create_dict, 188 | ['position', 'rotate', 'color', 189 | 'global_map_renderer2']) 190 | 191 | 192 | def draw_map(self): 193 | world_seed = self.world_seed 194 | seed(world_seed.get_global_map_seed()) 195 | self.create_world_grid() 196 | zones = self.zone_infos 197 | draw_star = self.draw_star 198 | draw_asteroid = self.draw_asteroid 199 | draw_unexplored_icon = self.draw_unexplored_icon 200 | draw_planet = self.draw_planet 201 | get_bounds_for_cell = self.get_bounds_for_cell 202 | star_names = self.star_names 203 | tiny_star_name = star_names['tiny_star'] 204 | small_name = star_names['small_star'] 205 | med_star_name = star_names['medium_star'] 206 | large_star_name = star_names['large_star'] 207 | cell_size = self.cell_size 208 | tiny_planet_choices = self.planets['tiny'] 209 | small_choices = self.planets['small'] 210 | medium_choices = self.planets['medium'] 211 | large_choices = self.planets['large'] 212 | visited = self.visited 213 | for zone_key in zones: 214 | zone = zones[zone_key] 215 | x0, y0, x1, y1 = get_bounds_for_cell(zone_key) 216 | h = y1 - y0 217 | w = x1 - x0 218 | if True: 219 | x0 += w * .2 220 | y0 += h * .2 221 | x1 -= w * .2 222 | y1 -= h * .2 223 | for x in range(zone.tiny_suns): 224 | draw_star((uniform(x0, x1), uniform(y0, y1)), 225 | tiny_star_name) 226 | for x in range(zone.small_suns): 227 | draw_star((uniform(x0, x1), uniform(y0, y1)), 228 | small_name) 229 | for x in range(zone.medium_suns): 230 | draw_star((uniform(x0, x1), uniform(y0, y1)), 231 | med_star_name) 232 | for x in range(zone.large_suns): 233 | draw_star((uniform(x0, x1), uniform(y0, y1)), 234 | large_star_name) 235 | for x in range(int(zone.asteroid_count//30)): 236 | draw_asteroid((uniform(x0, x1), uniform(y0, y1)), 237 | radians(uniform(0., 360.))) 238 | for x in range(zone.tiny_planets): 239 | draw_planet((uniform(x0, x1), uniform(y0, y1)), 240 | choice(tiny_planet_choices)) 241 | for x in range(zone.small_planets): 242 | draw_planet((uniform(x0, x1), uniform(y0, y1)), 243 | choice(small_choices)) 244 | for x in range(zone.medium_planets): 245 | draw_planet((uniform(x0, x1), uniform(y0, y1)), 246 | choice(medium_choices)) 247 | for x in range(zone.large_planets): 248 | draw_planet((uniform(x0, x1), uniform(y0, y1)), 249 | choice(large_choices)) 250 | 251 | else: 252 | draw_unexplored_icon((x0 + .5 * w, y0 + .5 * h)) 253 | 254 | def draw_star(self, pos, star_name): 255 | create_dict = { 256 | 'position': pos, 257 | 'global_map_renderer': {'model_key': star_name} 258 | } 259 | self.gameworld.init_entity(create_dict, 260 | ['position', 'global_map_renderer']) 261 | 262 | def setup_zones(self): 263 | world_seed = self.world_seed 264 | zones = self.zone_infos 265 | for x in range(self.world_size): 266 | for y in range(self.world_size): 267 | zones[(x, y)] = zone = ZoneInfo(world_seed, x, y) 268 | 269 | def get_cell_pos_from_world_pos(self, pos): 270 | x, y = pos 271 | return int(x // self.cell_size), int(y // self.cell_size) 272 | 273 | def get_bounds_for_cell(self, cell_pos): 274 | cx, cy = cell_pos 275 | line_space = self.grid_fade_width + self.grid_line_width 276 | cell_size = self.actual_cell_size + line_space 277 | return (cx * cell_size, cy * cell_size, 278 | (cx + 1) * cell_size, (cy + 1) * cell_size) 279 | 280 | def on_touch_down(self, touch): 281 | cell_pos = self.get_cell_pos_from_world_pos(touch.pos) 282 | 283 | 284 | def create_world_grid(self): 285 | create_dict = { 286 | 'position': self.grid_offset, 287 | 'world_grid': {'model_key': self.grid_model}, 288 | } 289 | ent = self.gameworld.init_entity( 290 | create_dict, 291 | ['position', 'world_grid']) 292 | return ent 293 | 294 | 295 | Factory.register("GlobalMapSystem", cls=GlobalMapSystem) -------------------------------------------------------------------------------- /systems/player.py: -------------------------------------------------------------------------------- 1 | from kivent_core.systems.gamesystem import GameSystem 2 | from kivy.factory import Factory 3 | from kivy.properties import (NumericProperty, BooleanProperty, ObjectProperty, 4 | ListProperty, StringProperty) 5 | from kivy.clock import Clock 6 | from kivy.vector import Vector 7 | 8 | 9 | class PlayerSystem(GameSystem): 10 | current_entity = NumericProperty(None, allownone=True) 11 | physics_system = ObjectProperty(None) 12 | camera_system = ObjectProperty(None) 13 | touch_count = NumericProperty(0) 14 | current_health = NumericProperty(100.) 15 | total_health = NumericProperty(100.) 16 | current_shields = NumericProperty(0.) 17 | total_shields = NumericProperty(100.) 18 | current_weapon_name = StringProperty('Weapon Name') 19 | current_ammo = NumericProperty(0) 20 | total_ammo = NumericProperty(100) 21 | engine_rumble = NumericProperty(None) 22 | sound_manager = ObjectProperty(None) 23 | updateable = BooleanProperty(True) 24 | last_touch = ListProperty([]) 25 | weapon_system = ObjectProperty(None) 26 | 27 | def __init__(self, **kwargs): 28 | super(PlayerSystem, self).__init__(**kwargs) 29 | 30 | def set_boosting(self, dt): 31 | if self.current_entity is not None: 32 | entity = self.gameworld.entities[self.current_entity] 33 | ship_comp = entity.ship_system 34 | ship_comp.boosting = True 35 | if self.engine_rumble is not None: 36 | self.sound_manager.play_direct_loop(self.engine_rumble, 1.) 37 | 38 | 39 | def get_distance_from_player_scalar(self, position, max_distance=250): 40 | current_entity = self.current_entity 41 | entities = self.gameworld.entities 42 | if current_entity == None: 43 | return 0. 44 | 45 | entity = entities[current_entity] 46 | position_comp = entity.position 47 | distance = Vector(position_comp.pos).distance(position) 48 | if distance > max_distance: 49 | return 0. 50 | else: 51 | return 1. - distance/max_distance 52 | 53 | def update(self, dt): 54 | if self.current_entity is not None: 55 | entity = self.gameworld.entities[self.current_entity] 56 | combat_stats = entity.combat_stats 57 | weapon_comp = entity.projectile_weapons 58 | current_weapon = weapon_comp.equipped_weapon 59 | self.current_health = combat_stats.health 60 | self.current_ammo = current_weapon.in_clip 61 | self.total_ammo = current_weapon.ammo_count 62 | if hasattr(entity, 'shields'): 63 | shield_comp = entity.shields 64 | self.current_shields = shield_comp.current_health 65 | self.total_shields = shield_comp.max_health 66 | if self.last_touch != []: 67 | camera_system = self.camera_system 68 | world_pos = camera_system.convert_from_screen_to_world( 69 | self.last_touch) 70 | steering = entity.steering 71 | steering.target = world_pos 72 | steering.active = True 73 | 74 | def on_touch_down(self, touch): 75 | touch.grab(self) 76 | self.touch_count += 1 77 | touch_radius = 20 78 | touch_count = self.touch_count 79 | physics_system = self.physics_system 80 | camera_system = self.camera_system 81 | world_pos = camera_system.convert_from_screen_to_world(touch.pos) 82 | x, y = world_pos 83 | collide_area = [ 84 | x - touch_radius, y - touch_radius, 85 | x + touch_radius, y + touch_radius 86 | ] 87 | self.last_touch = [] 88 | if self.current_entity is not None: 89 | entity = self.gameworld.entities[self.current_entity] 90 | collisions = physics_system.query_bb(collide_area) 91 | if len(collisions) > 0: 92 | weapons = entity.projectile_weapons 93 | weapons.firing = True 94 | elif touch_count == 1: 95 | steering = entity.steering 96 | steering.target = world_pos 97 | self.last_touch = touch.pos 98 | steering.active = True 99 | Clock.schedule_once(self.set_boosting, .5) 100 | elif touch_count == 2: 101 | weapons = entity.projectile_weapons 102 | weapons.firing = True 103 | Clock.unschedule(self.set_boosting) 104 | return True 105 | else: 106 | return False 107 | 108 | def on_touch_move(self, touch): 109 | if self.touch_count == 1: 110 | camera_system = self.camera_system 111 | world_pos = camera_system.convert_from_screen_to_world(touch.pos) 112 | if self.current_entity is not None: 113 | entity = self.gameworld.entities[self.current_entity] 114 | steering = entity.steering 115 | steering.target = world_pos 116 | self.last_touch = touch.pos 117 | 118 | 119 | def on_touch_up(self, touch): 120 | if self.current_entity is not None: 121 | entity = self.gameworld.entities[self.current_entity] 122 | ship_comp = entity.ship_system 123 | ship_comp.boosting = False 124 | if self.engine_rumble is not None: 125 | self.sound_manager.stop_direct(self.engine_rumble) 126 | self.last_touch = [] 127 | 128 | Clock.unschedule(self.set_boosting) 129 | if touch.grab_current is self: 130 | self.touch_count -= 1 131 | super(PlayerSystem, self).on_touch_up(touch) 132 | 133 | def load_player(self): 134 | ship_system = self.gameworld.system_manager['ship_system'] 135 | ship_id = ship_system.spawn_ship('ship1', True, (500., 500.)) 136 | template = ship_system.templates['ship1'] 137 | self.current_health = template.health 138 | self.total_health = template.health 139 | self.current_entity = ship_id 140 | self.current_weapon_name = self.weapon_system.get_current_weapon_name( 141 | ship_id) 142 | camera = self.gameworld.system_manager['camera_planet2'] 143 | camera.focus_entity = True 144 | camera.entity_to_focus = ship_id 145 | 146 | Factory.register('PlayerSystem', cls=PlayerSystem) -------------------------------------------------------------------------------- /systems/shield.py: -------------------------------------------------------------------------------- 1 | from kivent_core.systems.gamesystem import GameSystem 2 | from kivy.properties import (DictProperty, BooleanProperty, StringProperty, 3 | ObjectProperty, NumericProperty) 4 | from kivy.factory import Factory 5 | from cymunk import Circle 6 | 7 | # class ShieldTemplate(object): 8 | # def __init__(self, explosion_name, pause_time, remove_time): 9 | # self.explosion_name = explosion_name 10 | # self.pause_time = pause_time 11 | # self.remove_time = pause_time + remove_time 12 | 13 | 14 | class ShieldSystem(GameSystem): 15 | updateable = BooleanProperty(True) 16 | do_components = BooleanProperty(True) 17 | system_id = StringProperty("shields") 18 | physics_system = ObjectProperty(None) 19 | player_system = ObjectProperty(None) 20 | shield_collision_type = NumericProperty(None) 21 | combat_stats_system = ObjectProperty(None) 22 | 23 | def __init__(self, **kwargs): 24 | super(ShieldSystem, self).__init__(**kwargs) 25 | # self.template_register = {} 26 | 27 | def register_collision(self): 28 | physics_system = self.physics_system 29 | self.shield_collision_type = physics_system.register_collision_type( 30 | 'shields') 31 | 32 | def on_collision_begin_ship_shield(self, space, arbiter): 33 | ship_id = arbiter.shapes[0].body.data 34 | shield_id = arbiter.shapes[1].body.data 35 | entities = self.gameworld.entities 36 | ship_entity = entities[ship_id] 37 | shield_entity = entities[shield_id] 38 | if shield_entity.shields.shield_active: 39 | shield_entity.shields.shield_visible = True 40 | return True 41 | else: 42 | return False 43 | 44 | def on_collision_begin_shield_shield(self, space, arbiter): 45 | shield1_id = arbiter.shapes[0].body.data 46 | shield2_id = arbiter.shapes[1].body.data 47 | entities = self.gameworld.entities 48 | shield_entity1 = entities[shield1_id] 49 | shield_entity2 = entities[shield2_id] 50 | if shield_entity1.shields.shield_active and \ 51 | shield_entity2.shields.shield_active: 52 | shield_entity1.shields.shield_visible = True 53 | shield_entity2.shields.shield_visible = True 54 | print('ships collide, shields on') 55 | return True 56 | else: 57 | print('ships collide, shields off') 58 | return False 59 | 60 | def on_collision_begin_bullet_shield(self, space, arbiter): 61 | bullet_id = arbiter.shapes[0].body.data 62 | collision_id = arbiter.shapes[1].body.data 63 | entities = self.gameworld.entities 64 | projectile_entity = entities[bullet_id] 65 | shield_entity = entities[collision_id] 66 | comp = projectile_entity.projectiles 67 | 68 | shield_comp = shield_entity.shields 69 | if comp.origin_entity != collision_id and shield_comp.shield_active: 70 | damage_entity = self.combat_stats_system.damage_entity 71 | shield_comp.shield_visible = True 72 | shield_comp.current_health -= comp.damage 73 | shield_comp.current_timeout = shield_comp.timeout 74 | damage_entity(bullet_id, comp.damage, comp.armor_pierce) 75 | hit_sound = comp.hit_sound 76 | if hit_sound != -1: 77 | volume = self.player_system.get_distance_from_player_scalar( 78 | projectile_entity.position.pos, max_distance=500.) 79 | sound_manager = self.gameworld.sound_manager 80 | sound_manager.play_direct(hit_sound, volume) 81 | return True 82 | else: 83 | return False 84 | 85 | def on_collision_begin_asteroid_shield(self, space, arbiter): 86 | asteroid_id = arbiter.shapes[0].body.data 87 | ship_id = arbiter.shapes[1].body.data 88 | entities = self.gameworld.entities 89 | asteroid_entity = entities[asteroid_id] 90 | ship_entity = entities[ship_id] 91 | asteroid_comp = asteroid_entity.asteroids 92 | asteroid_physics = asteroid_entity.cymunk_physics 93 | ship_physics = ship_entity.cymunk_physics 94 | asteroid_speed = asteroid_physics.body.speed 95 | ship_speed = ship_physics.body.speed 96 | ship_collision_sound = asteroid_comp.ship_collision_sound 97 | if ship_collision_sound != -1: 98 | volume_scale = self.player_system.get_distance_from_player_scalar( 99 | asteroid_entity.position.pos, max_distance=250.) 100 | self.gameworld.sound_manager.play_direct(ship_collision_sound, 101 | volume_scale) 102 | shield_comp = ship_entity.shields 103 | if shield_comp.shield_active: 104 | shield_comp.shield_visible = True 105 | shield_comp.current_health -= asteroid_comp.max_damage * ( 106 | ship_speed + asteroid_speed)/asteroid_comp.speed_mag 107 | shield_comp.current_timeout = shield_comp.timeout 108 | return True 109 | else: 110 | return False 111 | 112 | def init_component(self, component_index, entity_id, zone, args): 113 | '''Override this function to provide custom logic for setting up your 114 | component, by default each key, val pair of args will be setattr on 115 | the component.''' 116 | component = self.components[component_index] 117 | component.entity_id = entity_id 118 | entity = self.gameworld.entities[entity_id] 119 | physics_comp = entity.cymunk_physics 120 | space = self.physics_system.space 121 | body = physics_comp.body 122 | new_shape = Circle(body, args.get('radius'), (0., 0.)) 123 | new_shape.collision_type = self.shield_collision_type 124 | physics_comp.shapes.append(new_shape) 125 | space.add(new_shape) 126 | space.reindex_shape(new_shape) 127 | component.recharge_rate = args.get('recharge_rate') 128 | component.max_health = args.get('health') 129 | component.current_health = args.get('health') 130 | component.timeout = args.get('timeout') 131 | component.current_timeout = 0. 132 | component.shield_active = True 133 | component.shield_visible = False 134 | component.shield_broken = False 135 | component.shield_fade_in = .2 136 | component.shield_on = .5 137 | component.shield_fade_out = .3 138 | component.state = 'off' 139 | 140 | def update(self, dt): 141 | entities = self.gameworld.entities 142 | for component in self.components: 143 | if component is not None: 144 | entity_id = component.entity_id 145 | entity = entities[entity_id] 146 | comp = entity.shields 147 | color_comp = entity.color 148 | render_comp = entity.shield_renderer 149 | if comp.current_timeout > 0.: 150 | comp.current_timeout -= dt 151 | if comp.current_timeout <= 0.: 152 | comp.current_health = min( 153 | comp.max_health, 154 | comp.current_health + comp.recharge_rate*dt 155 | ) 156 | comp.shield_visible = False 157 | if comp.current_health == comp.max_health: 158 | comp.shield_active = True 159 | comp.shield_broken = False 160 | if comp.current_health <= 0 and not comp.shield_broken: 161 | comp.current_health = 0. 162 | comp.shield_broken = True 163 | comp.current_timeout = comp.timeout * 3. 164 | comp.shield_visible = False 165 | comp.shield_active = False 166 | if comp.shield_visible: 167 | render_comp.render = True 168 | else: 169 | render_comp.render = False 170 | 171 | # def register_template(self, template_name, explosion_name, pause_time, 172 | # remove_time): 173 | # self.template_register[template_name] = ExplosionTemplate( 174 | # explosion_name, pause_time, remove_time 175 | # ) 176 | 177 | 178 | 179 | Factory.register("ShieldSystem", cls=ShieldSystem) -------------------------------------------------------------------------------- /systems/ships.py: -------------------------------------------------------------------------------- 1 | from kivent_core.systems.gamesystem import GameSystem 2 | from kivy.properties import BooleanProperty, ObjectProperty 3 | from kivy.factory import Factory 4 | import math 5 | from random import choice 6 | from kivent_core.memory_handlers.utils import memrange 7 | 8 | class ShipTemplate(object): 9 | 10 | def __init__(self, template_name, name, model, texture, collision_type, 11 | health, mass, max_speed, max_turn_speed, accel, 12 | angular_accel, boost_force, 13 | boost_drain, max_boost_speed, armor, boost_reserve, 14 | boost_regen, width, height, weapons, emitters, 15 | emitter_speed_base, scale_base, emitter_scaling_factor, 16 | explosion_sound, has_shield, shield_model, shield_health, 17 | shield_radius, shield_timeout, shield_recharge, radar_model_name, 18 | radar_texture): 19 | self.name = name 20 | self.template_name = template_name 21 | self.collision_type = collision_type 22 | self.model = model 23 | self.texture = texture 24 | self.health = health 25 | self.armor = armor 26 | self.mass = mass 27 | self.max_speed = max_speed 28 | self.max_turn_speed = max_turn_speed 29 | self.accel = accel 30 | self.angular_accel = angular_accel 31 | self.boost_force = boost_force 32 | self.boost_drain = boost_drain 33 | self.max_boost_speed = max_boost_speed 34 | self.boost_reserve = boost_reserve 35 | self.boost_regen = boost_regen 36 | self.width = width 37 | self.height = height 38 | self.weapons = weapons 39 | self.emitters = emitters 40 | self.emitter_speed_base = emitter_speed_base 41 | self.scale_base = scale_base 42 | self.emitter_scaling_factor = emitter_scaling_factor 43 | self.explosion_sound = explosion_sound 44 | self.has_shield = has_shield 45 | self.shield_model = shield_model 46 | self.shield_health = shield_health 47 | self.shield_radius = shield_radius 48 | self.shield_timeout = shield_timeout 49 | self.shield_recharge = shield_recharge 50 | self.radar_model_name = radar_model_name 51 | self.radar_texture = radar_texture 52 | 53 | 54 | class ShipSystem(GameSystem): 55 | updateable = BooleanProperty(True) 56 | player_system = ObjectProperty(None) 57 | is_clearing = BooleanProperty(False) 58 | explosion_system = ObjectProperty(None) 59 | camera_system = ObjectProperty(None) 60 | 61 | def __init__(self, **kwargs): 62 | super(ShipSystem, self).__init__(**kwargs) 63 | self.templates = {} 64 | 65 | def register_template(self, template_name, name, model, texture, 66 | collision_type, health=100, 67 | mass=100, max_speed=150, max_turn_speed=150, accel=15000, 68 | angular_accel=45, boost_force=2500., 69 | boost_drain=25., max_boost_speed=225., armor=10., boost_reserve=100., 70 | boost_regen=10., width=100., height=100., weapons=[], emitters=[], 71 | emitter_speed_base=90., scale_base=2.2, emitter_scaling_factor=150., 72 | explosion_sound=-1, has_shield=False, shield_model=None, 73 | shield_health=100., shield_radius=100., shield_timeout=1.25, 74 | shield_recharge=20., radar_model_name=None, radar_texture=None 75 | ): 76 | self.templates[template_name] = ShipTemplate( 77 | template_name, name, model, texture, collision_type, health, 78 | mass, max_speed, max_turn_speed, accel, 79 | angular_accel, boost_force, 80 | boost_drain, max_boost_speed, armor, boost_reserve, 81 | boost_regen, width, height, weapons, emitters, 82 | emitter_speed_base, scale_base, emitter_scaling_factor, 83 | explosion_sound, has_shield, shield_model, shield_health, 84 | shield_radius, shield_timeout, shield_recharge, radar_model_name, 85 | radar_texture 86 | ) 87 | 88 | def update(self, dt): 89 | entities = self.gameworld.entities 90 | for component in self.components: 91 | if component is not None: 92 | entity = entities[component.entity_id] 93 | engine_emitter = entity.emitters.emitters[0] 94 | physics_component = entity.cymunk_physics 95 | body = physics_component.body 96 | component.current_reserve += dt * component.boost_regen 97 | component.current_reserve = min( 98 | component.current_reserve, component.boost_reserve 99 | ) 100 | if component.boosting and component.current_reserve > 0.: 101 | impulse = body.rotation_vector 102 | component.current_reserve -= dt * component.boost_drain 103 | boost_force = component.boost_force * dt 104 | impulse = impulse[0] * boost_force, impulse[1] * boost_force 105 | body.apply_impulse(impulse) 106 | body.velocity_limit = component.boost_limit 107 | if component.current_reserve <= 0.: 108 | component.boosting = False 109 | else: 110 | body.velocity_limit = component.velocity_limit 111 | speed = body.speed 112 | if speed < 20.0: 113 | engine_emitter.paused = True 114 | else: 115 | engine_emitter.paused = False 116 | engine_emitter.speed = ( 117 | speed/component.emitter_scaling_factor * 118 | component.emitter_speed_base 119 | ) 120 | engine_emitter.start_scale = ( 121 | speed/component.emitter_scaling_factor * 122 | component.scale_base 123 | ) 124 | 125 | 126 | def spawn_ship(self, ship_name, is_player_character, position): 127 | ship_id = self.load_ship(ship_name, is_player_character, position) 128 | entity = self.gameworld.entities[ship_id] 129 | emitters = entity.emitters 130 | emitter = emitters.emitters[0] 131 | emitter.emit_angle_offset = 180. 132 | emitter.pos_offset = (50., 0.) 133 | return ship_id 134 | 135 | def spawn_explosion(self, entity_id): 136 | if not self.is_clearing: 137 | entity = self.gameworld.entities[entity_id] 138 | position = entity.position 139 | ship_comp = entity.ship_system 140 | explosion_sound = ship_comp.explosion_sound 141 | if explosion_sound != -1: 142 | volume = self.player_system.get_distance_from_player_scalar( 143 | entity.position.pos, max_distance=4000.) 144 | sound_manager = self.gameworld.sound_manager 145 | sound_manager.play_direct(explosion_sound, volume) 146 | self.explosion_system.spawn_object_from_template( 147 | 'ship_explosion', position.pos 148 | ) 149 | if entity_id == self.player_system.current_entity: 150 | self.player_system.current_entity = None 151 | self.camera_system.entity_to_focus = None 152 | 153 | def load_ship(self, ship_name, is_player_character, position): 154 | template = self.templates[ship_name] 155 | gameworld = self.gameworld 156 | box_dict = { 157 | 'width': template.width, 158 | 'height': template.height, 159 | 'mass': template.mass} 160 | col_shape_dict = { 161 | 'shape_type': 'box', 'elasticity': .5, 162 | 'collision_type': template.collision_type, 163 | 'shape_info': box_dict, 'friction': 1.0 164 | } 165 | physics_component_dict = { 'main_shape': 'box', 166 | 'velocity': (0, 0), 'position': position, 'angle': 0, 167 | 'angular_velocity': 0, 'mass': template.mass, 168 | 'vel_limit': template.max_speed, 169 | 'ang_vel_limit': math.radians(template.max_turn_speed), 170 | 'col_shapes': [col_shape_dict]} 171 | ship_system_dict = { 172 | 'name': template.name, 173 | 'scale_base': template.scale_base, 174 | 'emitter_speed_base': template.emitter_speed_base, 175 | 'emitter_scaling_factor': template.emitter_scaling_factor, 176 | 'boosting': False, 177 | 'boost_force': template.boost_force, 178 | 'boost_reserve': template.boost_reserve, 179 | 'boost_drain': template.boost_drain, 180 | 'velocity_limit': template.max_speed, 181 | 'boost_limit': template.max_boost_speed, 182 | 'current_reserve': template.boost_reserve, 183 | 'boost_regen': template.boost_regen, 184 | 'explosion_sound': template.explosion_sound 185 | } 186 | combat_stats = { 187 | 'health': template.health, 188 | 'armor': template.armor, 189 | 'destruction_callback': self.spawn_explosion, 190 | } 191 | steering = { 192 | 'turn_speed': math.radians(template.max_turn_speed), 193 | 'stability': 9000000.0, 194 | 'max_force': template.accel, 195 | 'speed': template.max_speed, 196 | 'arrived_radius': 50. 197 | } 198 | weapon_choice = choice( 199 | [ 'ship1_rifle', 'ship1_shotgun', 'ship1_blaster']) 200 | create_component_dict = { 201 | 'position': position, 202 | 'rotate': 0., 203 | 'color': (255, 0, 0, 255), 204 | 'emitters': template.emitters, 205 | 'cymunk_physics': physics_component_dict, 206 | 'rotate_renderer': { 207 | 'model_key': template.model, 208 | 'texture': template.texture, 209 | }, 210 | 'ship_system': ship_system_dict, 211 | 'combat_stats': combat_stats, 212 | 'steering': steering, 213 | 'projectile_weapons': {'weapons': [weapon_choice]} 214 | } 215 | component_order = ['position', 'rotate', 'color', 'cymunk_physics', 216 | 'rotate_renderer', 'ship_system', 'steering', 'emitters', 217 | 'projectile_weapons', 'combat_stats'] 218 | if not is_player_character: 219 | component_order.extend(['steering_ai', 'weapon_ai']) 220 | create_component_dict['steering_ai'] = { 221 | 'target': self.player_system.current_entity, 222 | } 223 | create_component_dict['weapon_ai'] = { 224 | 'line_of_sight': 600., 225 | 'active': True, 226 | 'target_id': self.player_system.current_entity 227 | } 228 | if template.has_shield: 229 | component_order.extend(['shields', 'shield_renderer']) 230 | create_component_dict['shields'] = { 231 | 'radius': template.shield_radius, 232 | 'recharge_rate': template.shield_recharge, 233 | 'health': template.shield_health, 234 | 'timeout': template.shield_timeout 235 | } 236 | create_component_dict['shield_renderer'] = { 237 | 'model_key': template.shield_model, 238 | 'render': True 239 | } 240 | if template.radar_model_name is not None: 241 | component_order.extend(['radar_color', 'radar_renderer']) 242 | create_component_dict['radar_color'] = (255, 0, 0, 255) 243 | create_component_dict['radar_renderer'] = { 244 | 'model_key': template.radar_model_name, 245 | 'texture': template.radar_texture 246 | } 247 | ship_ent_id = gameworld.init_entity( 248 | create_component_dict, component_order, zone='ships', 249 | ) 250 | return ship_ent_id 251 | 252 | 253 | Factory.register('ShipSystem', cls=ShipSystem) -------------------------------------------------------------------------------- /ui_elements.py: -------------------------------------------------------------------------------- 1 | from kivy.properties import (StringProperty, ObjectProperty, ListProperty, 2 | DictProperty, NumericProperty, BooleanProperty) 3 | from kivy.uix.boxlayout import BoxLayout 4 | from kivent_core.uix.gamescreens import GameScreen 5 | from kivy.uix.widget import Widget 6 | 7 | 8 | class MainScreen(GameScreen): 9 | current_health = NumericProperty(100.0) 10 | total_health = NumericProperty(100.0) 11 | current_ammo = NumericProperty(0) 12 | total_ammo = NumericProperty(100) 13 | weapon_name = StringProperty('default') 14 | current_shields = NumericProperty(0.) 15 | total_shields = NumericProperty(100.0) 16 | 17 | 18 | class MapScreen(GameScreen): 19 | pass 20 | 21 | 22 | class JumpScreen(GameScreen): 23 | pass 24 | 25 | 26 | class HealthBar(Widget): 27 | current_health = NumericProperty(100.0) 28 | total_health = NumericProperty(100.0) 29 | health_percentage = NumericProperty(1.0) 30 | 31 | def on_current_health(self, instance, value): 32 | if value >= 0: 33 | self.health_percentage = float(value)/float(self.total_health) 34 | else: 35 | self.health_percentage = 0. 36 | 37 | class ShieldBar(Widget): 38 | current_shields = NumericProperty(100.0) 39 | total_shields = NumericProperty(100.0) 40 | shield_percentage = NumericProperty(0.) 41 | 42 | def on_current_shields(self, instance, value): 43 | if value >= 0: 44 | self.shield_percentage = float(value)/float(self.total_shields) 45 | else: 46 | self.shield_percentage = 0. 47 | 48 | class AmmoBar(BoxLayout): 49 | current_ammo = NumericProperty(0) 50 | total_ammo = NumericProperty(100) 51 | weapon_name = StringProperty('default') 52 | -------------------------------------------------------------------------------- /utils.py: -------------------------------------------------------------------------------- 1 | from os import path 2 | import __main__ 3 | from random import choice 4 | 5 | def iweighted_choice(choices): 6 | return choice(sum([[v]*wt for v, wt in choices], [])) 7 | 8 | def lerp(v0, v1, t): 9 | return (1-t)*v0 + t * v1 10 | 11 | def lerp_color(col_1, col_2, d): 12 | return [lerp(c1, c2, d) for c1, c2 in zip(col_1, col_2)] 13 | 14 | def get_asset_path(*args): 15 | return path.join(path.dirname(__main__.__file__), *args) -------------------------------------------------------------------------------- /yacs.kv: -------------------------------------------------------------------------------- 1 | #:kivy 1.9.0 2 | #:import get_asset_path utils.get_asset_path 3 | #:set COLOR_HIGHLIGHT (0.788235294, 0.643137255, 1) 4 | #:set COLOR_BACKGROUND (0.349019608, 0.082352941, 0.658823529) 5 | #:set COLOR_BACKGROUND_A50 (0.349019608, 0.082352941, 0.658823529, .5) 6 | #:set COLOR_BORDER (0.643137255, 0.160784314, 1) 7 | #:set COLOR_BORDER_A50 (0.643137255, 0.160784314, 1, .5) 8 | #:set COLOR_BORDER_A75 (0.643137255, 0.160784314, 1, .75) 9 | #:set COLOR_HIGHLIGHT_A50 (0.788235294, 0.643137255, 1, .5) 10 | #:set COLOR_HIGHLIGHT_A75 (0.788235294, 0.643137255, 1, .75) 11 | #:set COLOR_HIGHLIGHT_A100 (0.788235294, 0.643137255, 1, 1.0) 12 | #:set COLOR_BACKGROUND_A100 (0.349019608, 0.082352941, 0.658823529, 1.0) 13 | #:set COLOR_BORDER_A100 (0.643137255, 0.160784314, 1, 1.0) 14 | 15 | YACSGame: 16 | 17 | : 18 | gameworld: gameworld 19 | GameWorld: 20 | id: gameworld 21 | gamescreenmanager: gamescreenmanager 22 | size_of_gameworld: 600*1024 23 | system_count: 34 24 | zones: {'general': 10000, 'particles': 10000, 'ships': 50, 'projectiles': 5000} 25 | model_format_allocations: {'vertex_format_2f4ub': (50000*1024, 50000*1024), 'vertex_format_4f': (10000*1024, 10000*1024), 'vertex_format_9f4ub': (10000*1024, 10000*1024)} 26 | PositionSystem2D: 27 | system_id: 'position' 28 | gameworld: gameworld 29 | zones: ['general', 'particles', 'ships', 'projectiles'] 30 | RotateSystem2D: 31 | gameworld: gameworld 32 | zones: ['general', 'particles', 'ships', 'projectiles'] 33 | ScaleSystem2D: 34 | gameworld: gameworld 35 | zones: ['general', 'particles', 'ships'] 36 | ColorSystem: 37 | gameworld: gameworld 38 | zones: ['general', 'particles', 'ships'] 39 | ColorSystem: 40 | gameworld: gameworld 41 | system_id: 'radar_color' 42 | zones: ['general', 'ships'] 43 | PlayerSystem: 44 | do_components: False 45 | system_id: 'player' 46 | gameworld: gameworld 47 | camera_system: camera_top 48 | physics_system: physics 49 | id: player 50 | sound_manager: gameworld.sound_manager 51 | weapon_system: weapons 52 | GameView: 53 | gameworld: gameworld 54 | id: camera_stars1 55 | system_id: 'camera_stars1' 56 | camera_pos: (camera_top.camera_pos[0])*.4, (camera_top.camera_pos[1])*.4 57 | touch_pass_through: True 58 | camera_scale: root.zoom_level 59 | do_scroll_lock: False 60 | window_size: root.size 61 | size: root.size 62 | GameView: 63 | gameworld: gameworld 64 | id: camera_stars2 65 | system_id: 'camera_stars2' 66 | window_size: root.size 67 | do_scroll_lock: False 68 | camera_pos: (camera_top.camera_pos[0])*.5, (camera_top.camera_pos[1])*.5 69 | touch_pass_through: True 70 | camera_scale: root.zoom_level 71 | size: root.size 72 | GameView: 73 | gameworld: gameworld 74 | id: camera_sun1 75 | system_id: 'camera_sun1' 76 | window_size: root.size 77 | camera_pos: (camera_top.camera_pos[0])*.66, (camera_top.camera_pos[1])*.66 78 | touch_pass_through: True 79 | camera_scale: root.zoom_level 80 | do_scroll_lock: False 81 | size: root.size 82 | GameView: 83 | gameworld: gameworld 84 | id: camera_sun2 85 | system_id: 'camera_sun2' 86 | window_size: root.size 87 | camera_scale: root.zoom_level 88 | camera_pos: (camera_top.camera_pos[0])*.75, (camera_top.camera_pos[1])*.75 89 | touch_pass_through: True 90 | do_scroll_lock: False 91 | size: root.size 92 | GameMap: 93 | system_id: 'map' 94 | id: map 95 | map_size: (2500., 2500.) 96 | GameMap: 97 | system_id: 'g_map' 98 | id: g_map 99 | map_size: (2500., 2500.) 100 | GameMap: 101 | id: world_map 102 | system_id: 'world_map' 103 | map_size: [global_map.world_size*global_map.cell_size]*2 104 | GameView: 105 | gameworld: gameworld 106 | id: camera_planet1 107 | system_id: 'camera_planet1' 108 | window_size: root.size 109 | camera_pos: (camera_top.camera_pos[0])*.83, (camera_top.camera_pos[1])*.83 110 | do_scroll_lock: False 111 | camera_scale: root.zoom_level 112 | touch_pass_through: True 113 | size: root.size 114 | GameView: 115 | gameworld: gameworld 116 | do_scroll: True 117 | do_scroll_lock: True 118 | touch_pass_through: True 119 | id: camera_top 120 | size_hint: (None, None) 121 | camera_pos: (-500., -500.) 122 | system_id: 'camera_planet2' 123 | size: root.size 124 | currentmap: map 125 | camera_scale: root.zoom_level 126 | window_size: root.size 127 | render_system_order: ['shield_renderer', 'rotate_renderer','particle_renderer', 'planet2'] 128 | GameView: 129 | gameworld: gameworld 130 | do_scroll: True 131 | do_scroll_lock: True 132 | id: grid_camera 133 | system_id: 'grid_camera' 134 | size: root.size 135 | window_size: root.width * .6, root.height * .6 136 | pos: root.width * .2, root.height *.3 137 | currentmap: g_map 138 | camera_scale: 4. * root.zoom_level 139 | render_system_order: ['radar_renderer', 'map_grid'] 140 | canvas.before: 141 | ScissorPush: 142 | size: self.window_size 143 | pos: self.pos 144 | 145 | canvas.after: 146 | ScissorPop: 147 | GameView: 148 | gameworld: gameworld 149 | do_scroll: True 150 | do_scroll_lock: True 151 | id: global_camera 152 | system_id: 'global_camera' 153 | size: root.size 154 | window_size: root.size 155 | pos: root.pos 156 | currentmap: world_map 157 | camera_scale: root.zoom_level 158 | do_touch_zoom: True 159 | scale_min: .2 160 | scale_max: 5. 161 | render_system_order: ['global_map_renderer2', 'global_map_planet_renderer', 'global_map_renderer', 'world_grid'] 162 | 163 | PolyRenderer: 164 | gameworld: gameworld 165 | shader_source: get_asset_path('assets', 'shaders', 'poscolorshader.glsl') 166 | system_id: 'back_stars' 167 | zones: ['general'] 168 | static_rendering: True 169 | max_batches: 5 170 | gameview: 'camera_stars1' 171 | size_of_batches: 512 172 | force_update: True 173 | system_names: ['back_stars', 'position'] 174 | frame_count: 1 175 | PolyRenderer: 176 | gameworld: gameworld 177 | shader_source: get_asset_path('assets', 'shaders', 'poscolorshader.glsl') 178 | system_id: 'mid_stars' 179 | zones: ['general'] 180 | static_rendering: True 181 | max_batches: 5 182 | force_update: True 183 | gameview: 'camera_stars2' 184 | size_of_batches: 512 185 | system_names: ['mid_stars', 'position'] 186 | frame_count: 1 187 | PolyRenderer: 188 | gameworld: gameworld 189 | shader_source: get_asset_path('assets', 'shaders', 'poscolorshader.glsl') 190 | system_id: 'sun1' 191 | zones: ['general'] 192 | static_rendering: True 193 | force_update: True 194 | max_batches: 10 195 | gameview: 'camera_sun1' 196 | size_of_batches: 768 197 | system_names: ['sun1', 'position'] 198 | frame_count: 1 199 | PolyRenderer: 200 | gameworld: gameworld 201 | shader_source: get_asset_path('assets', 'shaders', 'poscolorshader.glsl') 202 | system_id: 'sun2' 203 | zones: ['general'] 204 | static_rendering: True 205 | force_update: True 206 | max_batches: 10 207 | gameview: 'camera_sun2' 208 | size_of_batches: 768 209 | system_names: ['sun2', 'position'] 210 | frame_count: 1 211 | PolyRenderer: 212 | gameworld: gameworld 213 | shader_source: get_asset_path('assets', 'shaders', 'poscolorshader.glsl') 214 | zones: ['general'] 215 | system_id: 'planet1' 216 | gameview: 'camera_planet1' 217 | force_update: True 218 | static_rendering: True 219 | max_batches: 10 220 | size_of_batches: 768 221 | system_names: ['planet1', 'position'] 222 | frame_count: 1 223 | PolyRenderer: 224 | gameworld: gameworld 225 | shader_source: get_asset_path('assets', 'shaders', 'poscolorshader.glsl') 226 | system_id: 'planet2' 227 | zones: ['general'] 228 | force_update: True 229 | static_rendering: True 230 | max_batches: 10 231 | gameview: 'camera_planet2' 232 | size_of_batches: 768 233 | system_names: ['planet2', 'position'] 234 | frame_count: 1 235 | ParticleSystem: 236 | id: particles 237 | gameworld: gameworld 238 | zones: ['particles'] 239 | particle_zone: 'particles' 240 | ParticleRenderer: 241 | gameworld: gameworld 242 | zones: ['particles'] 243 | shader_source: get_asset_path('assets', 'shaders', 'positionrotatecolorscale.glsl') 244 | frame_count: 3 245 | max_batches: 20 246 | size_of_batches: 1024 247 | gameview: 'camera_planet2' 248 | updateable: True 249 | EmitterSystem: 250 | id: emitter 251 | gameworld: gameworld 252 | zones: ['ships', 'projectiles', 'general'] 253 | particle_system: particles.__self__ 254 | CymunkPhysics: 255 | gameworld: root.gameworld 256 | zones: ['ships', 'projectiles', 'general'] 257 | updateable: True 258 | id: physics 259 | SteeringSystem: 260 | zones: ['ships'] 261 | gameworld: root.gameworld 262 | updateable: True 263 | SteeringAISystem: 264 | zones: ['ships'] 265 | gameworld: root.gameworld 266 | physics_system: physics.__self__ 267 | WeaponAISystem: 268 | zones: ['ships'] 269 | gameworld: root.gameworld 270 | physics_system: physics.__self__ 271 | RotateRenderer: 272 | zones: ['ships', 'projectiles', 'general'] 273 | gameworld: gameworld 274 | max_batches: 20 275 | frame_count: 3 276 | updateable: True 277 | gameview: 'camera_planet2' 278 | shader_source: get_asset_path('assets', 'shaders', 'positionrotateshader.glsl') 279 | ColorPolyRenderer: 280 | gameworld: gameworld 281 | shader_source: get_asset_path('assets', 'shaders', 'poscolorshader.glsl') 282 | system_id: 'shield_renderer' 283 | zones: ['ships'] 284 | static_rendering: False 285 | max_batches: 10 286 | gameview: 'camera_planet2' 287 | size_of_batches: 768 288 | system_names: ['shield_renderer', 'position', 'color'] 289 | frame_count: 2 290 | PolyRenderer: 291 | gameworld: gameworld 292 | shader_source: get_asset_path('assets', 'shaders', 'poscolorshader.glsl') 293 | system_id: 'map_grid' 294 | zones: ['general'] 295 | force_update: True 296 | static_rendering: True 297 | max_batches: 5 298 | gameview: 'grid_camera' 299 | size_of_batches: 768 300 | system_names: ['map_grid', 'position'] 301 | frame_count: 1 302 | PolyRenderer: 303 | gameworld: gameworld 304 | shader_source: get_asset_path('assets', 'shaders', 'poscolorshader.glsl') 305 | system_id: 'world_grid' 306 | zones: ['general'] 307 | gameview: 'global_camera' 308 | force_update: True 309 | static_rendering: True 310 | max_batches: 5 311 | size_of_batches: 768 312 | system_names: ['world_grid', 'position'] 313 | frame_count: 1 314 | PolyRenderer: 315 | gameworld: gameworld 316 | shader_source: get_asset_path('assets', 'shaders', 'poscolorshader.glsl') 317 | system_id: 'global_map_renderer' 318 | zones: ['general'] 319 | static_rendering: True 320 | force_update: True 321 | max_batches: 10 322 | gameview: 'global_camera' 323 | size_of_batches: 768 324 | system_names: ['global_map_renderer', 'position'] 325 | frame_count: 1 326 | PolyRenderer: 327 | gameworld: gameworld 328 | shader_source: get_asset_path('assets', 'shaders', 'poscolorshader.glsl') 329 | system_id: 'global_map_planet_renderer' 330 | zones: ['general'] 331 | static_rendering: True 332 | force_update: True 333 | max_batches: 10 334 | gameview: 'global_camera' 335 | size_of_batches: 768 336 | system_names: ['global_map_planet_renderer', 'position'] 337 | frame_count: 1 338 | RotateColorRenderer: 339 | zones: ['general'] 340 | gameworld: gameworld 341 | max_batches: 10 342 | frame_count: 1 343 | system_id: 'global_map_renderer2' 344 | static_rendering: True 345 | force_update: True 346 | gameview: 'global_camera' 347 | system_names: ['global_map_renderer2', 'position', 'rotate', 'color'] 348 | shader_source: get_asset_path('assets', 'shaders', 'positionrotatecolorshader.glsl') 349 | GlobalMapSystem: 350 | gameworld: gameworld 351 | zones: ['general'] 352 | id: global_map 353 | size: root.size 354 | pos: root.pos 355 | gameview: 'global_camera' 356 | RotateColorRenderer: 357 | zones: ['ships', 'general'] 358 | gameworld: gameworld 359 | max_batches: 20 360 | system_id: 'radar_renderer' 361 | frame_count: 3 362 | updateable: True 363 | size_of_batches: 768 364 | gameview: 'grid_camera' 365 | system_names: ['radar_renderer', 'position', 'rotate', 'radar_color'] 366 | shader_source: get_asset_path('assets', 'shaders', 'positionrotatecolorshader.glsl') 367 | ShipSystem: 368 | zones: ['ships'] 369 | do_components: True 370 | system_id: 'ship_system' 371 | id: ship_system 372 | explosion_system: explosions 373 | gameworld: gameworld 374 | camera_system: camera_top 375 | player_system: player 376 | ProjectileSystem: 377 | gameworld: gameworld 378 | id: projectiles 379 | zones: ['projectiles'] 380 | emitter_system: emitter 381 | physics_system: physics 382 | combat_stats_system: combat_stats 383 | player_system: player 384 | ProjectileWeaponSystem: 385 | zones: ['ships'] 386 | id: weapons 387 | gameworld: gameworld 388 | player_entity: player.current_entity 389 | player_system: player 390 | sound_distance: 2000. 391 | projectile_system: projectiles.__self__ 392 | CombatStatsSystem: 393 | id: combat_stats 394 | gameworld: gameworld 395 | zones: ['ships', 'projectiles', 'general'] 396 | LifespanSystem: 397 | id: lifespan 398 | gameworld: gameworld 399 | zones: ['projectiles', 'general'] 400 | AsteroidSystem: 401 | id: asteroids 402 | gameworld: gameworld 403 | explosion_system: explosions 404 | player_system: player 405 | ExplosionSystem: 406 | id: explosions 407 | gameworld: gameworld 408 | zones: ['general'] 409 | ShieldSystem: 410 | id: shields 411 | gameworld: gameworld 412 | zones: ['ships'] 413 | physics_system: physics 414 | player_system: player 415 | combat_stats_system: combat_stats 416 | GameScreenManager: 417 | id: gamescreenmanager 418 | size: root.size 419 | pos: root.pos 420 | gameworld: gameworld 421 | MainScreen: 422 | current_health: player.current_health 423 | total_health: player.total_health 424 | current_shields: player.current_shields 425 | total_shields: player.total_shields 426 | current_ammo: player.current_ammo 427 | total_ammo: player.total_ammo 428 | weapon_name: player.current_weapon_name 429 | MapScreen: 430 | JumpScreen: 431 | 432 | 433 | : 434 | name: 'jump' 435 | Button: 436 | text: 'Close' 437 | pos_hint: {'x': .025, 'y': .9} 438 | size_hint: (.15, .085) 439 | on_release: app.root.set_state('main') 440 | 441 | : 442 | name: 'map' 443 | Button: 444 | text: 'Close' 445 | pos_hint: {'x': .025, 'y': .9} 446 | size_hint: (.15, .085) 447 | on_release: app.root.set_state('main') 448 | Button: 449 | text: 'Jump' 450 | pos_hint: {'x': .025, 'y': .025} 451 | size_hint: (.15, .085) 452 | on_release: app.root.set_state('worldmap') 453 | 454 | 455 | : 456 | name: 'main' 457 | FloatLayout: 458 | Button: 459 | text: 'Minimap' 460 | pos_hint: {'x': .025, 'y': .9} 461 | size_hint: (.15, .085) 462 | on_release: app.root.set_state('minimap') 463 | DebugPanel: 464 | size_hint: (.15, .1) 465 | pos_hint: {'x': .005, 'y': .025} 466 | FloatLayout: 467 | size_hint: (.25, None) 468 | x: (root.width - self.width) / 2. 469 | y: self.height + dp(5.) 470 | height: health.height + ammo.height + shields.height 471 | id: stats 472 | HealthBar: 473 | id: health 474 | size_hint: (1.0, None) 475 | height: dp(25.) 476 | x: stats.x 477 | y: stats.y + stats.height - dp(40.) 478 | current_health: root.current_health 479 | total_health: root.total_health 480 | ShieldBar: 481 | id: shields 482 | size_hint: (1.0, None) 483 | height: dp(5.) 484 | x: stats.x 485 | y: stats.y + stats.height - dp(50.) 486 | current_shields: root.current_shields 487 | total_shields: root.total_shields 488 | AmmoBar: 489 | id: ammo 490 | size_hint: (.5, None) 491 | height: dp(20.) 492 | x: stats.x 493 | y: stats.y + stats.height - dp(75.) 494 | current_ammo: root.current_ammo 495 | total_ammo: root.total_ammo 496 | weapon_name: root.weapon_name 497 | 498 | 499 | : 500 | Label: 501 | pos: root.pos 502 | size: root.size 503 | font_size: root.size[1]*.5 504 | halign: 'center' 505 | valign: 'middle' 506 | color: (1,1,1,1) 507 | text: 'FPS: ' + root.fps if root.fps != None else 'FPS:' 508 | 509 | 510 | : 511 | 512 | size_hint: (1.0, 1.0) 513 | canvas: 514 | Color: 515 | rgba: COLOR_BACKGROUND_A50 516 | Rectangle: 517 | pos: self.pos 518 | size: self.size 519 | Color: 520 | rgba: COLOR_HIGHLIGHT_A50 521 | Rectangle: 522 | pos: self.pos 523 | size: ((root.health_percentage)*self.size[0], self.size[1]) 524 | Color: 525 | rgba: COLOR_BORDER_A50 526 | Line: 527 | width: 2. 528 | rectangle: (self.pos[0], self.pos[1], self.size[0], self.size[1]) 529 | joint: 'bevel' 530 | 531 | : 532 | 533 | size_hint: (1.0, 1.0) 534 | canvas: 535 | Color: 536 | rgba: COLOR_HIGHLIGHT_A75 537 | Rectangle: 538 | pos: self.pos 539 | size: (root.shield_percentage*self.size[0], self.size[1]) 540 | 541 | : 542 | orientation: 'horizontal' 543 | spacing: dp(5.) 544 | Label: 545 | text: str(root.current_ammo) 546 | size_hint: (.4, 1.0) 547 | halign: 'left' 548 | Label: 549 | text: str(root.total_ammo) 550 | size_hint: (.6, 1.0) 551 | halign: 'left' 552 | 553 | --------------------------------------------------------------------------------