Airlines were helllllllllllllllll. >.< I missed every connecting flight I had, and I ended up missing most of the event I was checking out in Washington state. Of course things could have been better prepared for the first flight, but my choices were still limited since Newark only had flights out to Washington that day all in an hour time-span. That weekend was also hell because I didn't get a lot of sleep, one night getting only 4, the next only 3.

But, luckily I got to catch up on my sleep this week a bit. And yes I realize there's, "no such thing as catching up on sleep," but then I'll tell you to go preach somewhere else because I'll tell you otherwise. :p I got at least 15 hours the night after that crazy weekend, and more than 8 for the rest of the week! ^.^

So, I invited Beck Macary over for thanksgiving, and we had a blast hanging out with my cousins! I was especially open that night, explored my sense of humor more than I get to, and had plenty of laughs and good times tonight. Nerf Wars, sparring, food fight, crazyy uno games, lotss of fun, couldn't have gone better!! :]  After thinking about it, many of my Rocester friends haven't got to see my crazy sarcastic sense of humor in full action, it was a lot of fun, I even had moments I was laughing at myself! Good times. :)

So, with all that was going on, and catching up on sleep, my one week for thanksgiving break felt waay too short! But at least it was an awesome one, and weekend airline hell aside, it couldn't have gone better!!

Concerning programming stuff, the draft for my new Vector2 post has been sitting in my inbox, waiting to be edited and finished before posting. I'll probably release the post and the source code in the next week, and will get onto making another post with a useful class for game development.  I have a busy quarter in for me though, this is basically what my schedule looks like, though it's been changed a little: schedule here.  I'll have two game projects I'm working on, though one of them should be semi-finished early in the quarter, and from then on I'll only have one to work on; though I will try to continue work on my Warp game engine, as I plan on using it to develop my own games in the future, besides by expanding it learning other game programming technologies.  Fun stufff. (:

The last two years of my life at RIT leaves something to be desired, as a result I've been itching to get out of here and go somewhere else that will help re-ignite my passion for learning and programming.

Nothing bad about RIT in particular, it's just how school systems are, requiring you to take a whole bunch of classes that have nothing to do with your major.  I'm paying money to go to this school, and I don't think it's fair that I'm forced to take classes I don't want to take.  I realize they're supposed to help make me more well-rounded, but why do I have to take so many of them??  I just know I could've gotten a better programming experience if I went to a different school, though that's what I'm hoping for by going to graduate school.

So, in trying to spark my passion for programming and making games, I'm thinking of going to Digipen in Washington state, or Southern Methodist University: Guildhall in Texas.  I'm also looking to get a job for the next 6 months.


Overall, I know I want to try to develop a really cool game in my free time, and try to market it myself as an indie developer to try to make some money, and to help myself get my name out there to make it easier to be hired from a company.  You know, good resume material.  I'm also doing it to learn more about game programming, so it's an educational pursuit as well.  I already have ideas in mind, though they're technically challenging and will take some time.  However, I have thought about making a 3d fan version of ZZT, I just don't know if I'd have any lawsuit kind of stuff to worry about; if I did do such a thing, I know I probably couldn't sell it, but I'd encourage people to donate money if they appreciate the work. Anyway, just a thought, as I would love to see ZZT become almost mmo like material, or at least have online content sharing similar to Little Big Planet or what have you.  One thing that would also psych me out, is if my game supported importing standard .zzt games; though as the engine is 3d, I've been considering taking it into the 3d realm, especially considering the popularity of Minecraft.  The other games I want to make are technically challenging because they require some 3d physics stuff, obviously a 3d battle system with somewhat realistic targeting and reactions, and from there it's necessary to have a sophisticated animation system with something like rag doll support.  I also reaally want to mess around with graphics and making things look cool and pretty!


Anyway, I'll be posting more code stuff soon, like a modified Vector2 class after the early somewhat naive version being critiqued by the Leander Hasty, lead programmer at 1st Playable Productions.  I plan on putting up a Matrix_4x4 implementation, in which I first learned and started using the c++ "union" feature, allowing me to store and access data in a way that works with DirectX and OpenGL, or however I wanted; though I have to make tweaks to it based off of the recommendations of Leander, and rename a few things here and there.  I also plan on writing a basic tutorial explaining rotation matrices and what they actually represent, as classes and books I have read had failed to explain them in an easy coherent way.

Oh, as a side note, I had a lot of fun the other night working on a threaded server to setup a basic protocol for a simulated game environment; I hadn't worked with threads before in C++, so I'm eager to add support for them in my 3D engine, Warp.  Also on that note, I'll be adding a lot more on this engine, and making a project page for it with helper classes for you to feel free to use in your own projects.  I'll also mention all the various books I've been reading, as well as the open source game engines I've looked at, to try to inspire my design to create a cross-platform 3d game engine.  So the basic idea for my Warp Engine: it's a game engine that abstracts the hardware and software API's so you can write a game that works across multiple platforms without having to change much; the way to do this is through the use of interfaces and components implemented by a platform by platform basis.  Oh, and another thing I would like to look into is adding support for processors with SIMD instructions so my Vector3 and Matrix4x4 class can be more efficient.  Basically, there are too many things I want to do and to learn!! (:

I could ramble on for almost forever, so feel free to leave any thoughts if you might have them!

[Edit: Checkout the improved Vector2 class here: improved Vector2 blog post.]

Hey, it's been a while since I've posted anything, and I've been wanting to share this Vector2 class that I have written. It started being developed less than a year ago, and has undergone some minor changes since then to try to improve efficiency and add functionality. I haven't touched it in a while since then, as I'm now working on a 3D game engine, but here is what I've got.

/*  __      __   ___     _____    ____
 *  \ \    / /  / _ \   |  __ \  |    |
 *   \ \/\/ /  / / \ \  | | / /  |  __|
 *    \_/\_/  /_/   \_\ |_| \_\  |_|
 *      Take it to the next Level
 *
 *  Copyright (c) 2009 Brian Ernst.
 */

#ifndef w_Vector2
#define w_Vector2

#include <math.h>

namespace _Warp
{
	typedef float Scalar;
	typedef int Bool;

	class Vector2
	{
	public:
		Scalar X;
		Scalar Y;

		Vector2(const Scalar x = 0,const Scalar y = 0);
		~Vector2();

		Vector2 operator+(const Vector2& pVector) const;
		Vector2 operator-(const Vector2& pVector) const;
		Vector2 operator*(const Scalar& num) const;
		Vector2 operator/(const Scalar& num) const;
		Vector2 operator*(const Vector2& vector) const;
		Vector2 operator/(const Vector2& vector) const;
		void operator+=(const Vector2& pVector);
		void operator-=(const Vector2& pVector);
		void operator*=(const Scalar& num);
		void operator/=(const Scalar& num);
		void operator=(const Vector2& pVector);
		Bool operator==(const Vector2& vector) const;
		Bool operator!=(const Vector2& vector) const;

		void Clamp(const Scalar& value);
		void Normalize(const Scalar& value = 1.0f);
		void Invert();

		Scalar Length() const;

		Vector2 Copy() const;

		static Vector2 Cartesian(const Scalar& x,const Scalar& y);
		static Vector2 Polar(const Scalar& radius,const Scalar& angle);
		static Scalar Dot(const Vector2& pVec1,const Vector2& pVec2);
		static Vector2 Rotate(const Vector2& pVec,const Scalar& angle);
		static const Vector2 Zero;
	};

	inline Vector2 Vector2::Copy() const
	{
		return Vector2(X,Y);
	}

	inline Bool Vector2::operator==(const Vector2& vector) const
	{
		return X == vector.X && Y == vector.Y;
	}

	inline Bool Vector2::operator!=(const Vector2& vector) const
	{
		return X != vector.X || Y != vector.Y;
	}

	inline Vector2 Vector2::operator+(const Vector2& pVector) const
	{
		return Vector2(X + pVector.X,Y + pVector.Y);
	}

	inline Vector2 Vector2::operator-(const Vector2& pVector) const
	{
		return Vector2(X - pVector.X,Y - pVector.Y);
	}

	inline Vector2 Vector2::operator*(const Scalar& num) const
	{
		return Vector2(X * num,Y * num);
	}

	inline Vector2 Vector2::operator/(const Scalar& num) const
	{
		return Vector2(X / num,Y / num);
	}

	inline Vector2 Vector2::operator*(const Vector2& vector) const
	{
		return Vector2(X * vector.X,Y * vector.Y);
	}

	inline Vector2 Vector2::operator/(const Vector2& vector) const
	{
		return Vector2(X / vector.X,Y / vector.Y);
	}
}

#endif

And yes, I realize I need to comment this class, and I will. I might include the source files, but you can just as easily click on the "Source" button on the top right corner of the code box. And here's the cpp definitions file for the Vector2 functions:

#include "Vector2.h"

namespace _Warp
{
	const Vector2 Vector2::Zero = Vector2();

	Vector2::Vector2(const Scalar x,const Scalar y)
	{
		X = x;
		Y = y;
	}

	Vector2::~Vector2()
	{
	}

	void Vector2::operator+=(const Vector2& pVector)
	{
		X += pVector.X;
		Y += pVector.Y;
	}

	void Vector2::operator-=(const Vector2& pVector)
	{
		X -= pVector.X;
		Y -= pVector.Y;
	}

	void Vector2::operator*=(const Scalar& num)
	{
		X *= num;
		Y *= num;
	}

	void Vector2::operator/=(const Scalar& num)
	{
		X /= num;
		Y /= num;
	}

	void Vector2::operator=(const Vector2& pVector)
	{
		X = pVector.X;
		Y = pVector.Y;
	}

	Scalar Vector2::Length() const
	{
		return sqrt(pow(X,2.0f) + pow(Y,2.0f));
	}

	void Vector2::Clamp(const Scalar& value)
	{
		if(Length() <= value)
			return;
		Normalize();
		*this *= value;
	}

	void Vector2::Normalize(const Scalar& value)
	{
		Scalar vecLength = Length();

		if(vecLength == 0)
			return;

		X = X/vecLength * value;
		Y = Y/vecLength * value;
	}

	void Vector2::Invert()
	{
		X *= -1;
		Y *= -1;
	}

	Vector2 Vector2::Polar(const Scalar& x,const Scalar& y)
	{
		Vector2 pVector = Vector2();
		pVector.X = atan2(y,x);
		pVector.Y = sqrt(x * x + y * y);
		return pVector;
	}

	Vector2 Vector2::Cartesian(const Scalar& radius,const Scalar& angle)
	{
		Vector2 pVector = Vector2();
		pVector.X = radius * cos(angle);
		pVector.Y = radius * sin(angle);
		return pVector;
	}

	Scalar Vector2::Dot(const Vector2& pVec1,const Vector2& pVec2)
	{
		return pVec1.X * pVec2.X + pVec1.Y * pVec2.Y;
	}

	Vector2 Vector2::Rotate(const Vector2& pVec,const Scalar& angle)
	{
		Scalar cosResult = cos(angle);
		Scalar sinResult = sin(angle);

		//Essentially, apply a 2x2 rotation matrix to the vector
		Scalar newX = pVec.X * cosResult - pVec.Y * sinResult;
		Scalar newY = pVec.X * sinResult + pVec.Y * cosResult;

		return Vector2(newX,newY);
	}
}

It's pretty simple, but quite useful and powerful I think. I put it up here for other people to use for quick reference; let me know what you think or just drop me a line telling me you're using it for something, that'd make my day. (:

So here's a zip file you can download: Vector2

[Disclaimer: This is an experimental post, I would not actually completely condone using this; heck, I'm not even using this. I'm using a queue based event system with reference counting smart pointers.]

For the sake of experimenting, and to make a new and "safer" Event, I found out I could call a protected function from outside of the scope of that class, from using a function pointer assigned by the parent class.  Certainly this doesn't sound safe, as it bypasses encapsulation measures; however, this allowed me to fire an event in a way only the parent could.


So I was trying to come up with an ideal Event for an EventSystem, and I had a couple ideas, though things bugged me in each.  So, this is a typical Event, which I do have a slight problem with:

 

class Event
{
public:

	void Attach(IEventObserver* eventObserver);
	void Detach(IEventObserver* eventObserver);

	void FireEvent(const EventArgs& eventArgs);
};

So, an IEventObserver can both register itself AND fire off an event; the IEventObserver shouldn't be able to fire the event it's registering to, should it? Only the parent that contains the Event should, in my belief. So I thought, is there any way I can allow the parent class to fire off the event and still allow the Event to be public?  Okay, I figured I could setup accessors to the event; however, this meant I'd have to setup an accessor for each and every single event I have, which could get ugly fast.

I eventually thought of a sneaky way, that actually shouldn't even be possible. Giving the parent class, what I call the trigger, a function pointer to a protected function that fires the event. After writing it, I realized while I liked the idea, everything about coding the use of the Event was a lot more difficult, so I provided macros to do the dirty work for you; however, it still seems like an annoying setup to me. I usually code things to be easy to interact with, and what I came up with clearly goes against my programming paradigms.

So, here's the tiny change in the Event:

class Event
{
protected:
	void FireEvent(const EventArgs& eventArgs);

public:

	void Attach(IEventObserver* eventObserver);
	void Detach(IEventObserver* eventObserver);
};

Obviously there isn't much of a difference here, there isn't much to add. The difference is here in the full version:

template <class IEventArgs>
class Event
{
	typedef std::list<IEventObserver<EventArgs>*> EList;
protected:
	EList _observers;

	void FireEvent(IEventArgs& eventArgs)
	{
		EList::iterator iter = _observers.begin();

		while(iter != _observers.end())
		{
			(*iter)->CatchEvent(eventArgs);
			++iter;
		}
	}

public:
	typedef void (Event<IEventArgs>::*IEventTrigger)(IEventArgs& eventArgs);//use an event trigger mechanism

	Event(EventTrigger& trigger)
	{
		trigger = &Event::FireEvent;
	}

	virtual ~Event()
	{
	}

	void Attach(IEventObserver<IEventArgs>* eventObserver)
	{
		_observers.push_back(eventObserver);
	}

	void Detach(IEventObserver<IEventArgs>* eventObserver)
	{
		_observers.remove(eventObserver);
	}
};

Note the EventTrigger; to create an Event you have to pass in a reference to a function pointer. Here are the three Macros I have at the top of my Event.h file (they looked ugly and hard to read inside of the code block, so here they are in a pre tag):

#define EVENT_H(variable,argType) Event::EventTrigger trigger##variable; Event* variable;
#define EVENT_CPP(variable,argType) trigger##variable = NULL; variable = new Event(trigger##variable);
#define EVENT_FIRE(variable,args) ((variable)->*(trigger##variable))(args);

You place a macro call to EVENT_H inside of the .h file, a call to EVENT_CPP in the .cpp file where the event is being constructed, and EVENT_FIRE when you want to fire the event (though, EVENT_H and EVENT_CPP are actually more annoying to use than just setting up the Event by hand, so I'll probably remove those two macros, as they don't actually help at all).

So, ignoring the macros, lets say I want to create an event, I can do this.

Event::EventTrigger keyTrigger= NULL;
Event* keyEvent = new Event(keyTrigger);

This will create an Event for me to use as well as hook up a trigger to fire the event. When I finally want to fire the event I can do something like this;

(keyEvent->*(keyTrigger))(KeyEvent(FK_F11));//this event and argument are just for example

So, this system is what I came up with, though I'm still not so sure if I like it.  I'd love to get any comments or suggestions for a better system.  Even if I don't use this setup, I still found this process to be an interesting learning experience.  I just wanted to find out if I could get access to a protected function using a function pointer; I found out I could, and I find that intriguing.  For clarification, the Event in the above example would be public, and the trigger protected (or private); so I have to update my macro EVENT_H to include those overrides.  I'll provide the source code in a couple days or so when I get everything properly packaged together; right now the code is sitting inside of my engine, and are tied into various systems, so the source files won't compile for you without modification (because I can't include all of the other misc. files).  So, this still isn't a lot nicer than the other solution; it's merely replacing an accessor with a trigger.  So, either way it's kind of ugly I think, to ensure safe firing of an event.

Anyway, I haven't touched Event Systems in more than a couple weeks, it's something I'll have to worry about very shortly; so when I revisit them, I'll probably make a blog post concerning my more finalized systems with what I finally decide to use.  Any feedback would be greatly appreciated. Thanks!

I apologize if the post jumps around a bit, it is very late as I type this.

At the moment I'm in a turning point in my life, almost ready to graduate from college, and trying to figure out what I'm going to do with my life.  I find myself with an internal confrontation.  I've been spending much of my life worrying about school, spending lots of time working on school work, not so much time hanging out and having fun with friends.  This hasn't been a problem: I've been doing good, got into the schools I wanted to get into.  I've made good decisions for the most part, as far as my long term goals, it seems.

So, let me tell you some of the new stuff I have to worry about (though if you've been in college, some of this shouldn't be anything new).

  1. Worry about applying to Grad Schools
  2. Worry about requirements for Grad Schools, including taking the GRE Exams if any of the schools I want to go to, require them.
  3. Get the transcript for my summer courses, taken at a community college, sent to my school, and hope they transfer.  Otherwise I can't graduate early.
  4. Worry about getting my summer programming project work on Upwards passed as co-op credit. If I can't, then I HAVE to make sure I get my summer courses transferred, so I can work on a Spring Co-op.
  5. I NEED to learn a lot of things in my own time, as I wasn't as productive for the last year as I would've liked to be (due to personal issues).  This creates problems where I feel awkward with my social situation:
  6. I don't have a strong urge to hang out with my friends atm, I'm perfectly satisfied chilling at home, listening to music, programming away, and getting my schoolwork done.  I don't know what to make of it, whether it's laziness, wanting to use school, my future, and personal progress as an excuse.  I know if I had someone close, like a gf, that would give me reason to go out and do things; as I've found out, on my own, I don't tend to feel as inspired for variety and doing new things on my own.  I need a little push, I guess.  I want to try to find some friends I can grow close to, either trying to strengthen existing relationships, or find new ones.  Also, I should be finding new friends to hang out with where I am, not just online.  Because I'm inside working on my stuff, I find it easy to stay in touch with my friends from afar, while neglecting the ones who are here (as I'm busy with work).

And that pretty much sums it up, the last point being most of the personal conflict of me being unsure of what I want to do.  I really, really want to get into this one graduate school in Texas, and I feel I need to step up my game and get things done to do that (which means sacrificing the social time).  My plan of attack socially, was to join the tennis club, and meet people who are enthusiastic about tennis so I can play on a regular basis (and probably find a girl there to encourage me to go out and do things more).  Ugh, don't get me started on girls.  But let me share this comic I just found recently, which takes a load off of my mind:

[caption id="" align="aligncenter" width="800" caption="When A Guy Does Something Wrong"]When A Guy Does Something Wrong[/caption]

Remember when I mentioned personal issues? Yeaah.  *cough* a girl *cough* So I tend to think a lot, analyzing things, sometimes looking for things that aren't there.  I'm a person who likes to question things (which is also why I don't have a firm belief in God, and consider myself an agnostic atm, among other things, like questioning laws and government decisions).  But don't worry, I'm not thaat bad, I don't typically like looking for things that aren't there, which is why I typically look down on English classes; I hate when they analyze things that the author probably never intended.  Oh, so one thing I figured out is that I have no idea how to approach girls.  There is this girl I like living not far from me on campus, she's cute, and is pretty awesome; I just don't have a class with her anymore, and she has alll sorts of guy friends she hangs out with already anyway.  And because of all of the stuff I have to worry about, there's no way I'm going to be in the top of my game, especially if I want to try to be humorous.  So yeah, don't have any idea how to approach her to just hang out or something; though I'm sure I'm worrying about it more than I should.  And a topic for another post perhaps, love, and that other girl I haven't gotten over.

Anyyway, perhaps this is too much of a rant for a blog site, and is better meant for a journal.  So, I'm open to new friends, and don't consider myself a pessimist in the least, despite what you may think from reading this post. So don't even think I am!!  Ever!  My aim sn is: optimisticSorrow, for I am neither always completely optimistic or pessimistic, I am somewhere in between.

*nods* Soo college, yeaah. Life. Yeaah, dude.  Totally. Okay, I have reading to do, work to do.  Just needed to rant, since all of this has been running through my head while I've been trying to do this dry reading.  Drop me a line, and I'll have more contact information up here in the future!

Archive