{"id":21459517,"url":"https://github.com/benckx/chimp-utils","last_synced_at":"2026-07-15T09:32:36.064Z","repository":{"id":84322678,"uuid":"316200398","full_name":"benckx/chimp-utils","owner":"benckx","description":"A collection of Kotlin APIs and helpers for jMonkeyEngine","archived":false,"fork":false,"pushed_at":"2025-01-22T15:53:58.000Z","size":89,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-26T10:34:36.678Z","etag":null,"topics":["game","game-3d","game-development","game-engine","jmonkey","jmonkeyengine","jmonkeyengine3","kotlin","kotlin-android","library"],"latest_commit_sha":null,"homepage":"","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benckx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-11-26T10:47:13.000Z","updated_at":"2025-10-11T04:21:53.000Z","dependencies_parsed_at":"2025-10-26T10:32:22.394Z","dependency_job_id":"ddba0503-9fbe-4305-b744-beaa58832364","html_url":"https://github.com/benckx/chimp-utils","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/benckx/chimp-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benckx%2Fchimp-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benckx%2Fchimp-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benckx%2Fchimp-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benckx%2Fchimp-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benckx","download_url":"https://codeload.github.com/benckx/chimp-utils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benckx%2Fchimp-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35499864,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-15T02:00:06.706Z","response_time":131,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["game","game-3d","game-development","game-engine","jmonkey","jmonkeyengine","jmonkeyengine3","kotlin","kotlin-android","library"],"created_at":"2024-11-23T06:29:30.700Z","updated_at":"2026-07-15T09:32:36.059Z","avatar_url":"https://github.com/benckx.png","language":"Kotlin","funding_links":["https://paypal.me/benckx/2"],"categories":[],"sub_categories":[],"readme":"\u003ca href=\"https://paypal.me/benckx/2\"\u003e\n\u003cimg src=\"https://img.shields.io/badge/Donate-PayPal-green.svg\"/\u003e\n\u003c/a\u003e\n\n# About\n\nA collection of Kotlin API / helpers / facades for jMonkeyEngine3, that I developed\nwhile working on my game *Everybody Loves Bricks*: \n\n* https://benckx.itch.io/elb\n* https://www.youtube.com/watch?v=Tm6QexsctfQ\n* https://www.youtube.com/watch?v=qzs6Z_jM6mE\n\nAlthough Kotlin-based, it can be re-used from a Java only project. \n\n# Features\n\n## Material\n\n### Example: Unshaded Material\n\n```kotlin\n    override fun simpleInitApp() {\n        // do this at init \n        MaterialDefinitions.load(assetManager) \n        \n        // creating a material with a more simple API\n        val floorMat = UnshadedMaterial()\n        floorMat.setColor(ColorRGBA(155, 164, 193))\n\n        val floor = Geometry(\"FLOOR\", Box(10f, 10f, 10f))\n        floor.material = floorMat\n    }\n```\n\n### Example: Lighting Material\n\n```kotlin\n    override fun simpleInitApp() {\n        MaterialDefinitions.load(assetManager)\n        addLighting()\n\n        val material = LightingMaterial()\n        material.setColor(Orange) // same value for 'Diffuse' and 'Specular'\n\n        val geometry = Geometry(\"SPHERE\", Sphere(15, 15, 1f))\n        geometry.material = material\n        geometry.shadowMode = RenderQueue.ShadowMode.CastAndReceive\n\n        rootNode.attachChild(geometry)\n    }\n\n    private fun addLighting() {\n        val decorLight = DirectionalLight()\n        decorLight.direction = Vector3f(-1f, 1f, -2f).normalizeLocal()\n        decorLight.color = ColorRGBA.White\n        rootNode.addLight(decorLight)\n    }\n```\n\nThis snippet (Kotlin):\n\n```kotlin\n    val material = LightingMaterial()\n    material.setColors(ColorRGBA.Orange, ColorRGBA.White)\n```\n\nis equivalent to the following in the jme3 API (Java):\n```java\n    Material material = new Material(assetManager, \"Common/MatDefs/Light/Lighting.j3md\");\n    material.setBoolean(\"UseMaterialColors\", true);\n    material.setColor(\"Diffuse\", ColorRGBA.Orange);\n    material.setColor(\"Specular\", ColorRGBA.White);\n```\n\n## ColorRGBA\n\nCreate a `ColorRGBA` in hexadecimal:\n\n```kotlin\n    override fun simpleInitApp() {\n        viewPort.backgroundColor = ColorRGBA(\"#1c3064\")\n    }\n```\n\nor with 255-based int values:\n\n```kotlin\n    override fun simpleInitApp() {\n        viewPort.backgroundColor = ColorRGBA(155, 164, 193)\n    }\n``` \n\n## Node\n\nAdd multiple `Spatial` children, as varargs or collections:\n```kotlin\nimport be.encelade.chimp.utils.NodeHelperUtils.attachChildren\nimport com.jme3.scene.Geometry\nimport com.jme3.scene.Node\n\nclass SceneNode : Node(\"MY_SCENE\") {\n\n    init {\n        attachChildren(makeFloor(), makeGrid())\n    }\n\n    private companion object {\n\n        fun makeFloor(): Geometry {\n            // ..\n        }\n\n        fun makeGrid(): Geometry {\n            // ...\n        }\n\n    }\n}\n\n```\n\n## Vector Operators\n\n```kotlin\n    import be.encelade.chimp.utils.VectorOperatorUtils.plus\n\n    // ...\n    val v1 = Vector3f(2f, 1f, 1f)\n    val v2 = Vector3f(4f, 4f, 4f)\n\n    // prints (6.0, 5.0, 5.0)\n    println(v1 + v2)\n```\n\n## Tpf Accumulator\n\nThe Tpf Accumulator is a mechanism to run actions (i.e. callback) periodically at a certain frequency (e.g. 2 Hz), \nbased on the accumulated tpf being received from the engine.\n\nIt is designed for periodic actions that don't need to run as often as tpf updates (that can easily be in the 200 Hz range), \nin order to create timers-liked behavior within the main engine thread.\n\nIt can be used for example to trigger a refresh of the UI, update the scene based on game state changes\nor implement cycle-based game entity (e.g. a machine that outputs a product every 1 sec. in a Factorio-like game). \n\n### Example: Run something every 2 seconds\n\n```kotlin\nclass DemoSimpleApp : SimpleApplication() {\n\n    private val tpfAccumulator = TpfAccumulator(.5f) { tpf -\u003e\n        val fps = (1 / tpf).toInt()\n        println(\"[${DateTime.now()}] running at $fps FPS\")\n    }\n\n    override fun simpleUpdate(tpf: Float) {\n        tpfAccumulator.simpleUpdate(tpf)\n    }\n}\n```\n\n```\n[2020-11-28T12:29:18.940+01:00] running at 282 FPS\n[2020-11-28T12:29:20.939+01:00] running at 307 FPS\n[2020-11-28T12:29:22.937+01:00] running at 298 FPS\n[2020-11-28T12:29:24.936+01:00] running at 222 FPS\n[2020-11-28T12:29:26.937+01:00] running at 287 FPS\n[2020-11-28T12:29:28.938+01:00] running at 220 FPS\n``` \n\n# Samples / Examples\n* Use Material and ColorRGBA:\nhttps://github.com/benckx/ouistiti/tree/master/src/test/kotlin\n\n# Import with Gradle\n\n```groovy\n    repositories {\n        maven { url \"https://jitpack.io\" }\n    }\n\n    def chimpUtilsVersion = \"1.7.0\"\n    \n    dependencies {\n        compile \"com.github.benckx.chimp-utils:chimp-utils-basics:$chimpUtilsVersion\"\n        compile \"com.github.benckx.chimp-utils:chimp-utils-jme3:$chimpUtilsVersion\"\n    }\n```\n\n# Project Structure\n\n* `chimp-utils-basics` does not have any dependency to jme3. If you split your game logic from your rendering logic, i.e. if you \nsplit your game into a \"game logic\" module (with no dependency to jme3) and a \"engine render\" module, then this library can\nbe used in your game logic module, without the requirement to link to any jme3 library.  \n* `chimp-utils-jme3` contains the APIs that depend on jme3 (only `jme3-core`).\n\n# Change log\n\n## Version 1.7.0\n\n* Upgrade Kotlin from `1.5.21` to `1.6.21`\n* Upgrade [LWJGL](https://www.lwjgl.org/) from `2.9.3` to `3.3.1`\n* Upgrade [jMonkeyEngine3](https://jmonkeyengine.org/) from `3.3.2-stable` to `3.5.2-stable`\n* Remove dependency to Joda Time\n\n# Related Projects\n\n* **ouistiti**: A basic camera manager for management/strategy games:\u003cbr/\u003e\n  https://github.com/benckx/ouistiti\n* **chimp-utils**: A collection of Kotlin APIs and helpers for jMonkeyEngine:\u003cbr/\u003e\n  https://github.com/benckx/chimp-utils\n* **jme-asset-viewer**: Minimalist GUI to preview/test 3D assets in a jMonkeyEngine scene:\u003cbr/\u003e\n  https://github.com/benckx/jme-asset-viewer\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenckx%2Fchimp-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenckx%2Fchimp-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenckx%2Fchimp-utils/lists"}