In being dragged across the grocery store yet again! I spent some time contemplating what I was thinking about last night, as I was finishing up part of my games net code. Wouldn’t it be practical, to just implement a simple Virtual File System? It would make adapting the code base to different uses easier, since pathes and I/O could then be defined through a set of VFS_routines, but on the downside, making it pluggable would push greater overhead on all those I/O routines at every use.

The zpkg, system input/output, and network modules present very similar interfaces. Main differences being that zpkg doesn’t have write support (an unneeded non-trivial feature), and seeking between positions in a socket, just doesn’t make the same sense as with local files. If a virtual file system layer was built on top of it, it would be rather easy to define a “Plugin” data structure providing the necessary function pointers as needed, and simply use a hash table to handle the mappings between paths. Of course that leads to the bugger of a look up operation o/.

Really, most of the places where it matters wouldn’t impact game play, since most I/O can be divided between startup phase, loading stuff, client/server communication, and shutdown phase; the chatter between client and server obviously being implemented directly on top of the networking module, and therefore a moot point. It would make it possible for the resource loading code to become more flexible at run time; i.e. being able to load game assets both out of zpkg files and local system files without a recompile or a  restrictive version of the VFS.

I think it would be worth while, as an added plus, it would even allow splitting the path argument to Zpkg_Open, and pulling out the interesting bits into the VFS adapter function, which would be replacing that feature of the zpkg module.

For today however, my primary goal is to port the networking code (almost) completed last night, from the BSD Sockets API over to the Windows Sockets API. That way I can replace the less appropriate network code in my RvS admin program with it, and save having to complicate its design to make the most of Qts networking API. All while improving my games code base ^_^.

Although WinSock was based on the old Berkeley interface, Winsock has arguably grown more over the last decade, then the Unix interface has over the last 20 years. Not that there was much need beyond adding IPv6 capability, which the common Unix interface already grew ages ago. I personally dislike both the Berkeley and Windows interfaces immensely, why? Because in my humble opinion, the proper way would have been something like:

int s;

if (s = open("/net/tcp/host:port", O_CREAT | O_RDRW | O_EXLOCK)) == -1) {
perror("Unable to open a connection to host:port");
}

/* do usual stuff here, like read() or write() */



where /net would be an arbitrary mount point for a special file system, in which file system operations reflect their corresponding network operations. Flags for system calls like open() and fcntl() could have been suitably extended to cope, and others like accept() implemented as needed. In the light of things like FUSE, it would be even more interesting to do it that way today, then it would have been in the 1980s.

Instead of that simple form, whenever we want to create a socket: we have to setup suitable socket-specific data structures, which and how many depending on the operations to be conducted; common practice is to zero over the most important (sockaddr_in / sockaddr_in6) structures before using them, and leave it to the compilers optimizer whether it actually happens at run time; look up in the system manuals what pre processor definitions correspond to type of network connection we want (let’s say TCP over IP) for the socket() call; initialise the field structures, using the same pre pre processor flags, and even converting details like the port # into suitable formats, all by ourselves. After which we might finally get around to doing the socket I/O ourselves, pardoning any intervening system calls needed for your particular task.

/*
 * Assumes open flags in previous theoretical example corresponded to a connect
 * operation, rather then a bind() and listen() operation. Like wise for the
* sake of terseness, I'm "Skipping" support for real.host.names rather then IPs.
 */

int s;
struct sockaddr_in addr;

memset(&addr, 0, sizeof(struct sockaddr_in));
addr.sin_family = AF_INET;
addr.sin_port = htons(port);
if (inet_pton(AF_INET, "xxx.xxx.xxx.xxx", &addr.sin_addr) != 1) {
/* handle AF_INET, address parsing, or unknown errors here.
* error is indicated by return value.
*/
return;
}

if ((s = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1) {
perror("Unable to create socket");
goto CLEANUP;
}
/* use system calls and a data structures as needed to setup things as desired */

if (connect(s, (const struct sockaddr *)&addr,
   sizeof(struct sockaddr_in)) == -1)
{
perror("Unable to connect socket");
goto CLEANUP;
}

/* do I/O here: send/recev, or read/write */

CLEANUP:
shutdown(s, SHUT_RDWR);
close(s);

I reckon the Berkeley interface was the right choice, for portability between systems (including non-unix ones; making it easy to write stuff like WinSock), and probably easier to graft onto the 4.3BSD kernel, but it’s damn inconvenient for a UNIX programmer. That ain’t changed after about 25-30 years.

Oh wells, at least it works pretty darn near every where, give or take a few kinks.

Now playing: one of my favourite songs

I don’t want another heartbreak
I don’t need another turn to cry, no
I don’t want to learn the hard way
Baby, hello, oh no, goodbye
But you got me like a rocket
Shooting straight across the sky

It’ s the way you love me
It’s a feeling like this
It’s centripetal motion
It’s perpetual bliss
It’s that pivotal moment
It’s, ah, impossible
This kiss, this kiss, unstoppable
This kiss, this kiss

Cinderella said to Snow White
“How does love get so off course, oh
All I wanted was a white knight
With a good heart, soft touch, fast horse
Ride me off into the sunset
Baby I’m forever yours”

It’s the way you love me
It’s a feeling like this
It’s centripetal motion
It’s perpetual bliss
It’s that pivotal moment
It’s, ah unthinkable
This kiss, this kiss, unsinkable
This kiss, this kiss

You can kiss me in the moonlight
On the rooftop under the sky, oh
You can kiss me with the windows open
While the rain comes pouring inside, oh
Kiss me in sweet slow motion
Let’s let everything slide
You got me floating, you got me flying

It’s the way you love me
It’s a feeling like this
It’s centripetal motion
It’s perpetual bliss
It’s that pivotal moment
It’s, ah, subliminal
This kiss, this kiss, it’s criminal
This kiss, this kiss

It’s the way you love me, baby
It’s the way you love me, darlin’, yeah

It’s the way you love me
It’s a feeling like this
It’s centripetal motion
It’s perpetual bliss
It’s that pivotal moment
It’s, ah subliminal
This kiss, this kiss, it’s criminal
This kiss, this kiss

It’s the way you love me baby
It’s the way you love me darlin’, yeah

This Kiss—Faith Hill

Yes, in some ways I’m a bit hopeless at heart lol.

One of the things that has been resting on my mind, is working on my game projects and raven shield admin system. I do believe, that I’ve figured out a way that I can augment my engines capabilities without breaking down portability to much, and still retaining the “C” language factor ;). I’ve also decided that my RvS admin tool, will likely benefit if I complete my games net code, and integrate it in place of the existing networking code it uses.

I’ve three game projects, generic titles being StarFighterGame, TacFPSGame, and MechCombatGame; each chosen for their obvious descriptiveness in place of an iron clad title. StarFighterGame, has been awarded the title of “Stargellas Revenge ©”, and the others are still to be decided. Story wise, Stargellas Revenge is green light, it just needs the game code and assets to catch up with it. I have the general overview for TacFPSGames story and enough design details set, but still can’t figure out a proper title. The ‘mech game, I’m thinking of splitting into two different games: one aimed at a combat simulation, and the other as a Real Time Strategy game, charting the “Bigger picture”.Story wise, things need to develop further, as well as growing a title. On the one side, I’m thinking some what along the lines of an epic war meets small scale tactical warfare, and some hordes of enemies to mow down for the action cravers, hehe.

The code backing my game projects, is engineered to be highly portable, and suitable for producing most any kind of game. My primary focuses, more or less follow the styles of arcade and simulation games, but alas, I prefer flexibility over rewriting crap later on, hehe. I could do so much more if I had more to work with :'(.

I haven’t been getting much rest lately, although a fair bit of sleep. My dreams have been weird, ranging from caring for the best friend I’ve ever had, to struggling with more difficult adversaries. It’s kind of strange, because I generally don’t dream about the dead :-/. The only good thing I can say, is despite a few disturbing things, going to bed ’round 0200 local sure beats 0700, lol.

My minds focused on getting stuff done, and trying to rack up some R&R. Which leads to my new official Quake motto is “Fuck’em all, and let John sort’em out”. With the wifi being a bit more upity lately, I’ve mostly been hanging around Raven Shield the past couple weeks; unlike SWAT 4, in RvS if you lag out in the middle of a gun battle, it tends to increase your survival rate, rather then negate it.

Yet I still have a tendency to lag up and fall off into deep space when playing Quake :-(. Although I must admit, even with my wireless freeze frames every two minutes or so, I’m actually getting quite good at handling them, but there’s only so much you can do when it’s in mid air lol. Last night I got plugged off an arena platform, and died with rocket launcher in hand, because I lagged up and missed the chance to rocket myself onto a nearby jump pad for a last minute save.

This song is stuck in my head o/

On the day the wall came down
They threw the locks onto the ground
And with glasses high we raised a cry for freedom had arrived

On the day the wall came down
The Ship of Fools had finally run aground
Promises lit up the night like paper doves in flight

I dreamed you had left my side
No warmth, not even pride remained
And even though you needed me
It was clear that I could not do a thing for you

Now life devalues day by day
As friends and neighbours turn away
And there’s a change that, even with regret, cannot be undone

Now frontiers shift like desert sands
While nations wash their bloodied hands
Of loyalty, of history, in shades of gray

I woke to the sound of drums
The music played, the morning sun streamed in
I turned and I looked at you
And all but the bitter residue slipped away…slipped away

A Great Day for Freedom—Pink Floyd.

Well, I finally reached the point where I couldn’t focus on the code any longer, and just went to sleep hours early lol. Ironically by the time I would’ve likely gone to bed, there was such a huge freaking storm blowing, that I woke up o/. It was so ferocious sounding, that it took me a while to be sure whether or not I was dreaming or waking up, but it woke me up lol. The thunder was so earth shattering loud, I think to get any louder, it would take flying in it.

The downside of going to bed early, is missing a few hours coding, and that I’m awake already :'(

Between projects, duties, and my own odds and ends, I’ve basically have used five or six programming languages this week in order to get stuff done, and have probably read code in a dozen more languages. Sometimes I really wish sticking towards one or two languages across every task would be more practical, but I’m unlikely to see that happen in my life time. I just use whatever gets the job done best.

Ya know, if I could speak human languages as well as I know computer languages, I could order dinner in any civilised country in the world.

Today’s main goals, are to work on finishing my ‘new’ client side admin for Raven Shield, hash out Stargellas networking sub system, and find some time to play a couple rounds. Although of course, if I actually had a worth while choice in the matter, I wouldn’t be spending my day camped in front of a computer, but knowing my family well, it’s unlikely to day is to stick to last weeks schedule. *sigh* at this rate I’m never getting out of this place without a sledge hammer.

Things have been hopping lately!

I’ve just finished a portion of a open source project, that’s worth about $1,000-$1,500 in monkey labour, even at going wages for nublet programmers in these parts. But it’s not a project I’m involved with for profit, so much as an opportunity to leave things better then I found it. It is cool however to know what ones time is worth o/. On the upside, since the code I’ve written falls under a very permissive license, I can always put it to good work else wheres, hehe. The code should reach the git repo this evening.

Recently heard that my brother was involved in a car accident, sounded like it was on par with a “Jaws of life” or glorified can opener kind of situation. Either way, for the second time in 12 years, his cars totaled. Apparently, he is also pissed off that the guy who hit him, did it by serving to miss a dog, instead of running the poor animal over. I glad both my brother, the dog, and the other driver are all in one respective piece, even if it means a destroyed car. You’ve just got to love my family, don’t you? It made me think a bit about how my father exited truck driving, by hanging the rig off a bridge, but sed -e s/missing a dog/missing a woman with kids in the car/g. Maybe it’s just my brothers nack for driving like a Gran Turismo race track, but he seems to be good at totaling cars when he actually /does/ get into an accident.

As for me, I’ve been largely glued to a computer, working on various projects. Luckly, there has been one decent thing going for me, I don’t have to get up before ‘lunch time’ on days off work :! Which kind of makes it easier to be up all day and all night working on crap, until of course, you’ve got to go back out to work >_>. I am that freako kind of person, when the project interests me (or I need to), you’ll find me eating, sleeping, and breathing it. Until either it gets done, or I need to take a break before I have a stroke lol.

While I was being dragged across the super market the other day, I was contemplating very seriously, dropping support for FreeBSD from one of my upcoming personal projects. The time savings alone from doing that, would allow getting it done perhaps a year or two ahead of schedule. Delays involved from supporting FreeBSD are not a fault of the OS, so much as many third party assholes that make it more troublesome to support FreeBSD, but could like wise make life easier if the right software was available. Then I got to thinking, well if I could just purchase certain tools in the first place, the time savings in production would just be worth it (I’m only likely to be using the program under Windows NT anyway), and those tools would *ease* that platform support issue at the same time. A bit, at the cost that those tools would also mean closing the code base :(. Shortly after wards, it occurred to me: the possibility of forming a small company with some friends (or hiring them on as helpers). Having the extra dedicated assistance of a small team instead of going virtual army of one, would help speed up getting it done, keeping it professional, and between the lot of us, we could cook up some interesting projects to stay in business with. In due time, we could also upgrade to bigger and better tools for a more rapid turn around then a near non existent starting budget allows. The problem however, is even if we found a publisher for our products, our stuff kicked everyone’s ass, and the publisher wouldn’t simultaneously screw us out every orifice in the dealing, I doubt if we would reap enough profits in order to make it worth my friends efforts :-/. For me, any profit is still, well more then I had before, but if I’m going to get others involved, I would want them to get a fair share. I don’t get involved with stuff in order to make a buck off it, I do it because I want to, but I can’t expect the same of the rest of the world.

In all probability, that project in question will be produced virtual army of one, along with the help of a few people who’ve volunteered or given their services for a few parts. And the code base would stay open, and FreeBSD will likely be supported. Whenever possible, I do prefer writing code that supports Linux, BSD, general Unix, Mac, and Windows; but of course, since I don’t have a Mac, I don’t support OS X officially lol. I just don’t burn the bridge of supporting a given OS, unless it’s necessary.

When it comes to the questions of closed / open source, I’m a realist. I very strongly prefer open source, and under a *real* opens source license: not the GPL. (Zealots stop reading now and go fsck yourselves.) I will use closed source software when it is the superior or more suitable application. However, being able to read(!), and even hack at the source is a massive plus for me. When it comes to stuff I write, I prefer to keep it open source also, for just the same reasons I prefer to have access to the source code of programs I use.

In the end though, I expect a good quality program that is well executed, be it open source, closed source, free, shareware, or just costs more then a shiny new Lamborghini.

In my ever successful attempt at spending sometime “Resting”, rather then just working my ass off in front of a computer, since some how there’s still nothing else to work on here >_>, I’ve been fluttering through some articles, mostly over at the Daily WTF!, as those who use the same ‘microblogging’ platform I do, would have noticed. I also came across a few interesting finds:

http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html

http://www.joelonsoftware.com/articles/APIWar.html

Although a tad dated by now, but still interesting hehe.

Feeling inspired

As always I’ve got plenty of loops open, always have, probably always will… I hate sitting idle. While I like time for R&R, I prefer to stay fairly busy. Right now I’m focusing on

I feel inspired in a way, to throsh along with work on my game projects, it’s been a bit since I’ve had time to work onit, but the SYSIO sub system is almost complete, once that’s done, I’ll try to unify the ZPKG and SYSIO interfaces and work on using DevIL for texture loading code. When I pause for a moment and think about the sources before me, I can see what it could become, and all I need is the time and strength to do it.

Today I also thunk up the most perfect unit test for epi-sum, and one monster data set to test an internal library against. Overall, our EPI implementation isn’t designed for to compete with C/C++ runtime speed, in fact, language selection was chosen with it as an after thought. The thing is though, while it still can keep pace with stuff like apt-get or PBIs, I want it to be faster then any valid competition :-D. It’s also good geek fun to see where algorithms can be adjusted for savings. An extra bonus, since the ECA code is under a BSD style license, I can also ‘barrow’ the best parts for other projects, hehe.

When it comes to optimization, I generally “Skip it” whereever possible, and I rarely use the corresponding compiler flags either. The place where I focus my attention on, is doing things in a good way: data structures and algorithms that fit well, solve the problem, and that scales with it. You could say, my focus is on finding the best solutions that don’t shoot you in the foot, nor complicate trying to understand wtf the code actually does. If a real bottleneck enters the picture, then I dig into the code monkies bag and start fine tuning things.