Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualBrother Bob

Posted 22 July 2013 - 12:08 PM

//--------------------------------------------------------------------------------------------------------------------------------------- //draw ship_01 DrawShip(ship_01_POSITION_X, ship_01_POSITION_Y, ship_01_POSITION_Z, ship_01_ROTATION, ship_01_COLOR); //--------------------------------------------------------------------------------------------------------------------------------------- //draw ship_02 DrawShip(ship_02_POSITION_X, ship_02_POSITION_Y, ship_02_POSITION_Z, ship_02_ROTATION, ship_02_COLOR); //---------------------------------------------------------------------------------------------------------------------------------------

 

 

How this is written gives you two ships!  In fact, now you can make a 100 ships to fight each other and for those 100 ships there would only be 100 lines of code in the Render loop, at least for the draw calls anyways.  When you do it this way, it's as if the compiler is copying and pasting all the code for you and setting them all to the proper positions.   Doing things this way not only condenses your code and makes it easier to read but it helps to keep errors at bay since you have hundreds or even thousands of fewer lines of code to look at and deal with, and you won't be introducing errors and frustration by hand typing and adjusting them all.

 

Let's think about what the asteroids might look like, both with a function to draw them all and without a function to draw them all.  If we set up the asteroid draw, position, rotate, and scale calls in a function just like for the ships above

 

For 50 asteroids there would be, so far, 50 lines of code, there will be more code than that for logic and other stuff but that will be true either way.  For now let's say that we can draw 50 asteroids with 50 lines of code.

//-----------------------------------------------------------------------------------------------------------------

Now for 50 asteroids that each have been drawn manually, with about 15 lines of code required every time.  You would then have 15 * 50 = 750.  If you do it your way then there will be 750 lines of code vs. 50 lines of code!  There will be an extra 700 lines of code and you will have to define all the individual positions for each one, that would be horrible especially since it was work that did not even need to be done.  This would set most people back a month at least, and it would be a really tedious painful month

 

//====================================================================================================

 

 

 

void draw_ship() {

 

Maybe some of the confusion here is coming from your  render loop name, you've called your render loop: draw_ship.  You absolutely, positivity, without any doubt have to change this right now before anymore confusion here sets in because of this!   When I wrote that you should make a DrawShip function for drawing your ships you likely thought that I was talking about making that the render loop.  You see how the name choice for your render loop has already wreaked so much havoc on this conversation?

 

By calling your render loop "draw_ship" you are making it seem as if you are only using it to draw ships, yet it is drawing ships, and bullets, and asteroids, and whatever else.  You should call it just about anything else but draw_ship.  You can call it Render() or Draw_Scene() or Do_stuff() or Party_Time() or Go_Get_Em() ! 

Just please don't use draw_ship, this name that you've given your Render function is too specific to what only a small part of what the render loop will be doing. 

 

Imagine if you called your render loop, shoot_bullets(), It doesn't just shoot bullets, it does a whole bunch of other things as well.  It's just too confusing to do it that way. 

Ya see?


#3marcClintDion

Posted 22 July 2013 - 03:10 AM

There is far too much arrogance and out right abuse by site moderators, they are teaching other people to behave this way.  The posts I've made will all be shorty removed and replaced with this notice.  Game development is not the only thing being taught here, bad behavior is being taught as well.


#2marcClintDion

Posted 30 June 2013 - 05:41 PM


//---------------------------------------------------------------------------------------------------------------------------------------

//draw ship_01

DrawShip(ship_01_POSITION_X, ship_01_POSITION_Y, ship_01_POSITION_Z, ship_01_ROTATION, ship_01_COLOR);

//---------------------------------------------------------------------------------------------------------------------------------------

//draw ship_02

DrawShip(ship_02_POSITION_X, ship_02_POSITION_Y, ship_02_POSITION_Z, ship_02_ROTATION, ship_02_COLOR);

//---------------------------------------------------------------------------------------------------------------------------------------

 

 

How this is written gives you two ships!  In fact, now you can make a 100 ships to fight each other and for those 100 ships there would only be 100 lines of code in the Render loop, at least for the draw calls anyways.  When you do it this way, it's as if the compiler is copying and pasting all the code for you and setting them all to the proper positions.   Doing things this way not only condenses your code and makes it easier to read but it helps to keep errors at bay since you have hundreds or even thousands of fewer lines of code to look at and deal with, and you won't be introducing errors and frustration by hand typing and adjusting them all.

 

Let's think about what the asteroids might look like, both with a function to draw them all and without a function to draw them all.  If we set up the asteroid draw, position, rotate, and scale calls in a function just like for the ships above

 

For 50 asteroids there would be, so far, 50 lines of code, there will be more code than that for logic and other stuff but that will be true either way.  For now let's say that we can draw 50 asteroids with 50 lines of code.

//-----------------------------------------------------------------------------------------------------------------

Now for 50 asteroids that each have been drawn manually, with about 15 lines of code required every time.  You would then have 15 * 50 = 750.  If you do it your way then there will be 750 lines of code vs. 50 lines of code!  There will be an extra 700 lines of code and you will have to define all the individual positions for each one, that would be horrible especially since it was work that did not even need to be done.  This would set most people back a month at least, and it would be a really tedious painful month

 

//====================================================================================================

 

 

 


void draw_ship() {

 

Maybe some of the confusion here is coming from your  render loop name, you've called your render loop: draw_ship.  You absolutely, positivity, without any doubt have to change this right now before anymore confusion here sets in because of this!   When I wrote that you should make a DrawShip function for drawing your ships you likely thought that I was talking about making that the render loop.  You see how the name choice for your render loop has already wreaked so much havoc on this conversation?

 

By calling your render loop "draw_ship" you are making it seem as if you are only using it to draw ships, yet it is drawing ships, and bullets, and asteroids, and whatever else.  You should call it just about anything else but draw_ship.  You can call it Render() or Draw_Scene() or Do_stuff() or Party_Time() or Go_Get_Em() ! 

Just please don't use draw_ship, this name that you've given your Render function is too specific to what only a small part of what the render loop will be doing. 

 

Imagine if you called your render loop, shoot_bullets(), It doesn't just shoot bullets, it does a whole bunch of other things as well.  It's just too confusing to do it that way. 

Ya see?


#1marcClintDion

Posted 30 June 2013 - 09:01 AM


//---------------------------------------------------------------------------------------------------------------------------------------

//draw ship_01

DrawShip(ship_01_POSITION_X, ship_01_POSITION_Y, ship_01_POSITION_Z, ship_01_ROTATION, ship_01_COLOR);

//---------------------------------------------------------------------------------------------------------------------------------------

//draw ship_02

DrawShip(ship_02_POSITION_X, ship_02_POSITION_Y, ship_02_POSITION_Z, ship_02_ROTATION, ship_02_COLOR);

//---------------------------------------------------------------------------------------------------------------------------------------

 

 

How this is written gives you two ships!  In fact, now you can make a 100 ships to fight each other and for those 100 ships there would only be 100 lines of code in the Render loop, at least for the draw calls anyways.  When you do it this way, it's as if the compiler is copying and pasting all the code for you and setting them all to the proper positions.   Doing things this way not only condenses your code and makes it easier to read but it helps to keep errors at bay since you have hundreds or even thousands of fewer lines of code to look at and deal with, and you won't be introducing errors and frustration by hand typing and adjusting them all.

 

Let's think about what the asteroids might look like, both with a function to draw them all and without a function to draw them all.  If we set up the asteroid draw, position, rotate, and scale calls in a function just like for the ships above

 

For 50 asteroids there would be, so far, 50 lines of code, there will be more code than that for logic and other stuff but that will be true either way.  For now let's say that we can draw 50 asteroids with 50 lines of code.

//-----------------------------------------------------------------------------------------------------------------

Now for 50 asteroids that each have been drawn manually, with about 15 lines of code required every time.  You would then have 15 * 50 = 750.  If you do it your way then there will be 750 lines of code vs. 50 lines of code!  There will be an extra 700 lines of code and you will have to define all the individual positions for each one, that would be horrible especially since it was work that did not even need to be done.  This would set most people back a month at least, and it would be a really tedious painful month

 

//====================================================================================================

 


void draw_ship() {

 

Maybe some of the confusion here is coming from your  render loop name, you've called your render loop: draw_ship.  You absolutely, positivity, without any doubt have to change this right now before anymore confusion here sets in because of this!   When I wrote that you should make a DrawShip function for drawing your ships you likely thought that I was talking about making that the render loop.  You see how the name choice for your render loop has already wreaked so much havoc on this conversation?

 

By calling your render loop "draw_ship" you are making it seem as if you are only using it to draw ships, yet it is drawing ships, and bullets, and asteroids, and whatever else.  You should call it just about anything else but draw_ship.  You can call it Render() or Draw_Scene() or Do_stuff() or Party_Time() or Go_Get_Em() ! 

Just please don't use draw_ship, this name that you've given your Render function is too specific to what only a small part what the render loop will be doing. 

 

Imagine if you called your render loop, shoot_bullets(), It doesn't just shoot bullets, it does a whole bunch of other things as well.  It's just too confusing to do it that way. 

Ya see?


PARTNERS