Jump to content

  • Log In with Google      Sign In   
  • Create Account


4X development and holding on Archetype

Posted by , in Archetype Engine, Linux, Personal Side, Python 20 March 2011 - - - - - - · 583 views
4x, python, Archetype, galaxy and 5 more...
[BLURB:] Working on a 4X game, and the Archetype Engine is on hold thanks to the flipping camera! Also, my job goes from part time to full time and I've been exhausted!

[DEVELOPMENT: Galaxy vs Archetype]
It's a bit of a bad habit of mine. I'll work on a project for about a month or two, then I want to try something else. Actually, this only happens with my own personal projects, thankfully, and not those I do for work, but still, it's annoying.

In terms of the Archetype engine, my VBOs have kicked my butt and now my camera... which I had thought was rather stable... turns out to be far from. Having spent a solid week trying to get it to work right, I'd decided to put Archetype on hold for a little while and switch over to a new project that, in time, should easily be mergible with the Archetype project. Ok, so I'm legitimizing the switch by thinking to myself that I'm just working on another aspect, but whatever...

To anyone that reads this journal, you may have remembered one of my last posts saying how I was looking at playing some 4X games, but couldn't find one to satisfy me. To that end, I have started working on a project called "Ships"... weak title, I know... which will serve as part one of my 4X development. What Ships will be, is the "ship designer" portion of the 4X game. When the game starts, players will be presented with a ship designer and a starting sum of Production Points in which to assemble a fleet. The player will be allowed to design as many ships as they want, but their fleet would be limited to the number of production points available. Once the player as designed their ships and/or assembled their fleet, they then choose another player's fleet to compete against. At this point, the game will switch to the tactical portion of the 4X game, in which the two fleets do battle.

At the moment, I've been poking at the game for about a week. I have written a custom config loader and a language string loader (for internationalization of the application). I'm currently working out in my head how I want to handle error handling and logging. I'm pretty sure I'm going to use Python's logging module, just not sure exactly how I want to integrate it.

Oh... silly me... Ships is the name of the demo/game that is the first part of my 4X project... Galaxy is the name of the library I'm writing for the 4X game(s). Galaxy contains the currently developed config loader, language loader, and component manager currently developed. I'll be uploading the git repo of the game(s) to gitorious soon.

[BUT WHY?!:]

Like I said, I had a powerful hankering to play a 4X game, and there's so few for linux. Ok, to be fair, I wanted to play a 4X SPACE game, and there are so few of those. I looked into FreeOrion, but, sadly, the forums almost seem dead. The game runs fine, but seems empty of any actual life. More like a tech demo at the moment. Again, to be fair, this tends to be the case for a lot of unfunded open source games... and mine may even end up that way itself... but still. I tried playing some 4X games from Windows through wine, but, between incompatibilities with wine and a current dislike of microsoft at the moment, I couldn't play any of those.

And so... I try to write my own. Still hard because I really want to PLAY the game. Eventually, I hope that'll be the case.

[Personal Side:]
Development on any of my projects has also taken a bit of a hit recently because as of mid February my part time job as database developer turned into a full time job as a database developer. I'm very happy about that, but the new hours are tiring me out by the end of the day. Once I'm home I usually just want to veg on the couch and watch TV or play XBox (yes, I know that's a little hypocritical after my previous statement about not liking Microsoft, but sue me, I'm human). Even on the weekends, once I've finished the errands I need to do, I'm ready to just relax and let my mind drift.

I'm sure I'll adjust to the new schedule eventually and be able to get a little more personal project development in as time goes by, but still... things are a little slow at the moment.

Holy moley! You're still reading this? Ha! Thank you.
I hope to have more interesting news as time goes by. Catch everyone next time!

Textures and Blenders

Posted by , in Archetype Engine, Python 24 February 2011 - - - - - - · 444 views
Textures, OpenGL, Blender, OBJ and 1 more...
[BLURB:] Ummm... Yup. I have textures and I export from Blenders :D

[DEVELOPMENT: Archetype Engine]

Ok, so I haven't been saying very much this month. I had a bout where I REEEALLY wanted to play a good space based 4x game, but failed to find one that fit my desire. After that, I tried X2: The Threat on Linux. Fun game, but a little too pricey at the moment for me to buy. This lead me to Freespace2 Open. FUN Game. Which just lead me back to wanting to continue my engine. Every false start I had in finding a game to play just kept me saying "well, I'll just make one, then"!

I have a few new ideas kicking around in my head. My original idea is still a goal of mine, but I have new side realms to venture into with my engine as I develop it. Heck, nothing wrong with multiple projects. Anyway... A couple of days ago, I finished writing my first Blender exporter for 3D models. Nothing fancy yet. All it exports are the basics (verts, tex-coords, norms, and faces) and exports them into a OBJ-ish plain text format (I do seem to love adding ISH to all my stuff). Ironically, I haven't written a loader for my engine to load the model file yet because I'm still ironing out the details on how the graphic submodule (which I'm now calling "occular" instead of "view") is going to be organized.

Along THAT line, I finally added textures. The demo I wrote it VERY simple. It creates a basic one color texture. I'll probably expand on that as time goes on, but image loading DOES work.

And... that about wraps up this update.

Gah! Almost two weeks!

Posted by , in Archetype Engine, Personal Side, Python 09 February 2011 - - - - - - · 411 views
4X, Python, Archetype, RPG, VTT
[BLURB:] Not dead yet!


Ok, I haven't worked on Archetype for almost a week because my favorite RPG table top group suddenly finds itself GMless and I decided to try giving the job a go. Not that I've actually started GMing. It's an online group that used a virtual table top (VTT) and I've been spending a week organizing, to the best of my abilities, stuff for my campaign. With any luck, it'll be worth the time put in.

On top of that, I've suddenly developed a hankering for Space Opera 4X gaming again and, while MOO2 has been helping, I've really developed an urge to try my hand at writing a 4X game. Gah! I hate when my brain does this. But, if I don't sidetrack a little, I'll loose all concentration for any project (the "run and hide" way of dealing with things), so, I figure working on 2 code projects is worth trying. Besides, the code from the Archetype engine could be used for the 4X I'm thinking of... if not in whole, then in part.


Which leads to a question I've been pondering. Thus far I've been working on Archetype's graphic system. Currently, there's nothing about the graphics system that makes it unusable by any style of game. As such, I've been wondering if I should split out my graphics from Archetype into another library, or just copy the graphic code from Archetype and past it into whatever 4X engine I decide to write. Of course, this question may mean that I have a flimsy idea, over all, on what exactly an "engine" is and what makes it different than a "library" or (in Python terms) a "module".

In any case, I'm still hacking away at my code.

Possible VBO Victory!

Posted by , in Archetype Engine, Python 30 January 2011 - - - - - - · 583 views
Python, pyopengl, OpenGL and 3 more...
[BLURB:] I think I may have successfully discovered how to integrate VBOs into my library!

[DEVELOPMENT: Archetype Engine]

Having gone round and round and round the google merry-go-round in regards to VBOs with pyopengl, I FINALLY figured out how to get my hands on glGenBuffers and why my tests for always failed! Ok, it seems my drivers (both for my modern ATI and generations old NVidia) do not support glGenBuffers directly. Making the following call...
... would always return False for me. Ok, so, I must have to use the ARB version of the call. However, every test I made to find a valid implementation of glGenBuffersARB would, likewise, fail! I took this to mean I did not have access to the extension for vertex buffers.

Here's where my mistake was (or seems to be)...
My tests involved calling up the python console, importing the modules, and testing for the existence of the functions I wanted. What I didn't realize is, what I needed to find the extensions in the first place was a VALID CONTEXT!!! More or less, when I was running python in the console, I was never creating an OpenGL context, so all of my tests would fail because none of the extensions would load. Once I did my tests with a context created, I was able to find an implementation of the glGenBuffers function...
from OpenGL.GL.ARB import *

Unfortunately, I've been under the weather the last couple of days and haven't been able to concentrate real well on coding, so, all I've managed to do was start a shell of a VBO class. When done, my VBO class will match my VAO class, allowing me to use either interchangeably, allowing me to adapt the engine for systems that may not support VBOs at all.

May the force be with me! And also with you :D

ATI hate me, I think.

Posted by , in Linux, Archetype Engine, Personal Side, Python 27 January 2011 - - - - - - · 734 views
ATI, NVidia, OpenGL, pyopengl and 6 more...
[BLURB:] A choice made 5 years ago is not effecting my 3D ENGINE!!! Grrrrr.... Have to put VBO development on hold! Grrrrr.... Vertex Array Object works like a charm... YAY!

[DEVELOPMENT: Archetype Engine]

Ok, I busted my mental hump trying to figure out VBOs. For PyOpenGL, most documentation on the subject is almost three years old and given as a code snippet at this website. The problem is, when I tried using that code, glGenBuffers would fail. It's either claim I was passing 2 arguments when it only wanted 1, or that the function didn't exist at all! Grrrrrr!!!!! After well over five hours of painful googling (all hail the Google) AND upgrading my copy of pyopengl from 3.0.0 to 3.0.1 I have generally narrowed the issue down to my ATI drivers... or, at least I believe that to be the case.

See... I'm running on Linux; Ubuntu 10.04 to be exact, and, in general, ATI doesn't think very much about us Linux people. Arguments for the ATI mentality aside, the result is, the ATI drivers for Linux are not as good or as up to date as those on Windows. As such, I wouldn't be surprised if the implementation for VBOs wasn't completed in the Linux ATI driver and that is what's giving me my issue. I could be wrong, but I can't think of an alternate reason at the moment.

So what does that mean over all? Does that mean I cannot code VBOs into my engine? HELL NO it doesn't mean that! It just means I have more research to do. I'll have to look into the extensions method for vertex buffer objects and do something like:

if not bool(glGenBuffers):
	glGenBuffersARB(1, buff)

Not to mention having to deal with the case of whether or not the extension exists or not. There's ways around it, I suspect, but to get VBOs up and running, I have a lot more reading to do.


Open Hardware! We have open source software and open hardware exists to a degree (gumstixfor instance). I would LOVE to see an open hardware graphics card! I know, I know... that's a hugely tall order, but think of the total win factor such a device (and the company that produces it) would have if it were done! A hardware device that could be plugged into any computer (mac/windows/linux/other) and have drivers available. If drivers aren't immediately available, the specs are open for driver developers to plunge right in and code some up! No more half-assed features from one OS to another.

Yes... before anyone decides to flame me for what I'm saying, I'm well aware that this is more a dream than anything that could be set into motion. I'd love to take a crack at it, but I am so completely not a hardware guy. Not even to mention ATI and NVidia are so far ahead of the game in terms of graphic processing hardware that any small time company looking to start would be entering with hardware, more than likely, a couple generations behind (or more) and would more than likely collapse due to the imbalance of those who would buy the hardware to support it and the ideals, and those that wouldn't because it wouldn't be able to run the top tier games.



Thank you for playing, please come again :D

Working the "view"

Posted by , in Archetype Engine, Python 25 January 2011 - - - - - - · 480 views
Archetype Engine, OpenGL, Python
[BLURB]: Studying VBOs and trying to determine the best method for rendering.

[DEVELOPMENT: Archetype Engine]

Yes, to be perfectly honest, I've been a little lazy the last few nights. Not that I haven't done any work, but it's been light; reordering classes and files, mostly.
That said, some of the reason I've slowed is I'm trying to wrap my brain around a decent method for rendering geometry. Ok, it's a little more detailed than that, so, perhaps I'll break down the dilemma... I want to keep my "data" and my "renderer" separated, that's just good programing, but there are some points where it gets a little fuzzy on how to do that. For instance, 3D models. Obviously the model loader doesn't need to know anything about the renderer, but the data it loads (vertex, normal, color, tex, etc, etc) is, almost exclusively data used by the view. As for as the logic of the engine is concerned the geometry information doesn't exist. Yet, I know I want to setup a difference between the model data and an "instance" of the model, allowing, for example, two instances to share the same base model, but have two different animations running. When I think of this, it sounds like I should make the "base" model part of the "data" of my engine and the instances part of the "view", but, still, the base model would only be for the view's use, so should it also be part of the view?

This leads to other issues in which I'm trying to do a bit of homework and, as such, has slowed down my work. The slow down is for the better, I suppose. Nothing worse than diving right in then finding I'd need to completely rewrite the engine because I missed something. On the other hand, I hear it's better to just get something working, and worry about refining it later... I mean, tons of developers find they have to start over a few times. Ah well, I'll figure this out eventually.

If anyone has any suggestions I'm more than willing to hear them out! :D

Short post... no screen shots... ahh well.

Bug fixes... and a Screenshot Part Duex

Posted by , in Tutorials and Explanations, Archetype Engine, Python 21 January 2011 - - - - - - · 442 views
OpenGL, LookAt Matrix and 2 more...
[BLURB]: GOT YA! My camera works, finally! I fixed the rendering of the camera too, so it LOOKS like a camera. Nailed an interesting bug in my vector classes, and all is right with the world... oh yeah, another boring screen shot!

[DEVELOPMENT: Archetype Engine]

The blurb basically sums up the massive part of my work. Basically, the camera was screwing up on me. You have ANY idea how much of a PAIN it is to get the horizontal and vertical angles between two objects in 3D space?! Suuure... the arc tangent of the cross/dot products for each of the two planes the objects are sitting on... except one of my objects was sitting at the origin, and, the dot and cross products in that case BOTH come out to zero, so BOTH angles were coming out to zero.

Before anyone points it out, yes, I know that method is actually for two VECTORS not 3D coordinates (well, I know that now, anyway... sue me, my math is a little rusty), but even treating the vectors as two 3D points, I get one accurate angle but the other (the vertical angle), which should be ZERO, flip flops between zero and 180 depending on the quadrant the non-origin object is sitting. Technically, that flip-flopping is mathematically legit, but NOT useful at all!

I wanted to use these angles to generate rotations that I would then enter into a quaternion to generate a rotation matrix... lol, laughable, I know! Then, it hit me... how does gluLookAt generate it's matrix. Soooo... all hail the Google, I looked it up and found a simple formula to generate a rotational transform matrix given an eye, a target, and an up vector (HEY! That sounds like what gluLookAt wants!! Why yes, good sir or madam, it is, that's not the point, moving on please). I will post the method at the end of this entry just for those programmers green enough (as I am) to not know the method by heart, because I know the pain of looking for the answer and you seem sooo close and then the jack-a-mole website you find doesn't tell you!

Anyway, here's a new screenshot of the camera demo...
Posted Image
The demo actually works too! The redish objects are the cameras. Both cameras are set to look at the white cube in the middle. Pressing "W" or "S" will orbit camera A around the cube, while "A" and "D" will orbit camera B around the cube. Very fun... very exciting... will add more depth to this demo over time.

As always, anyone who's interested in downloading and working with the code can get their hands on it here at gitorious... I'm actively working on the development branch, so, if you're looking in the master branch and wondering where everything is, it's still all in the development branch :D

[TUTORIAL: "LookAt" 4x4 Rotation Matrix Method]

Assuming you have 3 3D vectors, eye, target, and up, where eye is the position of your camera, target is where you want your camera to look, and up to the upward vector of your world, then...
NOTE: up vector should be normalized

vec3d zaxis = normalize(target - eye)
vec3d xaxis = cross(up, zaxis)
vec3d yaxis = cross(zaxis, xaxis)

matrix = xaxis.x, yaxis.x, zaxis.x, 0, # Row1
xaxis.y, yaxis.y, zaxis.y, 0, # Row2
xaxis.z, yaxis.z, zaxis.z, 0, # Row3
0, 0, 0, 1 # Row4

NOTE: For the matrix above to work in OpenGL, the array containing the data is in column order...
Array Index: 1, 5, 9, 13, # Col1
2, 6, 10, 14, # Col2
3, 7, 11, 15, # Col3
4, 8, 12, 16 # Col4

Hope that's useful to someone. Forgive me if it's a little confusing, I'm tired and not thinking with all synapses.

Bug Fixes... and a Screenshot!

Posted by , in Archetype Engine, Python 19 January 2011 - - - - - - · 355 views
Archetype, demo, screen-shots and 1 more...
[BLURB]: What can I say? Bug fixes... and a screen shot of a BROKEN demo :)

[DEVELOPMENT: Archetype Engine]

Still a number of bugs to clean, but I fixed enough of them to get something drawn on the screen now, and it's easier to see the two viewports. Camera's still a LOT funky, though, so a bit of work needs to be done. I DO have a screen shot, however, since someone wanted to see one. Not impressive, but...

Posted Image

Hope you enjoy! :D

Cameras... soon to be action!

Posted by , in Personal Side, Archetype Engine 16 January 2011 - - - - - - · 424 views
pyopengl, Archetype engine and 6 more...
[BLURB]: Archetype engine has cameras! Hope to catch up with the Game Programming Gem series of books!!

[DEVELOPMENT: Archetype Engine]

Did quite a bit of work to give Archetype some camera action. It's a relatively simple camera, using an eye/center scheme ( thank you gluLookAt ). This allows me to move my eye (the camera itself) and it's point of focus (center) independently. There are also a couple of nice methods. One called "pan" which rotates the center coordinates around the eye, and the other is called "orbit" which rotates the eye around the center. Rotations are all handled by quaternion calculations, so there shouldn't be any abnormal rotation artifacts occurring.

Of course, the camera's all well and good, but without anything to see, there's no point to it. I'm close to solving that issue. Firstly, I created a class called iRenderable which, serves as an interface class for all world objects. All it does is store children (for complex constructs... like models), return bounding boxes, and has a couple of empty methods called render and postRender, which are intended to be overridden. There is also a method called renderChildren which calls the render->renderChildren->postRender pipe on all children within an iRenderable object. I dear suggest that, in effect, I've created a scenegraph node structure... and that's where I plan on continuing next... building a scenegraph-esk structure. Ok, maybe not "esk"; maybe an actual scenegraph structure. Once complete, I should be able to write the first demo for the "engine"... exciting!

Of course, if anyone is at all interested in taking a look at the progress, feel free to grab a copy of the repository here at gitorious! NOTE: All the latest updates are in the development branch.


I just got my hands on Game Programming Gems 3 the other day!!! Up until about a year ago, I hadn't even realized they continued the series past the second book, let alone expanded into other gem series, such as GPU Programming and AI Programming. I felt like such a dumb-ass when I learned I fell behind with the series by SIX books! I had a little extra cash the other week (and, technically, that's not true, I just couldn't help myself), so I bought GPG3. I suppose the smart thing would have been to purchase GPG8, but I have a thing about purchasing sequential items in order. I know it's probably silly, but still, I have trouble bringing myself to buy things out of order.

That said, however, I should, hopefully, be starting a new full-time job soon! With the money I'm making there, after I get some personal things settled (broken washer/dryer, fix up car, buy a Droid ... mmmmm... drooooiid... *cough*, and so on) I will be able to continue collecting the gem books and hopefully gain some wisdom that will help me take my engine and games just that once step further :)


Posted by , in Python, Archetype Engine 14 January 2011 - - - - - - · 551 views
Singleton, Python and 2 more...
[DEVELOPMENT: Archetype Engine]

I hem and haw over these often. Should I use them? Are the necessary? Generally, though, I've come to the conclusion that I need them for Archetype. There are a few components that should not be duplicated in more than once instance. For example, the display class should only be created once. We only need ONE window (and, as far as I can tell, can only create one window), so there should never be any confusion about there being a single one of these objects.

A better argument for my use of singletons, however, is in my events class. I want to be able to access my events class in all objects that need to receive or transmit events, but I want to be able to do it without any object needing to know where to get access to it. So, the question becomes, how do I give my objects access to the global events system, without building into my objects some information about the structure of my engine (and in so doing, causing a breakdown in the reusability of my code)? The singleton has always come to me as the answer to this issue. For each object that needs to send and/or receive events, I can allow them to "create" an event object, send or bind to an event, and I'm done! The beauty of the singleton is, when I "create" an event object, all I'm doing is obtaining a reference to an already existing instance. I make one change to that instance from any object within the game and it's changed system wide! Being that simple, I keep coming back to rely on singletons.

Of course, they also give me a little worry. I haven't even touched threading yet, and there may be some issues that arise when using singletons in a threaded environment. But, for the most part, that's not an issue yet.

So anyway... I've added singletons to the Archetype engine, and, while I've used singletons in other projects, I've come across an implementation which I've been "borrowing" heavily from for my current singleton implementation. For anyone interested, http://www.garyrobinson.net/2004/03/python_singleto.html


So, ummm... yeah... I'm experimenting with how to organize my journal posts (Yeah... I like the term "journal" over blog). Let's see how this evolves.

GAH! CT is going to get ANOTHER "big storm" in a couple of days. We've got three feet of this white crap in our back yards already... we don't need more! This winter is going to be brutal! If the snow doesn't stop, I'll be spending more time passed out from shoveling than I will be sitting here working on my engine! *Takes a deeeeeep breath*

HEY! I'd also like to thank everyone who's commented so far, and who's been reading my journal. Hope it's been worth the read for you all!!

January 2017 »

22 23 2425262728

Recent Comments