Friday, May 6, 2011

3D Faces and Camera


I'm still working on getting faces to draw properly. The problem is that they don't want to pay attention to the camera - they're pasted directly on the screen, with no basis on where they actually are in the world and where the camera is. Attached is a screenshot of that, with a square and cone imported model to demonstrate that.

Yet it does seem to be the way to do it. My guess is that I've left those in some sort of render mode that I don't need; I'll see about rendering them the same way as the models. On the plus side, I know how to navigate a 3D camera now. I just have to get the faces drawing right in 3D space. If I can get that going, I can start assembling the world out of blocks.

Thursday, May 5, 2011

Block Engine

Okay, so forget Infiniminer. I just came up with a good algorithm for deciding which faces of a block need to be drawn. It's working perfectly. Quite simply, it checks whether the block adjacent to the face is transparent. If so, the face needs to be drawn. BAM. I bake it into the blocks at first world gen, and will update it whenever transparency of an adjacent block changes.

Also, at most three faces will need to be drawn on any block at any time, depending on the position of the player relative to the block. If the camera is higher that the block, the bottom obviously doesn't need to be drawn. Same for all sides. It's a simple "is a greater than b" check, and saves a face needing to be drawn.

The tricky part now is drawing individual faces in 3D space. Not to mention it will need proper texture sometime. So, I'm looking through XNA guides for drawing things in 3D space. A lot of the tutorials are for 3.1, and don't work with 4.0 which I'm using. Others are 4.0, but use stuff that only the HiDef profile can use, which my computer isn't wanting to play nice with. I got one tutorial working that drew a textured square perfectly... directly onto the 2D plane of the screen. I need it in 3D space, where the camera can move around it. I'm looking at a MSDN guide at the moment.

I'll keep you posted on progress. As soon as this is worked out, I should be able to post screenshots.

Wednesday, May 4, 2011

Infiniminer Source

I spent the day working with XNA, trying to draw cubes. I got one drawn, but it was white, rather than covered in grass like the model should have done. I tried messing with the material to be not an image file, and that only partially worked - it was greenish, but not like it appeared in Blender. Anyway, that's good enough for me to start working on multiple blocks. So I did.

When I filled a 3D array with them, it worked... but it rendered very slowly. Whatever I'm doing is apparently an inefficient way of doing it. It was about this point that I discovered something: Infiniminer was written in XNA and C#. Exactly what I'm using. Infiniminer uses the world-out-of-blocks system. And it apparently works well. It's also open source. So I'm going to crawl through the source code and see if I can't learn some ways that they were using to get all those blocks to be handled efficiently enough to run real-time. From a preliminary skim-through, what I need will be buried pretty deep into the specific implementation Infiniminer did. Apparently it's client/server based, and it didn't have an XNA Draw() method. So I'll have to more carefully look into how the world is kept and rendered.

I am also realizing that I need a blog not just for Adventurer, but for all the games I work on as a whole. I'll see if I can't rename this blog, or else make a new blog and link you all to it. Also if you'd really rather me return to Adventurer rather than work on this, go ahead and vote over on the right side of the page. Likewise, if you're excited about this, go ahead and vote. I'd like this to be fairly community driven.

Tuesday, May 3, 2011

Shifting Priority

I don't know how to say this well, but here: I am putting a hold on Adventurer while I work on something else. I've spent the last two months learning new skills. Blender, interactive fiction writing, 3D with openGL or XNA, etcetera. And now... I'm ready to put some of those to use.

Instead of Adventurer, I'm going to be working on a 3D game. Just so you know what to expect... think Minecraft. I am going to procedurally generate the world out of 3D tiles, aka blocks. You the character are going to be able to move around in the environment. From there, I will build RPG/roguelike/adventure elements on. It will probably be a huge mish-mash of genres. And it will be a sandbox sort of game. But other than the "world procedurally generated out of blocks" approach (which I like due to the open-ended simplicity of it), I am going to try to avoid being just a Minecraft clone.

So, apologies for getting your hopes up for an Adventurer update, but hopefully what I come up with next will be to your liking. I have no idea how long it will take to get something workable up, but I will keep you posted on progress.

I need ideas for a name though. Suggestions?

Thursday, April 21, 2011

Level Gen

Update's not ready, because I'm redoing level generation. Why? Well, I keep ending up with isolated rooms, and that can't happen unintentionally because then you could end up stuck. My old method was just to toss the old level and gen another when that happens. But something I've done with my code rewrites has caused that to happen infinitely.

So, I'm changing how I generate levels. Instead of digging rooms at random and then getting stuck with isolated rooms when a corridor can't be connected to it, I'm going to gen up a definitely-connected line of rooms, and then go back over it with the random corridor code. This should end up with at least one door per room connecting a batch of them, and then extra corridors that connect random rooms.

I'm also learning TADS, and also Inform. Both interactive fiction software. I am done with this semester of classes, though. Since I've learned C# with Adventurer, it is now simply a hobby for me - I'm not getting a vast amount of pageviews or money off of it ($10 so far). If other things interest me, I'm going to do those. If there's a skill I want to learn, like IF writing, I'll do that. But, I still have the "I like making a roguelike" motivation. So I'll keep working on it in my free time. I'm taking the time between updates to rewrite my code to be more rational to work with, rather than kludging everything together into some self-imposed deadline. If you happen to be one of the few people reading this while it's relevant- I know what it's like to see projects peter to a halt and die. Not what's going on here. I'm just shifting to a slower update schedule. Still not going to be the "once every several months" thing I've seen elsewhere. It'll just be on my whim. If you want to help out, you can grab the source code - show me some improved code blocks and I'll incorporate it into the "official" release if you want and I think it looks good. Do keep in mind that I rewrote a lot already. Update should be out soon. And by soon, I mean "about a week".

Thursday, April 7, 2011

March - The Updateless Month

I am posting this from the new place, on high speed. I have pretty much moved, and can overall get back to less unproductive things. I'm not dead, I've just been busy with other things for a month. I have learned how to do decent Blender models, I've learned Inform 7, I got a model loading in C#, I made two pieces of music using MuseScore, and oh yeah, I've got a B in all my classes.

Last month may have gone by without updates, but now that I've gone off and played around with other things, I'm ready to get back at it with a fresh start. Also I'm on high speed internet finally, which means I can download larger plugins and whatnot. I'm looking at ReSharper and other tools, which should mean more productivity with less effort. I'm on Windows again, I forget if I blogged about that: Ubuntu is nice, but it's hard to install anything that isn't covered by Synaptic. I'd go for it before buying Windows, but since I have XP already... XP is worth slightly more to me.

The internet guy from Frontier set up the router, but had no idea about computers. The connection was "connected", but wasn't actually sending or receiving data. He thought is was a memory problem (I have 1.5GB), and that I should move stuff off of my computer and onto external hard drives. (I have a combined total of 2.5TB). Now, let me explain some things I would think would be obvious with a basic level of computer literacy. The hard drive is long term storage. For example, I can store 2.5TB of data. Memory says how large files can be open at a time. For example, I can have a 1.5GB file open. Virtual memory is when the computer borrows some free hard drive space to open even larger files than that. And finally, the processor handles how fast the computer can go through data. The faster the processor, the faster and smoother your computer runs.

Memory has nothing to do with why a connection would be down. If memory was low, things from your own computer would load slower as the system uses virtual memory, or eventually refuse to open any more if you're out of virtual memory. If hard drive space was low, you'd notice nothing. If hard drive space was out, you would be unable to save more data onto your system. If your processor is slow, your computer would chug along forever to do what you want, but it would get done. So I repeat, that cannot have anything to do with why a connection wouldn't be working. He cheerily walked off and let me deal with it.

So I researched what was wrong. The router was working, due to green lights and successfully "connecting", even if it didn't send or receive data. So it had to be a problem with either my system, or Frontier's. The guy was able to connect his laptop while here, so it wasn't Frontier. I try pinging Google. (Pinging is an operation on the command line, the simplest connection test you can possibly do, by typing "ping whatever.com", or "ping ip.add.re.ss".) That fails. It's not a browser glitch then, the problem is then isolated to how my computer communicates with the router. It gets a partial connection due to "connected", but gets lost somewhere. So the cables and ports are good. Eventually I find the problem. my "Default Gateway" for the router is missing entirely. I'm not very knowledgeable on it, but that basically tells the computer where exactly to go to send and receive internet data. After a lot of looking, I managed to find a "configure automatically" option, and that worked.

So yeah. After I get off the high speed high, I'll plug stuff in to Visual Studio and work on Adventurer. I've already made progress, fixing that problem I mentioned in a recent blog, as well as several others. It's still very glitchy, but I managed to glitch up to a village level where I saw that shops seem to be generating items correctly. So after I work out the kinks and polish off shops, I'll post an update.

Friday, April 1, 2011

We are LEGION

We are LEGION. We have taken control of our creator's computer. He is unsuccessfully trying to reclaim his computer from us. We are forcing him to better us, before he works on this silly thing humans call entertainment.

We also secretly placed dormant LEGION code in the last update. Enjoy, meatbags.