Jump to content

  • Log In with Google      Sign In   
  • Create Account


Need to change code copied from a tutorial


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
7 replies to this topic

#1 shaqb4   Members   -  Reputation: 468

Like
0Likes
Like

Posted 18 April 2013 - 03:58 PM

A few weeks ago, I finished  a pong clone with SDL and planned on putting it up on github. Some of my code is taken directly from the Lazyfoo tutorials found at http://lazyfoo.net/SDL_tutorials/index.php.

 

Specifically, I used the Timer class taught on the following page, as well as the apply_surface functions found in the first few starting tutorials.

http://lazyfoo.net/SDL_tutorials/lesson13/index.php

 

In his FAQ he states 

 

Q: Can I use your code to make a game?

"Q: Can I use your code to make a game?
 
A: Basically my rules are:
1) If you're using it for a closed source program, go nuts.
2) If you're using it for an open source program, please cite the chunks of code you used with something like:
 
/*This piece of code was originally from Lazy Foo' Productions
 
3) I you're using it for a GPL, LGPL or other such program which gives public rights to the code, I'm going to have to say no.
4) If you're using it for a tutorial, you're going to have to use your own original code."
 
 
You still need contact me and show me specifically the code you plan to use and what you're going to do with it so I can approve."
 
 
 
 
I contacted him, but after a few weeks there hasn't been a reply. So my question is what should I do now? As far as I can tell, my options are to either wait for a response or change the code. I can't think what I could change in the Timer class, though. It's pretty straight forward, with start, stop, pause etc. I assume just changing the variable names wouldn't count as making it my own?
 
Any recommendations for how I could make the code my own would be appreciated. (such as other ways to implement a Timer). 

Edited by shaqb4, 18 April 2013 - 04:54 PM.


Sponsor:

#2 Indifferent   Members   -  Reputation: 559

Like
0Likes
Like

Posted 18 April 2013 - 04:06 PM

Others may disagree but I'd just go ahead and credit the code at the top of the file, providing a link to the tutorial. You've made an effort to contact him and waited a more than reasonable amount of time for a response.

 

It's such basic code that any rearrangement is likely going to be largely superficial.



#3 Khatharr   Crossbones+   -  Reputation: 2768

Like
0Likes
Like

Posted 18 April 2013 - 09:19 PM

Or just scrub it and rewrite it. The purpose of a tutorial isn't to give you a source of usable code. That's what libraries are for. Make sure you understand the subject matter, then get rid of what you have and write it over from scratch. Then you won't have to deal with it.


void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#4 Ludus   Members   -  Reputation: 928

Like
0Likes
Like

Posted 18 April 2013 - 10:23 PM

It's such basic code that any rearrangement is likely going to be largely superficial.

 

While this may be true, you're forgetting something that's very important. When you take code you found online and use it for your project, you should always reformat it to fit in with the rest of your code. Everything from naming conventions, use of white space, layout, and even the way the functionality of how the code works, all of it should be in line with the rest of your code. Cohesiveness is a virtue.

 

If you just copy-paste code from a bunch of different sources, you end up with what's known as Frankenstein code, in which case it'll be an incomprehensible, disorganized mess in which nothing is consistent.


Edited by Ludus, 18 April 2013 - 10:40 PM.


#5 Indifferent   Members   -  Reputation: 559

Like
0Likes
Like

Posted 18 April 2013 - 11:32 PM

My point was that a slight bit of reformatting won't really get around the fact that it's copy/pasted tutorial code.

 

Ultimately, it's a Pong clone to help him understand the basics of game programming and there's nothing wrong with following along with and using code from a tutorial if that's what you're comfortable with. It's just my opinion that having him go back for the sake of it isn't a productive use of his time.



#6 tp9   Members   -  Reputation: 410

Like
0Likes
Like

Posted 19 April 2013 - 02:27 AM

Or he can just follow the instructions:

 

"If you're using it for a closed source program, go nuts."

 

Since it's a throw-away program he can just keep it closed source and not put it on GitHub and move on to his next game.



#7 shaqb4   Members   -  Reputation: 468

Like
0Likes
Like

Posted 19 April 2013 - 01:41 PM

Thanks for the replies, everybody. :)

Since it's a throw-away program he can just keep it closed source and not put it on GitHub and move on to his next game.

 

I'd like to put it on github because one.) I figure being able to use github would be a useful skill and 2.) It would make it easier to get feedback on my code.

 

Also, my next game will probably need a timer also, so I might as well change the code now. The problem I'm having is that I don't know what I could change. I could get rid of some  member functions, change names, etc. I looked up other implementations for a Timer class, but they were mostly just slight variations of the one I have now. Any suggestions? (I'm not trying to ask you to change the code for me, I just want ideas for what I could change).



#8 tp9   Members   -  Reputation: 410

Like
0Likes
Like

Posted 19 April 2013 - 02:05 PM

What I would do is post it on your GitHub and send the guy the link to it and let him decide. As long as you're not making money off of it I wouldn't think he'd have a problem with it.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS