Several hours of testing has shown where the problem lays in regards to the kinks in tpsh’s basic control flow…. a strict ficken implementation lol.

Without a few extra ‘;’ between language elements, the parser doesn’t see the keywords as keywords, and instead they get fed into the code generator as arguments to the preceding keyword. Testing the same test code against the version of bash with MSYS1.0, their shell doesn’t give a hoot, nor should any other bourne-style shell I have access to. So in a way, you could say my code took a stricter interpretation of the sh script syntax, then what is required (and desired).

Somehow this actually makes me feel better, lol.

Also something that needs working on, is dealing with crappy old-style paths like CP/M, DOS, and Windows NT use.

$ P:/Editors/Vim/vim-personal/gvim.exe
tpsh: command not found: P:/Editors/Vim/vim-personal/gvim.exe at S:Visual Studio 2008Projectstpsh-dirtpsh line 883.


$ cd P:

$ P:/Editors/Vim/vim-personal/gvim.exe
tpsh: command not found: P:/Editors/Vim/vim-personal/gvim.exe at S:Visual Studio 2008Projectstpsh-dirtpsh line 883.


$ /Editors/Vim/vim-personal/gvim.exe

$

It seems to have a bit of an issue about drive letters.

In more detail, the search_path() function that converts an external command name into the direct path to it (done in order to avoid a dependency on the systems shell, e.g. /bin/sh or %COMSPEC%), fails to find a valid file when the drive-letter: notation is used. Since the function returns undef to indicate program not found, simply put search_path() needs fixing. The change should be trivial though.

I managed to get some coding in today, maybe that’s why I’m feeling a bit better. On the down side though, my cable connection seems to be running half as fast as normal lately, games were nearly unplayable for much of this afternoon for some reason.

I think my shells codegen branch has lived to the virtual extent of it’s usefulness. Today I sorted a few minor things and enabled nested control flow for statements using the ‘then’ and ‘do’ keywords, e.g. control flow statements can contain control flow statements as well as commands within their block. There are still a few kinks to iron out but the most important are done; I’m currently uncertain if the remaining problem lays in the code generation phase or somewhere further up the processing chain, but I expect it lays in generating the perl code.

Basic conditional flow and looping is ready, which was the primary purpose of this branch of development: to explore implementing the shells scripting language by dynamically generating Perl code for it, as well as replacing the static command sequence executor by generating it as well.

Oddly, the main things that need doing in the short-term are actually script related, rather then interactive. But then again, tpsh has always been meant for interactive usage first and support for batch jobs as a secondary concern. Main points of lacking at the moment, is a concept of “exit status”, in Bourne shell parlance the $? variable isn’t used for a hill of beans yet. Likewise all $variable expansion is done on the fly during tokenization, so:

for X in 1 2 3; do echo $X; done

The value of $x in the loop body would be expanded before the code is evaluated, resulting in the following:

for X in 1 2 3; do echo; done

because X is not defined at the time the statements are being parsed, the expansion is “”.

I haven’t decided how this will be solved yet. Solving it however, is well outside the scope of the codegen branch. I would say the only thing left to do in the branch, is implement the break num and continue num to enable a way out of the while/until loops. The former will take a bit more testing but the latter, is not likely to be to hard. Perl supports a robust way of breaking out of loops that can be easily used. Once that stuff is done, I’ll likely merge the branch into master and move on to other tasks.

Since I’ve been stuck working more often on the NT machine, development of tpsh gets a slightly higher priority lol.

Random thoughts: if I ever built a MUA

During recent discussion this week, it occurred to me that creating a Mail User Agent (aka Mail Client, like Outlook Express, Thunderbird, etc) would be a fun project to pass time someday.

Some thoughts of what they would look like, assuming it was designed to be a MUA that I would *actually* use myself hehe.

Likely there would be a scriptable mail shell, some what reminiscent of the old unix mail program in practice. Most interesting stuff like sorting and threading, would likely be implemented through a set of post processing modules (user serviceable). That is, in effect virtually anything it does would likely be implemented as an external and easily replaced component lol. I like software that works out of box, has hooks, and gets the heck out of the users way.

A graphical user interface would likely be provided for working things in a more traditional manor, and quite surely would provide simple message view/edit modules if the toolkit offered suitable widgets. I know Qt privides very nice text editing widgets, and since 4.3’ish has even included a Webkit module that could likely handle HTML mail. Although personally, I would just feed it into my web browser instead hehe ;).

I think it would be a fun thing to build someday, maybe even as an exercise in learning Common Lisp or some other interesting language. The big thing though, is it would likely be focused on IMAP initially and skip POP3, and should we say…. that while I love to use IMAP based mail systems, I also completely and utterly hate doing any programming that involves that protocol what so ever! It is just a royal pain, especially if the language has a low level interface to it, which means you really don’t gain much over rolling sockets by hand. That being said, PHP on the other hand, does likely have the least painful API I’ve encountered for IMAP. I’m not sure if that is a compliment or a vex….

The programmer compiled an array of reasons as to why he can’t find a girlfriend with a good <HEAD> on her <BODY>, reason 0 being that he has limited cache. So he searches his memory to recall connecting to the TCP/IP tunnel of his last girlfriend — sometimes even without a secure socket. His last girlfriend always complained about his lack of comments. He fumed, “I hate commenting!” Realizing it was a program requirement, he told her she had nice bits. This resulted in a Syntax Error. Now she demanded a massage, but this was rejected as “Feature Creep.” He smacked her back-end and shouted, “Who’s your parent node?!” He scanned for open ports. He attempted to install a backdoor worm but her response was 403. While his data uploaded into her input device, she considered terminating the process. But instead she initiated a Do While loop where she recalled a previous boyfriend with a larger pointer. To expedite the routine routine, she screamed, “Hack into my system! Hack deep into my system! You’re 1337, baby!” This caused his stack to overflow, and he shot his GUI on her interface.

found: http://www.devtopics.com/best-programming-jokes/

chuckle of the day, 2009-08-06

In my web surfing I found this comment, in regard to “Programming languages” and not compilers/IDEs/etc;

Support (Critical bugs instantly fixed instead going to version 2,3,…, with more changes, more complexities, new bugs)

Some how, I feel like laughing…. a programming language (it’s tools aside!!!) should not contain bugs, it should create bugs lol.

So far work on the game proceeds well in spare moments, and quiet fun to tinker with. Recent activities have been focused around adjusting the input manager to handle both buffered and unbuffered input; PlayerEntity may also become a singleton class in time (I am not fond of singletons, but I reckon OGRE shows that they can be useful if built properly).

Most changes that are most pressing at the moment, is refining the command structure and state management. When I first setup the build with OGRE, I made sure the OIS and CEGUI libraries were present. When I’ve time to get crazy side of things working, I want to adjust the prototype to load into a main menu structure. That’ll give me good incentive to put SettingsParser to greater use, and most importantly write the code to allow it to flush things back out to the users configuration file, haha!

It would also be nice to start setting up the weapons related code, an aiming cursor, and map loading. One of the reasons I chose OGRE, other then saving the waste of writing a 2-bit render ontop of Direct3D/OpenGL—it comes with a BSP based scene manager. When it comes to game engines, I’m most familiar with modernized Doom, Quake III, and Unreal Engine 2 systems. After so many years of Raven Shield, should we say that a BSP-based map sounds like an interesting shot. We’ll see where that heads in the future.

Combing vcbuild and vcexpress running at the same time, can lead to such interesting linkage errors if you try running vcbuild before saving the changed solution file back out ^_^.

Ok, no wonder I so much prefer just opening project files in vim, it saves me from having to launch the bloody IDE 8=).

Random thoughts about recent stuff

Most pressing tasks at the moment, is setting up the input manager to handle both buffered and unbuffered input more easily. Currently a simple system is used, the input manager interfaces witgh the backup library (currently OIS) and exposes a registerCommandListener() method. For each command we want to bind input to, there is a specific subclass of AbstractCommand passed to the input manager along with the key it should be bound to (which gets mapped our own representation to what OIS uses). A simple group of associative arrays handle mapping buffered input back to the registered command objects, which have the task of making sure whatever is supposed to happen on said input event, actually does. A prime example from the prototype, movement commands are registered for mouse input and the W, A, S, D keys; when the AbstractCommand::handleInput() method is called, they tell PlayerEntity that it should move in the appropriate way. In plain C instead of C++, I would just have used a pointer to a structure holding all the interesting data about the binding + a pointer to a callback function. Same basic concept, only my prototype takes advantage of C++, which is what I’m stuck with for the moment 8=). I have no real love of C++, beyond not having to deal with yet-another implementation of data structure XYZ. (BSD Unix at least has provided macros for the most basic data structures in sys/queue.h for many years, now if only a new C standard would do likewise.)

Soon I’ll need to start modeling “Stick Man” as a place holder, it’ll likely be an extremely simple humanoid model; about as complex as a wooden artists model. Just something that can pass as a human figure during the prototypes tests lol. An arm for example will likely be a sphere for the shoulder and elbow, joined by beams, and terminating in some similiar representation of a hand.

The thing that interests me most in terms of 3d entities, is the possibilities of what can be done. Whatever the performance and code difficulty involved, an idea that I would like test: is to create the humanoid model and a ‘door’ model. The door would define two points of interest (assumably bones), one running along the hinge (to calculate how it should swing/pull open) and one through the knob. Then to establish suitable references to the models hand and the door knob, and then specify that the users hand (and obviously, any other bones that need to come along for the ride) should be moved to a position close to the door knob and back again. So that if for say, our model had to open doors; we could show it happening (kind of) and wouldn’t need separate pre-done animations for whether the model is crouched or standing, let along having to go through the trouble of making doorknobs the same exact position on every door ^_^. Likewise the possibility to take a weapon model (aka “Stick gun”), and define points of interest: such as a muzzle, foregrip-point, stock, and the handgrip. Then defining that the humanoid models hands should be positioned at the foregrip and handgrip points, and apply a griping animation to it of some sort. I am more interested in exploring what is possible without popping a cork then in creating what looks and acts proper in that regard.

Weapons implementation as of yet is undecided; current calculations for the damage portion of the ballistics has been promising. The algorithm and test-weapon specifications have yielded suitable figures when used within proper situations. Basically, everything is tuned on the concept of an ideal and a maximum range that the weapon should be effective at; results showed that for the various example test-weapon specs gave the desired behaviours until a round began moving past maximum effective range. The downside is obviously, if one wants to take a short range weapon and use it like a sniper rifle, expect to have to empty a crap load of ammo or learn how to target the vitals! The main point at which things get sticky, is hit detection and trajectory. The tests for damage/penetration power were based on segmenting the bullets travel path and scaling accordingly. The idea that comes to my mind as the obvious-first attempt, is apply a simple hitscan method – fire a beam from the muzzle to whatever it hits, like a laser gun (I hate games that do hitscan). Slice this path into smaller sectors then mutilate its forward trajectory, in effect causing a way to implement bullet drop if desired. For removing the “perfect aim”, I reckon it would be easy enough to apply a jitter to offset the bullets hit point according to what the weapon should be capable of doing.

Games are not really my area of expertise programming wise, because I’m more accustomed to building tools and combing front/back-ends. It is however, an interesting thing to tinker with; and I am building a prototype to explore random ideas — not a polished product.

Oh what fun it would be: a compiler with useful error messages

the code:

#include "common.hpp"


template<typename ACHAR>
class GameException
: public std::exception
{
public:
GameException() throw();
GameException(const ACHAR*) throw();
GameException(const basic_string<ACHAR>&) throw();
virtual ~GameException() throw();
virtual const ACHAR* what() const throw();
protected:
const ACHAR *why;
};

the error:

s:visual studio 2008projectstacfpsgameprojectnamesourceincludegameexceptions.hpp(17) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

the solution:

fully qualify basic_string<> as std::basic_string<ACHAR>, or add ‘using std::basic_string’ to common.hpp along side std::string and std::wstring, like I thought I did last week !!!

simple fact: compiler errors usually suck, and C++ templates don’t help any.