Thread: So... Spent another year or so without a computer.

  1. #1
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968

    So... Spent another year or so without a computer.

    Lost my pong code, just like I lost my blackjack code, just like I lost my renderer code.

    So far I've lost like 50,000 lines of code total over the past 3 or 4 years.

    It's starting to annoy me, but I'm here to let you all know I'm getting ready to get back into the groove again! I just bought a new laptop, and this thing isn't going anywhere until it refuses to turn on anymore, which shouldn't be any time in the near future.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  2. #2
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Long time no see Shamino Yeah, that used to be a problem for me until I started using an external HDD for projects. I always had unreliable HDD's (I don't use laptops for anything but documents, but my friend has the same problems). Why don't you keep an repository online? It's great not only for backing up source code, working with a team, looking up old changes, but also modern ones allow you to easily branch and merge forks, even to just test one feature. I recently started doing this, and I'll probably do it my entire life. I'm using GitHub, but it was a tough choice between BitBucket and Gitorious and Launchpad. Of course, there's always Google Code. There's even free private hosts (but most good ones have a monthly fee, since open source is encouraged). It's really only a few hours from not knowing what Git is, to learning enough to use it quickly and easily, at least on Linux (Ubuntu for me).

    Good luck with the new laptop!
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  3. #3
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    GOOD NEWS!!!

    I believe that I've found enough of my source code scattered across the internet and web forums to hack this thing back together!

    WE CAN REBUILD IT! WE CAN MAKE IT STRONGER!

    I just spent the last two hours updating this cpp file and rolling back that one, and now they are nicely meeting in the middle ground. It's not nearly as compact and, well perfect if you ask me, as it was when I was satisfied with it. Nah j/k I know it wasn't perfect, I just felt more accomplished over that silly pong game than any other project I worked on.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Burn your source to CD/DVD frequently. I've started making a habit of it and haven't lost anything recently.

  5. #5
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    I will definitely make a point of doing that now that I got a CD burner on this thing. Turns out I found enough material lying around this forum as well as gamedev to get something compiled! I've got quite a bit of material here. I should have another working copy of pong in a week or so, considering I can stand to program after I come home from work, I sure hope so. I'm able to check the ball against the paddles as well as the borders which are nothing but planes, that uses a different collision method aside from AABB.

    What I don't have is a beautifully encapsulated little pong engine. Which is what I was very close to getting to before I lost my PC. I used to call update for the game class, and from there on nothing but a series of update calls would be looped through until someone lost, I was so proud of it.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  6. #6
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Quote Originally Posted by Bubba View Post
    Burn your source to CD/DVD frequently. I've started making a habit of it and haven't lost anything recently.
    Burning your source to CD/DVD seems so.. primitive, especially for someone like yourself. I have to ask, what's the reasoning behind that? Why don't you just rar it and host it online (plenty of free hosts)? Or use a source repository? Or backup to a usb flash pendrive (rewritable)? Or backup to an external HDD? Or use an online backup service?
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  7. #7
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    I might have to agree with Bubba, I think I'd feel more comfortable with some kind of physical media, as opposed to virtual storage, or digital. You can bring it to a friends house and be like hey check this out, and just pop the CD in.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  8. #8
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I do both: I manually take a periodic backup of my files to CD/DVD (I do not have some fancy automated external hard disk drive backup system), in addition to using version control repositories online. So, if my house gets destroyed I still have my stuff online, and if the online systems go bust I still have my stuff on CD/DVD. Hopefully all three events (computer spoilt, CD/DVD unusable, and online systems gone) never happen simultaneously
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  9. #9
    Deprecated Dae's Avatar
    Join Date
    Oct 2004
    Location
    Canada
    Posts
    1,034
    Doing both makes sense, even though any decent online system almost certainly won't go bust, it doesn't hurt to have backups of backups. I just don't see where CD and only CD trump any of the methods listed above. Maybe as a last precaution.

    Quote Originally Posted by Shamino View Post
    I might have to agree with Bubba, I think I'd feel more comfortable with some kind of physical media, as opposed to virtual storage, or digital. You can bring it to a friends house and be like hey check this out, and just pop the CD in.
    USB pendrives and harddrives are physical.
    Warning: Have doubt in anything I post.

    GCC 4.5, Boost 1.40, Code::Blocks 8.02, Ubuntu 9.10 010001000110000101100101

  10. #10
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    I lost all of my oldest code, along with some newer stuff, in one of my computers during the move (static electricity seems to have zapped it). Fortunately, I have an almost neurotic habit of reviewing/refining my code, so I can reproduce most of it by rote - in fact, just yesterday I (mostly) finished the reimplemention of my big-integer library, which only took a day and a half to write and debug around 1500 lines of code. So, yay for neurosis. Anyway, yes, I've learned to be more diligent about backing up my files, although I hadn't thought to put any of it online (a very good idea, actually).

  11. #11
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    In all actuality if an event were to occur that caused me to lose my CD/DVD's such as a house fire the least bit of my worries at that point would be how much code I've lost.

    But I agree with Sebastiani in that I can produce most of the code I've written from memory. I also remember some of the gotchas involved while programming it. Often my second version is far more robust than the first so it's not all bad that I re-write and re-factor my code at times.

    Example:
    I just found a huge bug with my camera class related to floating point round off. The farther the object get's from world 0.0f,0.0f,0.0f the shakier the position of the object becomes. This is b/c one frame the round-off rounds to a different float than in other frames. The end result looks like your spaceship is behind the big asteroid on Armageddon and the thing is shaking all over the place. Cool effect but not exactly what I wanted. Now that I know this happens and really affects games that utilize large distances from the world origin I can re-factor and fix it. The solution of course is to keep the camera at the origin and make everything else relative to it. It sounds odd but it does work.
    The version on my CD/DVD's has the bug so if I were to 'plug that version in' to code later I would be in for a surprise and an ah-ha moment when the thing started shaking.

  12. #12
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,195
    I feel your pain, I lost 2 years of my life about 6 months or so ago when a friend knocked my external HDD off the table. It WAS my backup, I just hadn't replaced the internal drive that had crashed earlier that week. Every now and then I need something that was on that drive that I haven't rewritten yet, and I cringe. I still haven't managed to completely rebuilt my camera class, I probably never will, there were just so many automated features I had put in it when I was working heavily with DirectShow and I don't know if I have the intestinal fortitude to start digging back into DS.

    I keep everything on USB drives now, and I keep triple redundant backups. One that I use daily, I make a weekly backup to my cell phone's microSD card (1GB), and once a month I back up my cell phone at my brothers house. The cell phone stays by my bed when I sleep so a house fire wouldn't make me lose more than a few days of code unless it killed me, and then my daughter would still have everything that was at my brothers.
    Last edited by abachler; 11-29-2009 at 02:27 PM.

  13. #13
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    May have a second working copy of pong by the end of tomorrow night!
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  14. #14
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    Got my collision detection working!

    Now all I have left to do is centralize the rendering process and take the draw functions out of the ball and paddle classes!

    Code:
    void Logic::check_collision()
    { 
    if(ball->getVelocity().x > 0)
    		{
    			if (collision2d(ball->getMinimum(), ball->getMaximum(), player2->paddle->getMinimum(), player2->paddle->getMaximum()))
    			{
    				reverse_x_velocity(ball->getVelocity());
    			}
    			else if(planeCollision2d(right, ball->getLocation()))
    			{
    				reverse_x_velocity(ball->getVelocity());
    				ball->getLocation().x = 0;
    				ball->getLocation().y = 0;
    				player1->goal();
    			}
    		}
    		if(ball->getVelocity().x < 0)
    		{
    
    			if (collision2d(ball->getMinimum(), ball->getMaximum(), player1->paddle->getMinimum(), player1->paddle->getMaximum()))
    			{
    				reverse_x_velocity(ball->getVelocity());
    			}
    			else if(planeCollision2d(left, ball->getLocation()))
    			{
    				reverse_x_velocity(ball->getVelocity());
    				ball->getLocation().x = 0;
    				ball->getLocation().y = 0;
    				player2->goal();
    			}
    		}
    		if(ball->getVelocity().y > 0)
    		{
    			if (planeCollision2d(top, ball->getLocation()))
    			{
    				reverse_y_velocity(ball->getVelocity());
    			}
    		}
    		if(ball->getVelocity().y < 0)
    		{
    			if (planeCollision2d(bottom, ball->getLocation()))
    			{
    				reverse_y_velocity(ball->getVelocity());
    			}
    		}
    	}
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  15. #15
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    Quote Originally Posted by Shamino View Post
    Got my collision detection working!

    Now all I have left to do is centralize the rendering process and take the draw functions out of the ball and paddle classes!

    Code:
    void Logic::check_collision()
    { 
    if(ball->getVelocity().x > 0)
    		{
    			if (collision2d(ball->getMinimum(), ball->getMaximum(), player2->paddle->getMinimum(), player2->paddle->getMaximum()))
    			{
    				reverse_x_velocity(ball->getVelocity());
    			}
    			else if(planeCollision2d(right, ball->getLocation()))
    			{
    				reverse_x_velocity(ball->getVelocity());
    				ball->getLocation().x = 0;
    				ball->getLocation().y = 0;
    				player1->goal();
    			}
    		}
    		if(ball->getVelocity().x < 0)
    		{
    
    			if (collision2d(ball->getMinimum(), ball->getMaximum(), player1->paddle->getMinimum(), player1->paddle->getMaximum()))
    			{
    				reverse_x_velocity(ball->getVelocity());
    			}
    			else if(planeCollision2d(left, ball->getLocation()))
    			{
    				reverse_x_velocity(ball->getVelocity());
    				ball->getLocation().x = 0;
    				ball->getLocation().y = 0;
    				player2->goal();
    			}
    		}
    		if(ball->getVelocity().y > 0)
    		{
    			if (planeCollision2d(top, ball->getLocation()))
    			{
    				reverse_y_velocity(ball->getVelocity());
    			}
    		}
    		if(ball->getVelocity().y < 0)
    		{
    			if (planeCollision2d(bottom, ball->getLocation()))
    			{
    				reverse_y_velocity(ball->getVelocity());
    			}
    		}
    	}
    One thing comes to mind, I need to rename planeCollision2d to like planeIntersection2d.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Constructive criticism/suggestions
    By LineOFire in forum C Programming
    Replies: 11
    Last Post: 09-30-2006, 09:32 AM
  2. Help with leap year program.
    By IxTanGxI in forum C Programming
    Replies: 8
    Last Post: 02-20-2006, 08:49 PM
  3. Major Computer Problem
    By Olidivera in forum Tech Board
    Replies: 10
    Last Post: 07-15-2005, 11:15 AM
  4. My New Computer?
    By Speedy5 in forum A Brief History of Cprogramming.com
    Replies: 24
    Last Post: 04-22-2003, 08:33 PM
  5. Help Me Out!! Pls
    By Joanna in forum C++ Programming
    Replies: 5
    Last Post: 10-27-2001, 05:08 AM