Title: ursina optimization · Issue #572 · Show-Me-the-Code/python · GitHub
Open Graph Title: ursina optimization · Issue #572 · Show-Me-the-Code/python
X Title: ursina optimization · Issue #572 · Show-Me-the-Code/python
Description: my code sucks and gives only 5-15 FPS max. I programing minecraft on ursina. pls help me here's the code: `from ursina import * from ursina.prefabs.first_person_controller import FirstPersonController from numpy import floor from perlin_...
Open Graph Description: my code sucks and gives only 5-15 FPS max. I programing minecraft on ursina. pls help me here's the code: `from ursina import * from ursina.prefabs.first_person_controller import FirstPersonControl...
X Description: my code sucks and gives only 5-15 FPS max. I programing minecraft on ursina. pls help me here's the code: `from ursina import * from ursina.prefabs.first_person_controller import FirstPersonCon...
Opengraph URL: https://github.com/Show-Me-the-Code/python/issues/572
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ursina optimization","articleBody":"my code sucks and gives only 5-15 FPS max. I programing minecraft on ursina. pls help me\n\nhere's the code:\n \n`from ursina import *\nfrom ursina.prefabs.first_person_controller import FirstPersonController\n\nfrom numpy import floor\nfrom perlin_noise import PerlinNoise\nimport matplotlib.pyplot as plt\nimport random\n\nnoise = PerlinNoise(octaves=3, seed=random.randint(1, 10000))\n\n\napp = Ursina(vsync=False)\n\nFPS = 120\n\nselected_block = \"grass\"\n\nblocks_texture = {\n \"grass\" : load_texture('Textures/grassUV.png'),\n \"dirt\": load_texture(\"Textures/groundMud1.png\"),\n \"stone\": load_texture(\"Textures/wallStone1.png\"),\n \"bedrock\": load_texture(\"Textures/bedrock.png\")\n\n}\n\nblocks = []\n\narm_texture = load_texture('Textures/arm1.png')\nsky_texture = load_texture('Textures/skybox.png')\n\n#sky = Entity(\n# model = 'sphere', texture = sky_texture,\n# scale = 1000, double_sided = True\n# )\n\nplayer = FirstPersonController(\n mouse_sensitivity=Vec2(100, 100),\n position=(0, 10, 0),\n )\n\n\nclass Voxel(Entity):\n def __init__(self, position, block_type):\n super().__init__(\n position=position,\n model=\"Stuff/Models/Grass_block_pycraft\",\n scale=0.5,\n origin_y=-0.5,\n texture=blocks_texture.get(block_type),\n collider=\"box\"\n )\n self.block_type = block_type\n\nmini_block_ia = Entity(\n parent = camera,\n model = \"Stuff/Models/Grass_block_pycraft\",\n scale = 0.075,\n texture=blocks_texture.get(selected_block),\n position = (0.15, -0.2, 0.5),\n rotation = (-15, -30, -5)\n )\n\n#CTAPAR |**EHEPA|_|R\n#min_height = -5\n#for x in range(-10, 10):\n# for z in range(-10, 10):\n# height = noise([x * 0.02, z * 0.02])\n# height = math.floor(height * 7.5)\n# for y in range(height, min_height - 1, -1):\n# if y == min_height:\n# block = Voxel((x, y + min_height, z), \"bedrock\")\n# elif y == height:\n# block = Voxel((x, y + min_height, z), \"grass\")\n# elif height - y > 2:\n# block = Voxel((x, y + min_height, z), \"stone\")\n# else:\n# block = Voxel((x, y + min_height, z), \"dirt\")\nmin_height = -5\nfor x in range(-16, 16):\n for z in range(-16, 16):\n height = noise([x * 0.02, z * 0.02])\n height = math.floor(height * 7.5)\n for y in range(height, min_height - 1, -1):\n if y == min_height:\n blocks.append(Voxel((x, y + min_height, z), \"bedrock\"))\n elif y == height:\n blocks.append(Voxel((x, y + min_height, z), \"grass\"))\n elif height - y > 2:\n blocks.append(Voxel((x, y + min_height, z), \"stone\"))\n else:\n blocks.append(Voxel((x, y + min_height, z), \"dirt\"))\n\n\ndef input(key):\n global selected_block\n if key == \"right mouse down\":\n hit_info = raycast(camera.world_position, camera.forward, distance=10)\n if hit_info.hit:\n block = Voxel(hit_info.entity.position + hit_info.normal, selected_block)\n if key == \"left mouse down\" and mouse.hovered_entity:\n if not mouse.hovered_entity.block_type == \"bedrock\":\n destroy(mouse.hovered_entity)\n if key == \"1\":\n selected_block = \"grass\"\n if key == '2':\n selected_block = \"dirt\"\n if key == '3':\n selected_block = \"stone\"\n\ndef update():\n mini_block_ia.texture=blocks_texture.get(selected_block)\n if player.y \u003c= -10:\n player.position = (0,10,0)\n\n \nblock = blocks\n\n\n\narm = Entity(parent = camera.ui, model = 'Stuff/Models/arm1',\n texture = arm_texture, scale = 0.2,\n rotation = Vec3(150, 60, -30), position = Vec2(0.5,-0.6))\n\n\n\n\n\n\napp.run()`\n\nmy configuration:\nRTX 4060\nIntel Core I5 8400\n16GB DDR4 Kingston Fury\n\n\n\n\n\nP.S. i need more optimization","author":{"url":"https://github.com/Geiwwjk122","@type":"Person","name":"Geiwwjk122"},"datePublished":"2026-01-17T16:12:33Z","url":"https://github.com/Show-Me-the-Code/python/issues/572"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:bf3b15e2-0622-a6ab-c9cb-13cac1831cc8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CC34:3F8DC1:A54D76:D8CC14:6AFE830D |
| html-safe-nonce | 9edc8885dd99c83b1da0210ede6c976a73f343e58d87e2a4c1b8af9d193a5754 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQzM0OjNGOERDMTpBNTRENzY6RDhDQzE0OjZBRkU4MzBEIiwidmlzaXRvcl9pZCI6IjQ1NDUxMzg5NjgwMDk1NDAzNjUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 45cb1f412379ed78682e98e3235f26198e5132539432beed18d1c8b03fabfebc |
| hovercard-subject-tag | issue:3825479235 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/Show-Me-the-Code/python/572/issue_layout |
| twitter:image | https://opengraph.githubassets.com/251f995ee5bb312dbd5bbe6f1be40c077deb7b1e3b66cdd87c5c0cf536e69a54/Show-Me-the-Code/python/issues/572 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/251f995ee5bb312dbd5bbe6f1be40c077deb7b1e3b66cdd87c5c0cf536e69a54/Show-Me-the-Code/python/issues/572 |
| og:image:alt | my code sucks and gives only 5-15 FPS max. I programing minecraft on ursina. pls help me here's the code: `from ursina import * from ursina.prefabs.first_person_controller import FirstPersonControl... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Geiwwjk122 |
| hostname | github.com |
| expected-hostname | github.com |
| None | b3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86 |
| turbo-cache-control | no-preview |
| go-import | github.com/Show-Me-the-Code/python git https://github.com/Show-Me-the-Code/python.git |
| octolytics-dimension-user_id | 9983575 |
| octolytics-dimension-user_login | Show-Me-the-Code |
| octolytics-dimension-repository_id | 27247448 |
| octolytics-dimension-repository_nwo | Show-Me-the-Code/python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27247448 |
| octolytics-dimension-repository_network_root_nwo | Show-Me-the-Code/python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 4a10310af51a1bfffbedc4fd81cb582acf0cb0ff |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width