Brandon's Blog
7/19/2005 #
Potter Away
Okay, so if I ever write a best-selling book, will it get constant fricking news coverage for a straight week? Or is that just a Harry Potter thing?
I think it’s a Harry Potter thing.
I’ve read some pretty good new books. Some of them probably had pretty good sales performances upon release. They didn’t even get press. They didn’t even get a mention.
It must be because Harry Potter is a kids’ book. And kids’ books excite parents because they excite kids to read, which is hard to do. But what about Hank the Cowdog and other great kids books? Okay, so I don’t think there are any more Hank’s coming these days. But for anything… News coverage? Nada.
I think it’s stupid, like most news coverage. Like having Houston news cover a fallen tree as a major story. Like standing in the middle of a hurricane just to show us all how windy it is.
Why help out Harry Potter? Why encourage moms to keep their kids up until 12:01 AM so they can pick up a book at the very first chance possible?
Ugh! Bedtime. Stop thinking.
7/19/2005 #
Doxygen Update
Alright. Sigma is moving along nicely, at least in my brain. Really, though. Stuff is happening. I got inventory rolling (like, an hour or two away from full “go” on picking crud up).
Another thing that I have going now is doxygen. I’ll be adding a link to this to the actual Sigma page soon. Take a look, enjoy it. It took a heck of a lot of commenting to get it all done.
7/19/2005 #
A Hint
A little birdie landed on my shoulder today and told me that I have written just over three pages of combat system specification already, including official definitions of almost all required terminology, backend mathematics, and elementary procedures. I commenced to tell the birdie that he did not need to inform me of something I did while at work today. Although I wasn’t paying much attention, I at least had a clue what I was doing.
So, the birdie suggested that I put it up on my blog, so people (or maybe person) who didn’t know about these happenings might hear about it and become excited, possibly even anticipating reading the PDF that is being generated as I add to the document in my LaTeX editor.
Said birdie anticipates that I might just be done with the system specification by the middle of next week, maybe even this Wednesday evening!
If I keep feeling this kind of pressure, said birdie is going to be dinner.
7/16/2005 #
The Right Way?
I can’t decide how I should be managing Textpattern as far as updates to other sections go. I updated the Sigma section (Subversion access is now actually populated with source code), and I can’t figure out how to show that. I think I’m going to touch the post date on the Sigma article to get it to show up in the Recent list on the right.
I’m just a TxP newb, so I don’t quite know the best way to do all this. Maybe I’ll just run a blog entry every time something notable happens.
7/16/2005 #
Sugar Ray Wasn't That Corny
Whenever I see Mark McGrath hosting Extra, I think of listening to Hanson while baking fat-free muffins in a pink t-shirt. It’s that troubling and strange. I always felt like Sugar Ray had a deal with Disney or something, but the whole second-tier entertainment tabloid thing is just too much to take.
7/15/2005 #
You Know What?
The Black Eyed Peas really suck.
Unfortunately, I have Kelly Clarkson stuck in my head from my get-out-of-the-office lunch drive. Pick your poison, there. I can’t even remember how the BEP song went this morning, but I know it used the word “Phunk” a lot. Not impressive.
The record companies really want us to like BEP. And how about this monitor-based DRM? Pretty “phunked” up wouldn’t you say? I can’t wait for all the hack boxes that will spoof a monitor. Or, better yet, a BIOS firmware upgrade that lies about the port’s status.
7/15/2005 #
Lua, and More
I couldn’t be happier with Lua. The more I read, the more it looks like a very flexible, fun language with a whole lot of thought behind it. I haven’t gotten deep into the C API, but it also looks like it will be decently easy to extend. Everything is handled by what they refer to as a table object, which from my VB background sounds more like a dictionary (matched key-value list structure). Keys are variants, so you can string- or numerically-index them. I suppose you could even index tables with function pointers, given how functions and tables are “first class objects”...I think, don’t grade me on this because I’m not familiar with the term.
The C API is based upon a stack structure. You push stuff like variables onto the stack then gobble them with any number of operations.
For example, to call a function you might do what I’ve written below. Working distantly from memory:
Goal: Call f(x, y) and return the result to z.
Queue x
Queue y
Call f
Pop z
Calling f would gobble (okay, pop, I’m sounding like J-Lo in Gigli) x and y off the stack and queue up the value that I pop into z. This is a bit cumbersome to understand (I recall a duh look on my face for an hour or two when I first read about this six months ago), but once you get used to it things get clearer. I’m sure all languages are really like this, but I’m a youngling (ha ha, Lucas) when it comes to this stack jazz.
As far as getting names and functions to register, there’s a table that is called the environment table. It’s like a root table, where all the system names and types are registered. You just tap into that and add a “sigma” sub-table, or something to that effect.
Almost everything in Lua that’s useful beyond the basic language constructs is provided by a pluggable API, so the actual core language is small. This also means that simple stuff like trig functions are not part of the language core and that the plug-in architecture must be very tight to make all this convenient.
This also means that if they started shipping a sockets layer as a “core library” an extending/embedding programmer (i.e., me) could disable the loading of this library at run-time, customizing even the integral parts of the language for my application and security standards. Very impressive.
Today is a slow day at the refinery, so I’m tasking myself with thinking about containers and getting a solution solid in my mind. I also have the drive home for this. Options, options, options:
- Build containing ability straight into the Object class (base class of all game entities, including rooms)
- Build a separate base class and have everybody co-inherit it or whatever you call it when you have two base classes [everybody will inherit, though. Why not use a base class?]
- Build a separate class Container and allow each class to carry a pointer to a container [bloat, bloat, bloat]
- Forget classes. Code an inventory for Character’s, code a contents for Items, code a floor for rooms
My bloaty option has one core advantage, and this advantage actually highlights why this relatively simple problem is causing me hair loss: If an Item is not a Container, how is it made to not be a Container. Reworded: If an Item has a 0 kg total capacity, is it still a Container?
What bugs me about this is this is this [sic, :P]: in “real life”, meaning life simplified down to Sigma precision, I see things that are containers and things that are not containers. A letter is not a container, an envelope is a container.
Now let me make a fool of myself and throw in a contradiction: a letter folded correctly becomes an envelope. A letter held on both ends is a poor container, but it still is a container. Of course, Sigma precision doesn’t worry about these things. A letter has a 0 kg capacity. An envelope has a 500 g capacity.
Did I just answer my question?
So, it looks like we’re building container functionality into the Object base class. This means we’re giving the Item class a weight property. Character’s and Room’s cannot be contained, but they are all containers. This, my friends, is why we have the Object class below Room, Character [Player, Denizen], and Item. Rooms are really large objects. They have a description like a Character and Item, and they can contain objects just like a bag. Only they have an incredibly high (or infinite, we’ll leave that thinkin’ for later, I’m thinkin’ infinite) capacity.
Dang, that didn’t take long enough.
7/15/2005 #
Add These To The Punch List
One big tweak I’ve really been wanting to do with Sigma is to handle XML validation errors in-code, rather than allowing libxml to do the dirty work. I want to use my nice-looking log() function.
Another big question mark for me: can one implement binary search trees based upon the memory addresses of its consituents? It’s a 32 bit number…would this be efficient?
Red and Black trees anyone? Help!
When I get Subversion up and running, it’s possible that someone – cough, hack, Meta, excuse me, cough, Magus – could submit a patch that would convert my List class to a binary search tree.
My year in the House of Gamel didn’t do anything to improve my opinion of coding binary trees. I know O(log(n)) is sweet, but I’ll be danged if I really know how to use them correctly. O(n) just sucks. Since I started the project, I’ve been self-conscious about my linked list structure.
Luckily for my future patcher, the List class (and its red-haired stepchild ManagedList [literally… it inherited List], who I killed mercilessly in my memory audit) has been dramatically simplified and cleaned since Sigma 0.0.0.0.0.1 was in production.
Although barely functional and completely not fun, Sigma 0.0.1 is at least memory-responsible. Not that I’m saying what I’ve got now is 0.0.1. Let’s call it RC 1 Pre-Release Alpha.
7/15/2005 #
A Modest Proposal
I just picked that title out of humor. I don’t endorse cannibalism.
Anyway, I declare 7/15/2005 to be the Day of Sigma. Here’s my proposal for a script architecture:
Well, the first thing with a script architecture is knowing what scripts are allowed. Here’s what I have so far:
- A use/brandish capability for special items
- Events for items, rooms, and denizens (character enters room, item dropped on floor… the works)
- Tasks (as in, things that are run like daemons on intervals)
- Handlers (as in, things that are run to respond to commands)
Handlers come last. The question is: can use/brandish be an event. Yes. Yes it can.
So, we’re basically dealing with
Of course, events are really methods (meaning, they take a self or this pointer as their first argument). That chicken has already been fried. We’re passing long int’s as pointers and the API functions will accept them, dereference them on the C side, then do whatever is necessary.
Tasks are just sentinel functions. Probably the easiest, probably the least useful on the short term. I could see using tasks to implement a weather module. I actually considered consolidating all tasks to Lua and writing the denizen locomotion function in Lua, but I discarded that notion based upon complexity and inefficiency.
Handlers really don’t matter for now. The architecture is there (I already have an abstract base Handler class that CxxHandler inherits). LuaHandler just needs to be written and set up. I’m not going to care about this one.
So… It looks like Lua is best at reading a file as input, then throwing all that code into a “function” on the stack. I put function in quotes because this data doesn’t have any metadata like what variables are taken as parameters and what is returned. This is all kind of loose, VB-style not Option Explicit stuff.
So you load up the code onto the stack, then follow it with what variables you need to give it. Because I’ve taken a month to think about all this, I have this all nice and tidy. I’m actually going to push the function chunk to a table called user, which will contain the code and a function “name” defined within xml as follows:
<event type=“use” binding=“heal” />
Then, in your extension or script or whatever-I-end-up-calling-it section of server.map:
<script file=“heal.lua” />
Sigma can intuit that heal.lua contains the code for the heal binding. When the function is called, a copy of the chunk is pushed from the user table to the top of the main stack, then the proper parameters are pushed. Then the function is called.
Ba da bing.
7/12/2005 #
Sigma? TV? Sigma?
It’s killing me that I can’t figure out how to do inventories for Sigma. Plus, with Qt 4 coming out, it’s been really tempting to move over to a homebrew TV tuner application to replace MythTV. I’m thinking I can use the video features of Qt 4 to render television. All that would be required would be the means of changing channels, and maybe a one-touch recording feature. Pointless project (Myth is Good Enough™), but it would be a fun way to try out Qt 4.
The other big project is a library management application, but that’s on hold for now. If I ever get some free time I’ll have to make some progress on Sigma. Once I get it imported into KDevelop (and Subversion…I think KDevelop will handle this for me automatically), it should be easier to put in a small amount of effort and be more productive.
> Newer Posts
< Older Posts