Collection of my recent ludum dare posts (in chronological order) – Oh yeah, I’m partaking in the ludum dare 33.

I’m definitely going to try my best to participate this year

After reviewing the rules I decided to challenge myself, I will be using a custom engine written from scratch (starting after this post), this is allowed in both the compo and the jam (source code will be provided regardless).
If that fails (which, realistically, it could) I’ll use SDL and box2D, even then my source code will be provided.

I’m not entirely certain what featureset it’ll support but it will be basic, I want to challenge myself by not having fancy features available.
Probably will have shader support though.

Anyway, I can’t be wasting time here! I have an engine to write.

CubeGod out!

as mentioned earlier I’m still in

And it looks like I’ll still be using a custom engine, aside from a 2 day struggle with emscripten just refusing to work and some… err, minor setbacks I’m still somehow on schedule

The rendering code I need has been written, I need to write some more complex shaders and some AABB bounding box intersection code for physics but other than that I’ve written almost the entire engine (well, I still have sound support but that’s optional 😛 I can always just rush in mp3 support for looping bgm and not use sound effects, that works I hope).

Now if emscripten would just accept my std::vectors that’d be lovely, of all the things that break one of the critical data structures has to be one of them. bloody hell.

And I wrote such nice shader compilation code too (ha! told you I’d use shaders) :/

Ah well, I filed a bug report, if it’s not an emscripten bug it sure as hell is a documentation bug, I read it cover to cover and nowhere did it say that vectors are defunct.
I suppose I should convert my logging function to use C style arrays instead of vectors, I can’t really test my code without the debug logging (and it would never be invoked during normal gameplay so that’s fine, the only way it would be invoked is if shader compilation or linking failed; something that won’t happen past release because I test my shaders :3)

Ah well so far so good, I really enjoy crunch time; so much gets done.

Fun fact: WebGL shaders are way different from GLSL shaders

I’m not entirely certain how I can pull data from the vertex shader into the fragment shader, after writing a quick test shader and butchering it until it worked I didn’t manage to pull vertex colors.

But that’s fine, that’s actually fine. This works too; I just have to be a bit more peculiar about it (I WAS going to pull vertex colors as a lazy way to color sprites because that would save a huge time), if I can’t get my engine to support that I’ll just work around it.

(webgl shaders are essentially GL ES 1.0 shaders and they don’t support in/out or inout)

Regardless, still in.
On the bright side, there’s no API I could possibly know better than that of my engine, I wrote it after all (in two days nonetheless!); it’s deceptively simple with only five four graphical functions.

Sprites.
Tiles.
Textures (global resources set up for use by sprites, tiles and shaders).
Shaders.

add simple bounding box intersection physics and a very crude SDL2 audio wrapper and you have yourself a deceptively simple engine with a potentially huge power:simplicity ration (because shaders, all the magic happens in the shader code… and it’s not that interesting, it’s really rather close to the reference implementation because the OpenGL documentation is very robust).

Also licensing. I have to figure out if the ludum dare supports the CC-BY-NC-SA license, because when I invariably release my source code I will release it as such, it’s for people to learn from, not earn from. 😉

Anywho, back to coding, if someone has a clue as to how one would solve my shader predicament that’d be lovely but in worst case I’ll just not use vertex colors, that’s fine too.
I need to finalize my interfaces, do a bit more unit testing and polish up my audio implementation.

And that about sums up what I’ve been up to recently, that and a ton of procrastinating prior to four days ago 🙂

HNNNG I AM GOING TO DIE FROM THIS FEATURE CREEP

Was my reaction when I conceived of and blocked in an economics simulator into my engine… I still can’t generate useful terrain but once I get around that hurdle and implement a city generator I’ll have a game with a sprawling dynamic economy as in real life where the AI and players can either make or break it (and fix it, no matter how severe a depression is ultimately temporary; mind the game could end up in a state of widespread famine where every NPC or the vast majority die from starvation, the player doesn’t need to eat except in hardcore mode because a lot of players, me included, find such things tedious and annoying).

Well, rather the blocked out system needs to be fleshed out, currently it’s just a bunch of void interfaces. I’ll determine the area of famine based on cities, with an area around that city. then I’ll poll trade-routes for that city to see if the city can get food, assuming the city is willing to help them if they can’t afford it or if they can somehow obtain it through other peaceful or non-peaceful means. if the city can’t it will attempt other solutions and eventually work it out or die out, thus leaving a ghost town that might then be inhabited by bandits, monsters, or other things. this can all be done on non-loaded cities, merely through how the simulation state machine works, when it’s not actively doing something useful it can simulate the state of cities further out.

Essentially this allows me to solve the issue of a player hanging around an area plagued by widespread famine and then walk into an area that’s sprawling with life just a couple chunks away, instead this system allows me to keep a vast array of important events that can be super-simulated as the player approaches and determine the state of the area long before it’s within player view. in short, a sophisticated economic and environmental simulation, and I still haven’t figured out how to simulate water yet… and somehow this simulation depends on water simulation as that influences famine and drought. Did I mention that I specialize in framework code and not necessarily interactive code?

This framework does of course still need to be called and actively running, currently it’s some empty classes, some semi-built classes and a bit of pseudo code to serve as a reminder, but the actual important details are already blocked out. I can imagine this game being a huge failure because people will invariably find it far too complex, especially when they end up crashing the economy 😛
But guess what?

I care not for the success of the game, nor how long it takes. I’m making a game I want to play.

The simulation is at a few levels, per region level (essentially country), city level, city block level (for things such as gang wars, police raids, fires etc), per building level, per individual level.
These levels base entirely on how far away the player is, any of these have some parameters stored and are super-simulated as the player gets within reasonable range. It’s all a beautifully intricate hack, as in it’s not a real simulation, it only appears to be at surface value but to be fair, it doesn’t need to be anything else. It needs to be interactive, seem like a living sprawling world, yet be able to run on modest systems.

For a true simulation you can only have two of those.
You can have a living sprawling world that runs on a modest system but good luck getting it interactive (if real simulation, that is) or you could have an interactive living and sprawling world but that shit won’t run on any consumer end system.
You could also have an interactive simulation that runs on modest systems but it’s not going to feature living, sprawling economies at a massive super-global scale.

Really though, the job of a video game designer is to craft an illusion that suspends disbelief, the model doesn’t have to accurately represent real life; it only has to seem like it actively represents real life. A beautifully intricate multi-layered illusion it is, but it is nonetheless an illusion. An illusion you cannot even see at this stage because the framework code isn’t done, the back-end isn’t done and the front-end is a bunch of disjointed voxels because simplex hurts my brain.

Essentially what I’m conveying is that I don’t understand prioritization, good software design (too much feature creep) or how to actually develop software in a way that doesn’t suck… except I do, I just apparently don’t consider such things while coding.
More importantly I just felt I had to ramble about something and this was the first thing at hand, it’s very likely that the paragraphs are entirely disjointed, I didn’t proof read it, only spell checked it and checked the grammar.
I err… suppose you enjoyed the read if you got this far, have a nice day or something; I’m going to do something else now.

Taking a break from simplex

so instead I worked on tweaking render performance, I wasn’t pushing acceptable framerates and the reason for why is of course that I was pushing almost 7,000 draw calls every frame.
Optimizing that down to 1 gave me these performance metrics:
10k tris (1 draw call) – 60 fps (vsync locked?) (before: 15 fps, 6,864 draw calls)
100k tris (10 draw calls) – 60 fps (before: sub 5 fps, 68,640 draw calls)
1M tris (100 draw calls)  – 60 fps (before: what a nice slideshow, could you perhaps move the frames a bit more often than onece a minute 686,400 draw calls)
5M tris (500 draw calls) – 60 FPS (before: never tried, closest was 3.14M tris @ pls kill me now FPS, 6,864,000 draw calls)

The drawback being that each chunk now takes 3.2 seconds to build instead of 50ms, this might not sound like an issue until you look at the fact that generating a 1km^3 (5,271,552 tris with the testing chunk spammed over and over) takes a bloody hour
oh well, you win some you lose some; at least this is in the realm of things I understand, things I can do math with, things I can plot on graphs, things I can optimize. (unlike simplex which just hurts my head and melts my brain)

another issue is that this slows down exponentially as chunks get larger, for 16^3 the time taken is 3.2 seconds.
for 32^3 it’s 5.34 minutes, orders of magnitude slower.
At least it also uses less memory as well.
I suppose you win some and you lose some, this took one huge weight off my shoulders and instead put another one on.

rant about simplex noise, incompetence and stuff.

2111111111111111221111111 … 1111122111111

FyItZUg

That’s the output of the simplex noise I’m using… what does this mean? How does it work? Don’t ask me, I’m just as baffled. My scene generates with three block types visible (at least, since I use stone as the fallback material for non-grass/air blocks), the blocks I see in my scene are:
id 1: air
id 2: grass
id 3+: stone.
How is this when the simplex only generates values of 1 and 2? I take a plain integer as block id, that should reasonably cause it to only generate grass and air, given that this only contains id 1 and 2.
simplex is weird.

What happens if I clamp it to 1-32?

1614121110910101091011 … 51413121214

The chunk generated however does not have any similarity to the screenshot at all, reasonably one would expect more than an empty shell, no?

8L0AwAP

this thing is hollow btw, in case you’re wondering.

How am I printing these numbers?
std::ofstream f;
f.open(“Chunk_plaintext.txt”, std::ios::out | std::ios::ate | std::ios::app);

are they floating point? sure, we could print them as float but my blocks have index values and I have no useful way to cast them to int that doesn’t have data loss, this would be an issue with 2D simplex as well though, given that you have to put a roundoff point somewhere to get a sample at every pixel and a pixel can’t have a floating point value,
what happens if we multiply the float by 100, divide that result by 2 and then cast to int?
I don’t know, let’s try.

2 1.83933 1.73532 1.66185 1.60199 1.56883 1.59679 1.64369 1.59767 1.53981 1.5873 1.64683 1.67224 1.74292 1.79105 1.80853 2.19107 2.05502 1.92196 1.82605 1.7717 1.72561 … 1.80914 1.76124 1.75255 1.84197

This is the raw noise, added some space padding code, still don’t see how this (when implicitly cast to int, which truncates it) would generate three different blocks when it would only truncate to 1’s and 2’s, that only covers 2 block id’s.
I am confused, I don’t understand why this black magic doesn’t work as expected and I don’t even know where to begin looking.
I’d wager I’m just incompetent, maybe I should just quit; given that I can’t even get simplex noise to work right.
</rant>

All examples truncated for brevity, I’d wager no one wants to read 2 lists of 4096 integers and one list of 4096 floating point values.

[insert witty title here]

Really more of a screenshot dump than a real post with a lot of text content.
nootextors
That’s some fine programmer art right there, I got the noise function working (this being a 32^3 chunk of the world just ripped out and displayed on its own, the triangle count is ludicrous because I haven’t implemented greedy meshing yet (because I haven’t implemented texture atlas loading or shader parsing yet, both of which are required to do greedy meshing and more importantly texturing said meshes)

interestingly the scaled octave noise is not significantly slower than raw noise (I expected it to be, but it was surprisingly insignificant compared to the rest of the chunk building), a potential optimization to that would be to generate the noise once per chunk and then just sample it once per block instead of generating samples on the fly per block, although it would spike memory usage and only slightly improve speed since this process is really rather prone to be optimized by the compiler and branch prediction would work very well on it since the algorithm runs thousands of times per chunk.

Anywho, there was something else I wanted to ramble about but I’ve since forgotten what that was merely through the process of writing this post so I’ll just dump this here, apologize for the lack of incoherency and then go to sleep.

… on that matter, I don’t know how featured images work… will it insert the image twice into the post since I already attached it? will it only show on the front page? I don’t know, but I will soon enough (by the time you’re reading this I’ll already know… so this paragraph is rather pointless), either way I won’t bother editing it if the results aren’t as expected.

EDIT: it did what I expected, well you’ll just have to deal with the same image showing up twice.

Chi-Coder: Free-To-Play and Microtransactions Part 1: My Thoughts.

What a rather delightful post, I should share it to my pretty much nonexistent readerbase.
maybe next week I’ll write another post to my empty blog with a more or less entirely devoid userbase, until then this’ll do.

The Chi-Scroller

I know this isn’t completely fair but I really like the idea of pointing the finger directly at Apple when it comes to the rise of the free-to-play model and microtransactions in general.  Without the iOS app-store I feel that the gaming landscape might be a vastly different one.  Of course you might also be able to point the finger at the guy who originally authored the Defense of the Ancients mod for Warcraft 3.  I won’t hold you in suspense over my feelings on the matter; I’m not a huge fan of either free-to-play, or microtransactions in general.  That’s not to say I don’t play any free-to-play games, or that I’ve never made a microtransaction purchase, but that doesn’t mean that I have to wave my hands in support of either model.  Before we go any further I’d like to be clear that microtransactions and the free-to-play model, while…

View original post 1,843 more words

Chocolate is the new gravel

As usual I don’t really have anything to write about so therefore I should write random inchoerent things instead, but I don’t really have anything incoherent to write either so I’ll instead just post a code snippet from my project.

chunk::chunk(int p)
{
cPosition = p;
//I don’t remember why I’m multiplying by 5 but it works so I’m not touching it.
poteto = core::vector3df( fieldIndexX.at(cPosition)*5, fieldIndexY.at(cPosition)*5, fieldIndexZ.at(cPosition)*5 );
t1 = steady_clock::now();
b_blocks = new block**[CHUNKSIZE];
for(int8_t i = 0; i < CHUNKSIZE; i++)
{
b_blocks[i] = new block*[CHUNKSIZE];
for(int8_t j = 0; j < CHUNKSIZE; j++)
{
b_blocks[i][j] = new block[CHUNKSIZE];
}
}
BlockType BT_T = BT_NULL;
int tst;
for(int x = 1; x < CHUNKSIZE-1; x++)
{
for(int y = 1; y < CHUNKSIZE-1; y++)
{
for(int z = 1; z < CHUNKSIZE-1; z++) { //loBound, hiBound, algo (0-3), octaves, persistence, x, y, z, scale b_blocks[x][y][z].setBlock(tGen->chunkGen(0.0f, 2.0f, 2, 6.0f, 10.0f, x, y, z, 1.0f));
// 0.0f, 2.0f, 2, 6.0f, 10.0f, x, y, z, 1.0f yields very weird straight pillars of solid matter with large airgaps.
}
}
}
createMesh(p);
t2 = steady_clock::now();
time_span = duration_cast<duration>(t2 – t1)*1000;
std::cout << “Time: ” << time_span.count() << “ms” << std::endl;
}

Whoever can tell me what that code does get’s a free letter ‘a’, mind I already know so no cheating 😉
oooh and that’s actually pretty incoherent and somewhat unprovoked so mission success?

Anyway, back to figuring out how to modulate simplex into something useful, infinite vertical columns is rather useless.
perhaps I should be using scaled octave noise instead of scaled raw noise… or maybe just octave noise? Anywho, here’s a screenshot.
bars

What is the meaning of tater tots, curtains and a chocolate rainbow?

If you didn’t figure it out by now my posts aren’t coherent, proofread or sensical in any way, shape or form (see the title). That doesn’t really matter as this is merely a sorting tool for my disorganized mind (if it can even be called that).

As per protocols here’s another post (in haiku form because why not):

I have naught to write
Except maybe about C++’s SDL.
Oh the pain, my brain!

On another note…
Of all minecraft structures
The best is a road.

I have lost my mind.
Implying I once had one
But that was a lie.

Posting in haiku
It is rather impromptu.
Also pretty hard.

This makes me weary
Why then do I continue?
Beats me, tee hee hee.

</sarcasm>
That’s really an awful lot of haiku writing (something I haven’t done since fifth grade, mind), the joke got rather boring after a while.
The last one might even be abysmal, who the hell rhymes “Beats me” with “tee hee hee”? (someone who needs to figure out a way to get the last line to 5 syllables while keeping the general theme of the specific haiku, that’s who).

I don’t even know what I should write about anyway, I could rant about why I don’t like SDL but that’s most likely not of interest to anyone and even if it was I don’t really care.
iterators don’t behave.
vectors also misbehave.
Or maybe I’m just an incompetent programmer, either way I’m fed up for today and I should just go to bed instead of writing a blog post at 3:43 am.

Ciao.

Right… Posting

Because that’s a thing… that I’ve not done which I should have done but I forgot.

Anyway, what was it I wanted to write again? No idea, I’ll just write whatever my fingers decide to write because I forgot to charge my brain o-o

So I’ve been studying Japanese a bit and animating and programming and doing woodworking and playing kerbal space program and where did time go I can’t even.
Right, Japanese. That’s what I was going to write about (I knew I’d figure it out if I wrote whatever came to mind for long enough).
So I’ve been studying Japanese a bit and I should make it a daily habit to post what I learn here but I forget so oh well.
How does one make music anyway (err… that’s not the topic I was writing about but I can’t even remember exactly what I wanted to say so oh well)? I don’t really know how but I’ll eventually have to figure that out because I have no budget and as such I can’t pay for someone to make music for me, instead I should just focus on programming and art.
Once I have those down I might be able to convince someone to make music for me, if not I’ll just release without music :/

Ooooh and KSP is fun, I launched so many stupid things into space…. most of them came back down and exploded but some things actually went into orbit which is super neat, on another note I really should write a 3D model importer for my voxel engine because I need that, ah well it’s low priority.

What else?
Right, isn’t it funny that whenever you write some complex logic it turns out working flawlessly, just as intended, but when you write stupid simple logic (in this case a simple allocator loop) it ends up having an off by one error or other bug that shouldn’t be but is there anyway… yeah, I don’t know why but it annoys me.
Oh well, I hope my client gets back on soon so I can rig his bloody model, I neeeeeeeeeeeed to earn all the money.

I already don’t even remember what I was here for but oh well, it says this is about the incoherent ramblings of an eccentric madman right at the top so I don’t see an issue with it, it’s really quite exactly what it says right on the tin.
Now… I should probably at least proofread this but I can’t even be bothered, I should find food or maybe I should go play the guitar?
нет! I should learn to draw or make a dragon or maybe just study more… I’ll just study more, I’m not going to learn Japanese by drawing.

じゃあね!

[sticky] I should write something…

Oh right, I’ll just make a sticky post for the top page to welcome people to my humble abode!
There. With that out of the way I can get to rambling about random things (hence the title), I actually rather enjoy fish. I mean it’s not as good as broccoli or minecraft but it’s neat.