Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

1080 Excellent

About Driv3MeFar

  • Rank
  1. Driv3MeFar

    New project, new goals

    I missed your two earlier journal entries the first time around, so I'm a little late to the party. Welcome back to the world of games, 'grats on the new gig!
  2. Driv3MeFar

    MVP Summit time!

    Quote:Original post by jollyjeffers Whilst my employer is taking a royal beating in the stock market (in the 10 months I've worked there, its shed ~85% of its value) It could be worse.
  3. Driv3MeFar


    Computer games are made up of thousands of computer codes!
  4. Driv3MeFar

    The Return of Man vs. The MMORPG

    'Grats on the publication. I'll check it out, so that's one sale at least [grin].
  5. Driv3MeFar

    Baby Steps

    Holy crap, an update! I haven't had much to say lately because work has been draining my urge to work on personal projects, but I have a few things in the works that may or may not see the light of day. So, the subject of today's entry is multithreading. Multithreading is no longer the wave of the future, it's here and it's not going away. As such, I figured I should learn a thing or two about it. This is something I've wanted to do for a while, but have been terribly lazy about. And, you know, it's very relevant to work, so that's a plus. That all said, I spent an hour tonight hammering out a very basic introduction for myself into the world of threading. Nothing terribly special, it's just one thread writing to a queue while another reads from it. I'll let the code speak for itself, critique it as you will. Mutex.h #ifndef MUTEX_H #define MUTEX_H #include #define LOCK(hLock, timeout) { thread::Mutex _lock(hLock, timeout); #define SAFE_LOCK(hLock, timeout) try { thread::Mutex _lock(hLock, timeout); #define UNLOCK } typedef void* HANDLE; namespace thread { class WaitAbandonedException : public std::exception { public: WaitAbandonedException() throw() {} WaitAbandonedException(const WaitAbandonedException& rhs) throw() {} WaitAbandonedException& operator=(const WaitAbandonedException& rhs) throw() {} virtual ~WaitAbandonedException() throw() {} virtual const char *what() const throw() {return "Wait Abandoned";} }; class WaitTimeoutException : public std::exception { public: WaitTimeoutException() throw() {} WaitTimeoutException(const WaitTimeoutException& rhs) throw() {} WaitTimeoutException& operator=(const WaitTimeoutException& rhs) throw() {} virtual ~WaitTimeoutException() throw() {} virtual const char *what() const throw() {return "Wait Timeout";} }; class Mutex { public: Mutex( HANDLE hLock, DWORD timeout); Mutex( const Mutex& copy ); Mutex &operator=(const Mutex &rhs); ~Mutex(); bool Locked() {return m_IsLocked;} private: HANDLE m_Lock; //mutable locked state because it will be changed on copy and assignment when ownership is passed mutable bool m_IsLocked; }; } #endif Mutex.cpp #include #include "Mutex.h" thread::Mutex::Mutex( HANDLE hLock, DWORD timeout ) : m_Lock(hLock), m_IsLocked(false) { //aquire lock on construction DWORD Ret = WaitForSingleObject(m_Lock, timeout); switch (Ret) { case WAIT_OBJECT_0: m_IsLocked = true; break; case WAIT_ABANDONED: throw *(new thread::WaitAbandonedException); break; case WAIT_TIMEOUT: throw *(new thread::WaitTimeoutException); break; default: //unkown error, just bail throw; break; } } thread::Mutex::Mutex(const thread::Mutex& copy) { *this = copy; } thread::Mutex& thread::Mutex::operator=(const thread::Mutex &rhs) { //release any existing lock if (m_IsLocked) { ReleaseMutex(m_Lock); } m_Lock = rhs.m_Lock; m_IsLocked = rhs.m_IsLocked; //take ownership of copied mutex rhs.m_IsLocked = false; return *this; } thread::Mutex::~Mutex() { if (m_IsLocked) { ReleaseMutex(m_Lock); } } thread.h #ifndef THREAD_H #define THREAD_H #include extern HANDLE g_Mutex; namespace thread { DWORD WINAPI Func(LPVOID lParam); } #endif thread.cpp #include "thread.h" #include "Mutex.h" #include #include #include extern std::queue g_Queue; DWORD WINAPI thread::Func(LPVOID /*lParam*/) { while(TRUE) { SAFE_LOCK(g_Mutex, INFINITE) while (!g_Queue.empty()) { if (g_Queue.front() == -1) { return TRUE; } std::cout 'Til next time!
  6. Driv3MeFar


    Quote:Original post by EasilyConfused I'm a 33 year old man typing out a game programming journal while listening to Toxicity by System Of A Down. Something somewhere is very wrong. The only problem there is the conclusion.
  7. Driv3MeFar


    Making games would be great if it weren't for the people that played them. For real. Disclaimer: Making games is great. And I know that most gamers (around here at least) aren't a bunch of 13 year old fan boy douche bags. But come on. Really.
  8. Driv3MeFar

    Weekly Sitrep

    Quote:Original post by Gaiiden Now then, I will direct your attention to this thread in the Lounge. I can't say exactly why yet, but rest assured there is indeed significance in my directing you thusly. We don't have much of a rumor mill around here so I like stirring the pot every now and then [smile] If you want even more hints, then Mark "Prinz Eugn" Simpson will oblige you. Hmmm...?
  9. Driv3MeFar


    Graduation was today. I still have a few summer classes before I'm officially done, and have been working for a year, so it doesn't mean much to me. Parents enjoyed it, I guess. I leave on vacation tomorrow. I'll be in New Zealand for two weeks. We're going kayaking, glacier hiking, and just exploring the southern island. Should be a blast, I can't wait. Should also be a really damn long plane ride. The most important news of late is that I got a new car on Friday. At the start of my sophomore year I leased a Mazda3, and the lease just expired. I loved that car. So much, in fact, that I just bought a brand new 2008 Mazda 3s. I got the 5-door model (which has a slightly bigger engine than my old 4-door 3i), which so far has been great. The biggest change for me is that I got a manual transmission on my new car. I've driven a manual once before, when I was like 15 and learning how to drive, for all of 20 minutes. So, the day I got it there were many stalls and lots of rolling down hills. Since I've been driving my parents around all weekend (they were in town for graduation), I'm starting to feel pretty comfortable with it now. Steep hills still scare me, though. So, that's it. See you in two weeks, Gamedev.
  10. Driv3MeFar

    I got a job, version 2

    Thanks everyone! Quote:Original post by Gaiiden Man I can still remember back to when you first showed up around here... how far you've come [smile] No kidding. I've certainly learned a ton from the community here, hopefully I'll have lots of cool stuff to share in the future.
  11. Driv3MeFar

    I got a job, version 2

    Today I accepted a full time position at the studio I'm currently an intern at. I've known they were going to offer me a job for more than a month now, but that doesn't make it any less satisfying. My official title will be Associate Systems Engineer, which means I'll be doing mostly what I do now (tools development), plus I'll be taking on some more engine-side features, which is pretty much exactly what I wanted. Any way, I'm very happy [grin]. Graduation is Sunday. I'm walking at the ceremony, but technically I still have a few summer classes to take to finish up my degree. And I go on vacation on Monday. It's a good week.
  12. Driv3MeFar


    One of the guys at work just wrote a new tool that cut a full Win32 build from ~45 minutes to under 10. He's my new hero. I haven't been journaling lately because I've been crazy busy. The school semester ends in a week and a half, which means its crunch time for final projects. We've been busy at work lately, with two milestones due this week, as if school wasn't enough. Exciting (for me) news on the work front, though. As of May 1st, my internship is over, I'll be starting full time [grin]. I've been with the studio for a year now, and it's a great place to work. Very happy I've gotten the chance to work there full time, hopefully I won't make too big a hash of it all [wink].
  13. Driv3MeFar

    Rock Band FTW

    Still Alive, Rock Band DLC, free.
  14. Driv3MeFar

    Seattle Opera

    This thread has reminded me that next year the Seattle Opera will be performing the Ring cycle. If you're interested, tickets for the general public are on sale on the web November 12th (so, this is a bit early, but I'm rather excited). If this sort of thing appeals to you, consider yourself warned: tickets tend to sell rather quickly. I'll be there, unless something unexpected crops up.
  15. Driv3MeFar

    I maek gaem!

    I could have, but didn't for two reasons: 1) The current behavior matches specs we were given. 2) Honestly, I couldn't be bothered to [wink].
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!