Learning to code by writing games

in #education7 years ago

tl:dr: learn coding by learning how to write games.

I’ve found that one of the best ways to teach yourself coding is to learn how to code games. One of the benefits is that you are learning to code something fun. I find it difficult to learn anything when you are coding something boring.

I did learn the basics object oriented programming at university but taught myself Python, HTML, CSS from reading books. To learn Python I found a book that taught you how to code simple games as you learnt about the syntax and the various data structures.

As I’m trying to keep this a blockchain focused blog I will relate the content back to learning about blockchain technology. I will also point back to a previous article on learning about blockchain.

Python

Python is a fairly simple language to learn and I would say that it is fairly newbie friendly too. There are tons of books out there to begin your learning.

Book suggestion: Python Programming, for the absolute beginner

As I alluded to I above I read a book (link below) which taught the language by showing you how to create simple games. It should be a simple enough read and a reasonable starting point for people of low to no programming skills. Those who know another language and which to make the switch to python as I did then this could be a good starting point:

Python Programming, for the absolute beginner

Coding a simple Rogue-like game in python

Another suggestion that I have for learning to code in Python, and in particular creating games, is to create a simple Rogue-like game. There is an excellent tutorial on this at the following link:

Complete Roguelike Tutorial

I completed the tutorial sometime back in 2016. I'm not wondering if there is a way to add a simple blockchain into the game's backend. Hopefully more thoughts on this in a future article.

Python in blockchain development

Why learn python for blockchain? Well, it is a fairly simple language to get started in and allows for quick development so it is possible to quickly create proofs-of-conccept. There is a good tutorial on creating a simple blockchain using python which shows just how easy it is to create a simple chain. I'm going to cover this in my next article.

There is an Ethereum client written in Pythong called Pyethapp.

the code base of this client is probably the most readable and has a great contract tester library with fast development cycles. It is not meant for high-end usage as performance in this client is not as high priority as clarity and reliability.
https://www.ethereum.org/cli

HTML5 and JavaScript

I learn HTML and CSS a while ago, more than 10 years ago now, but never became particularly advanced. Most of the coding I did in my university days was for scientific purposes: i.e. calculations / simulations. This is the main reason that I don’t see myself as a great coder. I don’t feel I correctly learnt the fundamentals as you would with a computer science degree.

Anyway… the point here is that I’m diving into JavaScript development by learning how to create simple games. I’ve done some JS coding before but not in any great depth. So I figured I’d pick up a book and get on with learning. I’ve read about 3 chapters and so far it seems like it is going in the right direction.

Pro HTML5 Games: Learn to Build your Own Games using HTML5 and JavaScript

The book teaches you how to write a simple Angry Birds type game and then how to create a simple RTS (which could be fun to tinker with). FYI, I wouldn’t say this is newbie friendly!

Why JS?

It is a fairly easy language to learn and is ubiquitous on the web. Improving my JS skills will also help improve my skills in Solidity too. It is also one of the main languages of web3: thinking about getting Dapps to work with Ethereum!


Solidity

I haven’t done a lot of Solidity coding. I’ve found it to be a bit ‘dry’ to learn. Sure, the prospect of creating a token is appealing but somehow just not had enough desire to really get stuck into it. I did go as far as installing MetaMask and working through a couple of tutorials. The language is fairly similar to JavaScript.

A useful tuturial to get started: Learning Solidity Part 1: Contract Dev with MetaMask


Hope that was informative and helpful for some people looking to pick up or improve their programming skills.

Comments and suggestions welcome below!

Coin Marketplace

STEEM 0.18
TRX 0.13
JST 0.028
BTC 64450.12
ETH 3153.87
USDT 1.00
SBD 2.52