今日已更新 412 条资讯 | 累计 19972 条内容
关于我们

标签:#gdscript

找到 1 篇相关文章

AI 资讯

I built a game with zero asset files - everything is generated in code

Building a Game with Zero Assets in Godot This is the first game I've ever made. I'm not a developer by trade, I'd never touched Godot before, and I leaned on AI to help me get over the learning curve. But I gave myself one hard rule that ended up shaping the entire project: Zero external assets. No textures. No sprite sheets. No audio files. No music files. The whole repository contains none of them. Everything you see and hear in Reactor Panic - a small arcade game where you sort plasma cores before the reactor melts down - is generated at runtime in code. Here's how I did it, including the parts that went badly wrong. Why do this to myself? Two reasons. First, I can't draw or compose, so "make it all procedural" was weirdly easier than sourcing, creating, and licensing art assets. Second, and this is the part I didn't expect, when everything is code, everything can react to the game state for free. More on that later. Drawing the Reactor All of the 2D art is rendered using Godot's _draw() function. The most involved piece is the containment dome. It isn't a sprite at all - it's shaded per cell like a tiny software renderer. For each cell, I compute a hemisphere surface normal, perform Lambertian diffuse lighting with a specular hotspot, add Fresnel-style rim darkening, and then quantise the result into a handful of discrete steel bands so it reads as pixel art rather than a smooth gradient. # Hemisphere surface normal var sx : = ( mid_x - center_x ) * inv_half_w var sz : = sqrt ( maxf ( 0.0 , 1.0 - sx * sx - sy_sq )) var norm : = Vector3 ( - sx , sy , sz ) . normalized () # Lambertian diffuse var ndotl : = maxf ( 0.0 , norm . dot ( light3 )) var light_val : = 0.1 + ndotl * 0.9 # Fresnel rim darkening (surface curving away from viewer goes dark) light_val *= lerpf ( 0.4 , 1.0 , clampf ( sz * 1.8 , 0.0 , 1.0 )) # Quantise into discrete shade bands -> reads as pixel art var band : = clampi ( int ( round ( light_val * max_band_f )), 0 , num_bands - 1 ) var col : Colo

2026-06-16 原文 →