The OFFICIAL programming thread
-
@hog said in The OFFICIAL programming thread:
Well this will do. I’m not Rockstar Games and I’m not making an AAA title. There’s still some occasional mesh tearing issues but I’ll wait until I have the actual higher-poly game assets before I try and fine-tune it further.
I like the:
“Nail Gumby’s Feet to the Floor”
version better!
-
I’ll stick this here if you’re interested in rewiring a microprocessor.
“The first chips to use copper interconnects, which were produced in 2000, had 1 kilometer of wiring per square centimeter. Today’s 14-nanometer-node processors contain more than 10 km of copper wiring in the same area, she said.”
-
@tazz said in The OFFICIAL programming thread:
I’ll stick this here if you’re interested in rewiring a microprocessor.
“The first chips to use copper interconnects, which were produced in 2000, had 1 kilometer of wiring per square centimeter. Today’s 14-nanometer-node processors contain more than 10 km of copper wiring in the same area, she said.”
Kind of related: something like 10% of all of the world’s energy consumption is used for computing and that fraction is growing all the time. Apparently half of that energy is consumed (actually wasted) by things like that copper wiring.
Source: Youtube: Photonics — a light on the computing horizon
-
Photonics is gonna be great.
-
Just had the most frustrating week of coding I’ve ever had getting the below procedural floor plan generation working. It sounds so simple but each room needs to have its own walls and I needed to get the doorways lined up between the different rooms. After I’d rewritten it literally 5 times and still couldn’t get it to work I remember thinking it’s just too difficult. Another couple of rewrites with different approaches got me there though.
It’s just a rough first cut. There are too many doorways etc etc. But it is satisfying seeing the enemies hit and slide down the walls with the rag doll physics I implemented earlier.
-
Kinda obvious what your scam is here. You have it create shitloads of rooms and then make players buy grenades through microtransactions.
-
@gators1 said in The OFFICIAL programming thread:
Kinda obvious what your scam is here. You have it create shitloads of rooms and then make players buy grenades through microtransactions.
Hmm, this is good stuff. Lemme get a pen and paper.
-
@hog said in The OFFICIAL programming thread:
Just had the most frustrating week of coding I’ve ever had getting the below procedural floor plan generation working. It sounds so simple but each room needs to have its own walls and I needed to get the doorways lined up between the different rooms. After I’d rewritten it literally 5 times and still couldn’t get it to work I remember thinking it’s just too difficult. Another couple of rewrites with different approaches got me there though.
It’s just a rough first cut. There are too many doorways etc etc. But it is satisfying seeing the enemies hit and slide down the walls with the rag doll physics I implemented earlier.
Spawncamper…
-
It’s time Hog gave eyesight to the victims.
-
I need to get a reproducible random value for a position in 2d space. If I knew x or y was bound by some number, then I could derive a unique seed for each location by using something like
x * max_y + y. Unfortunately, for my application, neither x nor y are bounded.So I thought, okay, I’ll use a 2d noise function, specifically OpenSimplex noise since that’s the one provided by Godot. From experience, I knew that OpenSimplex doesn’t produce cleanly distributed noise values - for example, I’ve never seen it produce a value greater than 0.88. So then I went looking for more information and found this blog that discusses it:
Their results show OpenSimplex noise producing a bell curve and give some code for correcting it at the bottom of the article. Unfortunately, maybe due to implementation differences, Godot doesn’t reproduce the same nice curve. Instead I pretty much always get something like the below (no matter what seed I used):

So now I’ve got to work out what equation produces a helmeted viking leaning over a tavern bar so I can correct for it.
-
Nah I think that’s actually Batman.
Hope that helps!
-
Hmm. I might need to rethink or abandon this. I’ve never used Matlab but I went through the code snippet in the blog line by line and looked up what the functions did in the online help. I’m doing the equivalent now in Godot which is doing linear interpolations on a curve but even with a million sample points in my curve I’m still getting these high points sticking at +/- 0.5 and zero is always low for every seed. (The +/- 1.0 end points are supposed to be low since they cover only half the range of the other columns).

-
Actually, nevermind, I fixed it. Godot curves have a “bake” feature where it samples the curve and caches some number of points (100 by default) and so it wasn’t using the full million. I’ve turned that off and am now getting away with a curve with only 16K points and it’s pretty even now (even enough anyway). I’ll experiment further with how much more I can reduce the number of points in the curve.

-
I feel like I’m asking for help with my homework here but, anyway, if anyone wants to venture an opinion it will be welcome:
I’ve got this code snippet in glsl that takes a vector of two values (e.g. an x and y coordinate pair) and returns a pseudo random number between 0.0 and 1.0.
float rand(vec2 co){ return fract(sin(dot(co, vec2(12.9898, 78.233))) * 43758.5453); }The problem is that I need to pull 4 random values for the same x, y coordinate. I was going to make the second and subsequent call pass back the previous result as both the x,y and values but then any x,y pair that shares the same first result will also have the same subsequent values. I’d like more randomness or differentiation.
Edit: actually having written it out, I’ve got an idea. For each additional value I need, I’ll multiply the original vector by the previous random value that’s produced and call it with that.
-
Shaders are a pain the arse to debug. Can’t set breakpoints; can’t print debugging values. You have to set a pixel to a color representing a value and and hope you can find it in the output. In any case this will do:
It’s just a background starfield that hopefully won’t be looked at too closely once there is content in the foreground. The four random values I needed were for:
- star color
- size
- random offset x and y values
Doing it in the shader means all of the processing is offloaded to the GPU. Doing it the way that I’ve done it means any given x and y position value will always recreate the exact same stars. If my math is right (and it probably isn’t) it should be able to scroll like that in any direction for billions of years before the pattern ever repeats.
-
So you are making star citizen and jerraye is making valheim?
-
@tigger said in The OFFICIAL programming thread:
So you are making star citizen and jerraye is making valheim?
Yep. But I’ll need 400 million in funding before I can continue. Can I interest you in an NFT spaceship?
-
@hog said in The OFFICIAL programming thread:
@tigger said in The OFFICIAL programming thread:
So you are making star citizen and jerraye is making valheim?
Yep. But I’ll need 400 million in funding before I can continue. Can I interest you in an NFT spaceship?
Oooh. Yes. I will be rich! Everyone with NFTs is rich!
-
@hog said in The OFFICIAL programming thread:
@tigger said in The OFFICIAL programming thread:
So you are making star citizen and jerraye is making valheim?
Yep. But I’ll need 400 million in funding before I can continue. Can I interest you in an NFT spaceship?
Please keep working on it. You already seem to be farther along than Chris Roberts.
-
@hog said in The OFFICIAL programming thread:
Shaders are a pain the arse to debug. Can’t set breakpoints; can’t print debugging values. You have to set a pixel to a color representing a value and and hope you can find it in the output. In any case this will do:
It’s just a background starfield that hopefully won’t be looked at too closely once there is content in the foreground. The four random values I needed were for:
- star color
- size
- random offset x and y values
Doing it in the shader means all of the processing is offloaded to the GPU. Doing it the way that I’ve done it means any given x and y position value will always recreate the exact same stars. If my math is right (and it probably isn’t) it should be able to scroll like that in any direction for billions of years before the pattern ever repeats.
I found a bug!
When I click on “QUIT” in the upper left-hand corner, nothing happens!
Graphene Could Buttress Next-Gen Computer Chip Wiring
