Monday, May 30, 2011

New Computer WOO

So I've got the new computer and it's awesome. Really, really awesome. Almost nothing lags any. You know how on most computers you'll click a menu or start a program and it will delay a couple seconds? None of that. Minecraft runs smoothly at full settings and only takes seconds to load up a world to where you can see as far as you'd like. The only bad thing is that I have to move all my awesome software from my old computer to this new one. Including Visual Studio and Resharper.

The computer comes with the full CS5 package. Photoshop, flash, other stuff. I've always wanted to learn flash but haven't because Flash CSx is absurdly expensive, like "four times the price of the computer" expensive. Just for a fairly inefficient language for moving 2D images around. But, a lot of people use it, and I'm considering becoming a flash developer on Kongregate. So updates here may be slow while I play around with tutorials in that, and get all my old software moved over. On the plus side, I may be releasing something relatively quick and simple on Kongregate.

Sunday, May 22, 2011

New Computer

Hey everyone, it turns out that my webclass stuff needs me to use Unreal Toolkit 3, which my computer doesn't run, because my video card doesn't support "Shader 3". My computer's starting to get old, so it's a good time to buy a new one - and I found a good deal on a custom-built gaming computer that the guy is selling to pay the bills. I've looked into the specs on it, and it is godly for only $500. Like, "play Crysis 2 on Very High graphics smoothly" godly.

I've been messing around with OpenGL more to see if I could squeeze some more power out of my system to draw blocks with. Well, when I get the new system, I won't have to worry so much. I can optimize and port to OpenGL later on. So, more descriptive updates on what's getting done when I get the new computer tomorrow and work with it.

Sunday, May 15, 2011

OpenGL D:

I worked with openGL some. While I can work with it, I can tell that development would be much slower due to having to fuss with it more than XNA. Which isn't to say that openGL is out of the question. In fact, my plan is to write the game that I am now thinking of calling Open World, in XNA. And once sufficiently far along, port it to openGL and hence allow other operating systems in on it, while possibly getting a gain in efficiency.

That was part of what I was doing. The other part was research. Which is to say, playing Minecraft and attempting to play Infiniminer (which didn't want to run right). I play Minecraft survival multiplayer. What I like about Minecraft is the dual nature of resource gathering and using the resources. If you spend your time doing stuff like mining, then you might as well build something huge with all the stone. If you go around killing cows and farming, you might as well explore caves or stay out at night. What I don't like is how in single player you get to the end of the development tree quickly - once you've made a rail system, there isn't much else worth doing. If you're going to spend your time on megaprojects, might as well do it on multiplayer so others can see. Also block lag - I've died to blocks I've placed disappearing out from under me, only for them to reappear. It's like the server says "Okay, you've placed a block. Oh wait, you might not have. Okay, now I've gotten confirmation that you have." Don't undo an action until you're sure, server.

Ahem yes, all research. I haven't been a total waste of the past two days, either. I worked on Open World more, found out openGL is hard but not impossible to work with, and then did something else. I redid the world to hold data on a near-infinite span of land, only limited by running out of integer indexes. The draw code for it hasn't quite caught up to speed though - I exploded blocks outward when it should have been drawing all chunks offset by the chunk position. I'll work with the math on that. When it works, it'll be screenshot-worthy.

If I can get that and some basic collision physics going without bogging down the system too hard, I may do the first release.

Tuesday, May 10, 2011

Threading. OpenGL?

I experimented with threading and am pleasantly surprised with the results. The only irritating bit was that the most obvious way of doing threads only takes methods with no parameters. It's a bit more esoteric to do a method parameters, but the end result is just one line extra. It let me place or dig blocks and keep on moving while the world recalculated everything.

I am becoming increasingly aware, though, that XNA may not be the best choice for this. I'm trying to render a million blocks, after all. The alternative is to work with DirectX directly, or to use OpenGL. If I stick with XNA, I can run things on the Xbox. If I go with DirectX, I'm stuck Windows-only. If I go with OpenGL, I can run cross-platform. So, I'm going to attempt to learn and use OpenGL.

If openGL is anything like SDL was with Adventurer, it'll be a nightmare to work with. But damn fast. So I'm going in expecting the worst. It really should be the most blindingly fast thing I can do, though, since openGL is made for drawing 3D primitives.

And if that's too much of a headache, I can go back to XNA. Infiniminer was made with XNA, after all.

Threading?

I'm in the process of changing up how chunks are stored so I can have a practically unlimited amount of them, and hence space in the world. Stuff like travelling between chunks, too, and figuring out an efficient way to do chunks that are far away.

But I'm also looking into the concept of threading. I hadn't looked into it before because I thought it was only useful for multicore systems. Apparently that was multithreading I was hearing about, where you run multiple threads simultaneously. Plain old threading is when you tell two different blocks of code to run together, taking turns with the processor. Of course, you can't have one rely on the other.

I think that will help resolve the temporary lag I was having, followed by long stretches of good processing speed. Spread the process out over time, while still allowing regular game play to go while the computer works. The only thing I'm going to have to work out is that vertex buffers ^are^ critical to drawing and hence the flow of the game, so I'll have to do something to smooth the border.

Anyway, I'll get threading worked out at some point so that I can improve practical efficiency. For now, I'm working on having a large world, and multiple textures.

Monday, May 9, 2011

First Person, Digging, Placing


Whew. I did a lot of work today. I fixed that bug I was having with the world disappearing - I had set it up to work with multiple vertex buffers, and to make a new one whenever it crossed a 65000 vertex border. I had neglected to tell it to also make a new one to put the leftovers in.

So, with that done, I was finally able to see pits being dug. The picking was a little bit misplaced, but I adjusted and got the ray lining up exactly where I wanted. That was awesome. I went ahead and added code for placing blocks, too, and that worked out. The only bad thing about the whole thing is that there's some lag when doing it, because it has to refresh all the vertex buffers. I'll be optimizing that, as well as making it to where I can do varied textures, so you'll have stuff like dirt on the sides and bottom of grassy blocks.

The other major thing I did is first person camera. It's no longer free flying. It also is controlled by the mouse rather than keys. What's the big deal about that? Well... First thing is that with control done by mouse rather than keys, it feels very intuitive. Just move the mouse around to move your view, just like other first person games. With it no longer free flying, it means you won't get your roll messed up and lose your sense of balance, and you're pretty solidly on the ground. Muuuch better.

Next thing I'm working on is preparing for multiple textures, and optimizing the speed of things. Multiple textures because duh, that's important for knowing what you're dealing with in a world of blocks. Optimization because there's a fair amount of initial load time with just 64x64x16 blocks, and yet more lag whenever you change the world due to all the recalculation. It's a little different than the whole turn based thing I'm used to.

But this is definitely starting to come along.

Progress on Picking

I've got picking by and large working. Except for one completely confusing bug. The top of the transparent block never stops rendering. I eventually figured out why.

I made an array of chunks of blocks, knowing that I would eventually be working with more than one at a time. So I made the code for everything loop through all chunks. The reason the top never stopped rendering is because I HAD OVERLAYED TEN CHUNKS IN THE SAME SPACE.

So I change it to only initialize a single chunk. Null error. I have it check for null. I start it up, and... nothing. Empty space everywhere. I reinitalize all chunks. The world is back. Hmm. I have been diagnosing the thing for quite a while. And here's where we get to the bizarre part.

Chunks 5-9 absolutely must be initialized for the world to render. One less and nothing renders. 0-4 are completely meaningless. I really have no idea why this is the case. I mean, I was working with chunk 5 as the main chunk - you know, numpad directions to keep things straight. Though the more I think about it, I only need one central chunk - the one the player is in. The ones outside of that can work on different logic, being out of the immediate vicinity of the player. Anyway, it's bizarre. It isn't that 5 is critical. It is that 5,6,7,8, and 9 are all critical. And any time I've tried to mess with that formula, the world blips out of existence.

Anyway, I'll work with that, and soon have block digging working properly.

Grand Opening of Kalasen Games Blog

To those of you new here, welcome. This is the blog of Kalasen, an individual game developer. More specifically, this is where I blog about the development of my games. Whether you're interested in the games or game development, there should be something that you might like to waste a little time with. I tend towards making open-ended games, because I like the idea of giving the player a neat tool and a world to use it on.

My first project is Adventurer. It's a roguelike game, where the long term development goal is to take a roguelike base and turn it into a very open-ended RPG with procedurally generated towns, quests, dungeons, and wilderness. I'm kinda putting it on hold while I work on my next thing, though if I get the whim I'll go back to working on it more. People seem pretty divided about which they want me to work on, so I'll just go with whichever the mood strikes. You can find out more at adventurerroguelike.blogspot.com.

The second project, which I'm actively working on, I don't have a set name for. For right now, I'm calling it Infiniworld in the project file. The inspiration for it is Minecraft and Infiniminer. If you don't know what those two are, check them out. More specifically, I'm interested in the concept of the world being made out of what are basically 3D tiles. That really lends itself to procedural content. So, with Infiniworld, I'm focusing on using a similar system, and taking it in a different direction than Minecraft's one man in an empty world approach. The world will have a life of its own, with towns and NPCs. I'll focus on the AI. I've always wanted to do a neural net form of AI learning. That seems like an ideal setup for it.

Infiniworld doesn't have a release yet, but it may soon. So you know where I'm at, I do in fact have an area of blocks generating and rendering just fine, and a free camera that can travel around them. I've got a "Picking" algorithm seeming to be working, which lets me select whatever is in front of the camera. The current hurdle is that when I try to remove a block, not all the faces that should be drawn are updating right. Usual development. Yes, that seems quite a bit like a Minecraft clone. Maybe it is. But Minecraft got it from Infiniminer first. And the concept of taking and placing these 3D tiles is simple, obvious, and wide open for fun things.

I'll be posting updates on development here. Hopefully with screenshots. I'll post something new as soon as I get digging and placing working correctly.