Noob learns to code in 3 months

The Partridge Family were neither partridges nor a family. Discuss.
User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Noob learns to code in 3 months

Post by chili » September 20th, 2017, 1:04 am

No branches, only dreams now.

Each tutorial has important commits tagged (usually the end of the tutorial commit). You just create a branch at the commit you're interested in, using the tags as guideposts.
Chili

User avatar
Yumtard
Posts: 575
Joined: January 19th, 2017, 10:28 pm
Location: Idiot from northern Europe

Re: Noob learns to code in 3 months

Post by Yumtard » September 20th, 2017, 4:57 pm

Yeah figured it out :)

Had nothing to do at school today so watched 10, 11 and 12. Just watched them through without pausing to get the idea. Found these really interesting so decided just watching through them once and then watch each of them more carefully would be a good idea.

rewatched 10, didn't code along because I wanted to make it more of a challenge afterwards. But cheated a bit by writing down a guideline which I peaked at while coding. Will try to do it all over again without the guideline before moving on to 11.

guideline
Spoiler:
surface class -
array of colors (pixels)
width and height
cpy cstr and copy assignment
putpixel
getpixel
getwidth/height
constructor

in gfx:
drawsprite()

include chiliwin to get access to bitmapfileheader and info

in the constructor:
read in the fileheader
read in infoheader
assert bitcompression == BI_RGB

set width/height and load pixels in array

bfOffBits is where the offset from beginning of file to where the pixel data starts

padding = (4 - (width * 3) % 4) % 4

User avatar
Yumtard
Posts: 575
Joined: January 19th, 2017, 10:28 pm
Location: Idiot from northern Europe

Re: Noob learns to code in 3 months

Post by Yumtard » September 20th, 2017, 7:57 pm

Success!

Took a break for a few hours before trying to write the code without any cheating. Took the break so everything wouldn't be superfresh in my mind and me just remembering exactly what I needed to do. This way I had to think a bit more what I needed.

Decided to record it because 1. I'm a nerd and enjoy watching speedcoding and 2. I felt like recording it helped me not get tempted to cheat.

here's me doing the "challenge" in 8x speed.

https://www.youtube.com/watch?v=z-vtupqvbFI

will have a closer look at 11 and maybe 12 tomorrow unless I get a bunch of school stuff to do.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Noob learns to code in 3 months

Post by chili » September 21st, 2017, 2:31 pm

11, 12, and 13 (maybe not 13) should be a bit of deja-vu for you considering that you had this stuff in your Shoot-Em-Up balls game. Though it's nice to see exactly where all that Surface and sprite routine comes from and the entire process of its creation, isn't it? :)


The timelapse coding looks cool, music suits!

14 is gonna teach how to make your own template classes and template functions. Good shit.
Chili

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: Noob learns to code in 3 months

Post by albinopapa » September 21st, 2017, 3:48 pm

chili wrote:11, 12, and 13 (maybe not 13) should be a bit of deja-vu for you considering that you had this stuff in your Shoot-Em-Up balls game. Though it's nice to see exactly where all that Surface and sprite routine comes from and the entire process of its creation, isn't it? :)


The timelapse coding looks cool, music suits!

14 is gonna teach how to make your own template classes and template functions. Good shit.
Are you going to cover template specialization?
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

User avatar
Yumtard
Posts: 575
Joined: January 19th, 2017, 10:28 pm
Location: Idiot from northern Europe

Re: Noob learns to code in 3 months

Post by Yumtard » September 21st, 2017, 8:31 pm

chili wrote:11, 12, and 13 (maybe not 13) should be a bit of deja-vu for you considering that you had this stuff in your Shoot-Em-Up balls game. Though it's nice to see exactly where all that Surface and sprite routine comes from and the entire process of its creation, isn't it? :)


The timelapse coding looks cool, music suits!

14 is gonna teach how to make your own template classes and template functions. Good shit.
Yes and no. The thing with sprite sheets and just drawing parts of the picture was new to me.
Also back then I didn't really understand how to animation class worked, just used it.

Glad you liked the timelapse because I made an other one! haha. This one is long and nobody should watch it unless they're bored and have too much time on their hands or are into the music.

I had nothing to do so made another challenge to do everything from loading bitmaps to animated sprites without cheating. Had a little trouble along the way but went alright, took a bit more than 2 hours.
Don't worry, these recordings wont become a regular thing :lol: (probably last one)
https://www.youtube.com/watch?v=awTOLUh2raI

Will watch 13 tomorrow, then do maths for a while

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Noob learns to code in 3 months

Post by chili » September 22nd, 2017, 1:14 am

albinopapa wrote:
chili wrote:11, 12, and 13 (maybe not 13) should be a bit of deja-vu for you considering that you had this stuff in your Shoot-Em-Up balls game. Though it's nice to see exactly where all that Surface and sprite routine comes from and the entire process of its creation, isn't it? :)


The timelapse coding looks cool, music suits!

14 is gonna teach how to make your own template classes and template functions. Good shit.
Are you going to cover template specialization?
Not in the introduction to templates. Information overload is seldom a good thing ;)
Chili

User avatar
Chrajdal
Posts: 22
Joined: December 15th, 2012, 2:18 pm

Re: Noob learns to code in 3 months

Post by Chrajdal » September 22nd, 2017, 10:10 am

Yumtard wrote:Success!

Took a break for a few hours before trying to write the code without any cheating. Took the break so everything wouldn't be superfresh in my mind and me just remembering exactly what I needed to do. This way I had to think a bit more what I needed.

Decided to record it because 1. I'm a nerd and enjoy watching speedcoding and 2. I felt like recording it helped me not get tempted to cheat.

here's me doing the "challenge" in 8x speed.

https://www.youtube.com/watch?v=z-vtupqvbFI

will have a closer look at 11 and maybe 12 tomorrow unless I get a bunch of school stuff to do.
Hey, I noticed that around 1:00 in that clip you wrote assignment operator. What happens when you do the following:

Surface a ("anyfilename.bmp");
a = a;

The universe will blow ^^

Check this: https://isocpp.org/wiki/faq/assignment-operators

Btw: I love your idea about not being tempted to cheat!

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Noob learns to code in 3 months

Post by chili » September 22nd, 2017, 10:19 am

Chrajdal wrote:
Yumtard wrote:Success!

Took a break for a few hours before trying to write the code without any cheating. Took the break so everything wouldn't be superfresh in my mind and me just remembering exactly what I needed to do. This way I had to think a bit more what I needed.

Decided to record it because 1. I'm a nerd and enjoy watching speedcoding and 2. I felt like recording it helped me not get tempted to cheat.

here's me doing the "challenge" in 8x speed.

https://www.youtube.com/watch?v=z-vtupqvbFI

will have a closer look at 11 and maybe 12 tomorrow unless I get a bunch of school stuff to do.
Hey, I noticed that around 1:00 in that clip you wrote assignment operator. What happens when you do the following:

Surface a ("anyfilename.bmp");
a = a;

The universe will blow ^^

Check this: https://isocpp.org/wiki/faq/assignment-operators

Btw: I love your idea about not being tempted to cheat!
Yeah I mention that case on the wiki page. Should have covered it in the tutorial but forgot about it!
Chili

User avatar
Yumtard
Posts: 575
Joined: January 19th, 2017, 10:28 pm
Location: Idiot from northern Europe

Re: Noob learns to code in 3 months

Post by Yumtard » September 22nd, 2017, 10:52 am

interesting! Never considered self assignment

Post Reply