PCEngineFans.com - The PC Engine and TurboGrafx-16 Community Forum

Tech and Homebrew => PC Game Development => Topic started by: technozombie on September 29, 2016, 04:29:02 AM

Title: Learn to code through a series of challenges?
Post by: technozombie on September 29, 2016, 04:29:02 AM
So, like many people I've always want to learn to program/code, but have never really pursued it. I did take a beginners C++ class, and that is the extent of my experience. I've tried to watch Youtube videos, but I usually run into one of two scenarios. Number one: the beginner videos are for the absolute beginner and I get bored and distracted because I already know some of the stuff. Number two: most of the videos are in the format of "here type this,' and you are just following along trying to alt tab and type what they type.  I know there are several people on this site who program and I was hoping someone could issue me a series of challenges that increase in difficulty and complexity.

For example: Some experienced person says "Make a program that does 'X' thing" and then I go research on the internet and figure out how to do it, come back here with the source code, and proceed to the next challenge.

Also, if anyone else on the site is interested in participating in these proposed challenges then they are more than welcome. As a matter of fact if anyone has any good ideas on how to learn to code or even how to keep oneself focused on task/hobby/learning goal, then feel free to add that here. I get distracted easy, even when playing games I tend to play 4 or 5 in short bursts and seldom complete anything.
Title: Re: Learn to code through a series of challenges?
Post by: MrBroadway on September 29, 2016, 07:21:29 AM
What I did to brush up on things is to try to make one really big thing. I tried to create an in-depth data-analysis program in C using Win32. It helps to slowly add things here and there until you're competent. For Java, making a calculator got me to master some of the basics.

That said, I'd be interested. Are you still doing C++?
Title: Re: Learn to code through a series of challenges?
Post by: technozombie on September 29, 2016, 07:37:43 AM
I thought C++ would probably be the best way to go, but I'm open to other ideas.
Title: Re: Learn to code through a series of challenges?
Post by: elmer on September 29, 2016, 03:02:08 PM
I thought C++ would probably be the best way to go, but I'm open to other ideas.

IMHO, it depends upon how much interest you have, and what your eventual goal is.

What kinds of things would you like to program?

If you can analyse why you have some interest in learning, then it would be easier to make recommendations.

Way back-in-the-day, everyone wanted to make simple games written in BASIC on home computers with simple graphics.

That's an excellent way to start because you get fast feedback, and learn simple logic.

And that's a skill that you can then build on to take the next step.

Learning from modern C++ aficionados who just want you to string together pre-written functions from the std:: namespace isn't going to teach you how to think and problem-solve, or much about how stuff really works.
Title: Re: Learn to code through a series of challenges?
Post by: technozombie on September 29, 2016, 03:26:17 PM
Well i definitely wouldn't mind learning to make simple games. Actually, my son likes to do some pixel art, and I would like use his art in a game as well as be able to teach him how to do it.

As far as why I have interest in learning, it's really because I like challenging myself with new things. I recently tiled in a shower in one of my bathrooms, it was a difficult, but rewarding experience. Like any kid who grew up with a Nintendo, I've pretty much always wanted to make my own game.
Title: Re: Learn to code through a series of challenges?
Post by: elmer on September 29, 2016, 03:48:31 PM
The whole pixel-art aspect can wait until you get a little further down the path!  :wink:

The classic starting-point is to recreate the old Atari "pong" game.

You can break it down into a number of steps ...

[uldecimal][li]get a 1-pixel ball moving from the top-right of the screen to the middle-left of the screen[/li][li]reset the position of the ball back to the top-right when it goes off the screen[/li][li]add a "bat" on the left hand side of the screen, and bounce the ball off it when it reaches that point[/li][li]allow a joystick to move the bat up-and-down under human control[/li][li]get the ball to figure out whether it hits the bat (or not) when it gets to the left side of the screen[/li][li]... ... ... and then there's more when you get all of that working![/li][/ul]
You could either do that in BASIC on a Commodore 64 (or an emulation of one), or in GameBASIC on a PC, or in HuC on the PCE (probably the hardest to do, but the one where you'll get the most help from other folks here).

Does that make any sense?
Title: Re: Learn to code through a series of challenges?
Post by: Arkhan on September 29, 2016, 04:42:00 PM
BASIC on PC is a good place to start learning programming.

anyone who tells you learning via BASIC is dumb, is dumb.

They even came back with BASIC for Windows, https://www.microsoft.com/en-us/download/details.aspx?id=22961
Title: Re: Learn to code through a series of challenges?
Post by: MrBroadway on September 29, 2016, 04:50:57 PM
Visual Basic is actually very useful for Excel macros. (Well, VBA.)
Title: Re: Learn to code through a series of challenges?
Post by: NightWolve on September 29, 2016, 05:26:32 PM
Visual Basic is actually very useful for Excel macros. (Well, VBA.)

Ya know, I still use VBA under MS Access for my translation software. Access was a pretty competent solution to manage complex cases for what I did, games like Ys VI/Felghana/Ys Origin that separated the script out to ~1,300-1,766 individual files... I could abstract that into one database, one table, one view for the translation, and suddenly what was a nightmare or just not feasible, was a no-brainer (as in, why didn't I think of this sooner?), etc. Those projects would never have happened without Access!

In the case of Felghana, the translator could then translate the whole thing in 22 days as a result.. Of course, the bastard also then secretly exported the results to XSEED Games, got himself into the videogame industry off my back, ideas, work hours, etc. But yeah... Access is quite dandy if you learn how to make use of its power...and it led to XSEED getting a sweetheart deal where ~24,000 Falcom/Ys strings in total were pre-translated, ready for delivery/export, and not having to pay professionals at industry rates to start from scratch...

Anyway, for actual videogame development...well, I have actually seen games coded in good ole Visual Basic 6, straight up... It looks messy though, I'll say that...but, it's a great learning environment for sure! Why do I still like VB6 more than the mess that is VB.NET ??
Title: Re: Learn to code through a series of challenges?
Post by: technozombie on September 29, 2016, 05:54:45 PM
The whole pixel-art aspect can wait until you get a little further down the path!  :wink:

The classic starting-point is to recreate the old Atari "pong" game.

You can break it down into a number of steps ...

[uldecimal][li]get a 1-pixel ball moving from the top-right of the screen to the middle-left of the screen[/li][li]reset the position of the ball back to the top-right when it goes off the screen[/li][li]add a "bat" on the left hand side of the screen, and bounce the ball off it when it reaches that point[/li][li]allow a joystick to move the bat up-and-down under human control[/li][li]get the ball to figure out whether it hits the bat (or not) when it gets to the left side of the screen[/li][li]... ... ... and then there's more when you get all of that working![/li][/ul]
You could either do that in BASIC on a Commodore 64 (or an emulation of one), or in GameBASIC on a PC, or in HuC on the PCE (probably the hardest to do, but the one where you'll get the most help from other folks here).

Does that make any sense?
This is what I'm looking for, some objectives to work on. I'm working the graveyard shift right now, but I'll try to start on this when I wake up tomorrow.
Title: Learn to code through a series of challenges?
Post by: esteban on September 29, 2016, 06:10:13 PM
This is what I'm looking for, some objectives to work on. I'm working the graveyard shift right now, but I'll try to start on this when I wake up tomorrow.

YOUR OBJECTIVE: Develop a BLODIA clone after finishing PONG clone.

There will be no further warnings.

Your prime directive is BLODIA.
Title: Re: Learn to code through a series of challenges?
Post by: TheOldMan on September 29, 2016, 07:00:41 PM
Quote
...after finishing PONG clone

Pong is a good starting point, actually. Teaches the basics of joypad handling, sprite control and collision checks.

Follow it up with a breakout clone. That should teach you how to do quick screen updates and tile checks.
Title: Re: Learn to code through a series of challenges?
Post by: technozombie on September 29, 2016, 07:24:47 PM
If I can somehow find a way to do a Breakout/Blodia mashup then I'll really be onto something.
Title: Re: Learn to code through a series of challenges?
Post by: elmer on September 30, 2016, 04:14:05 AM
Pong is a good starting point, actually. Teaches the basics of joypad handling, sprite control and collision checks.

Follow it up with a breakout clone. That should teach you how to do quick screen updates and tile checks.

Exactly my thought!

I would avoid sprite-handling on pong, and just suggest developing it in a classic BASIC environment with a "plot" command to draw a point on the screen.

IMHO, it's best to get the basic programming thought-process (of de-composing a problem down into variables, conditionals, loops and subroutines) before dealing with stuff like sprites and attribute-tables.

Something on the PC that has a good debugger would be best, since a good debugger makes everything so much more pleasant, especially when you're starting off.

It doesn't look like Microsoft's SmallBasic has anything better than its version of "printf".

VB6 would be an alternative ... but you can't get hold of it freely.

Jeez ... why is it so difficult to find a simple environment with a decent debugger!
Title: Re: Learn to code through a series of challenges?
Post by: NightWolve on September 30, 2016, 04:37:54 AM
It doesn't look like Microsoft's SmallBasic has anything better than its version of "printf".

VB6 would be an alternative ... but you can't get hold of it freely.

Jeez ... why is it so difficult to find a simple environment with a decent debugger!

I forget, but didn't VB.NET take away the instant code rewrite AND continue ability you had in VB 6 during debugging/tracing ? That's the thing I loved about it! When you grew up with TASM, Borland C++, etc. and encountered such a feature for the first time, it was amazing! Lot of my early work involved maintaining legacy apps, and nobody likes to document their shit, so if I had to debug to track down a problem, nothing was ever better than VB 6! Perhaps its power and ease allowed software developers to be a bit more lazy than they normally would though, but companies just want apps running as fast as possible and if they're mostly providing the needed solution, they don't care how messy things are under the hood.
Title: Re: Learn to code through a series of challenges?
Post by: elmer on September 30, 2016, 06:08:35 AM
I forget, but didn't VB.NET take away the instant code rewrite AND continue ability you had in VB 6 during debugging/tracing ? That's the thing I loved about it!

I never actually used VB6 or VB.NET, just VBScript, so I don't really know.

They abandoned the old tried-and-trusted VB architecture and dived head-first into .NET, so the darned thing was fully-compiled and object-oriented in VB.NET ... and so is now a lousy learning tool, requiring too much higher-level event-based methodology.

At that point, it's no longer pickup-and-play, and you might as well learn VC++ or VC#.


VB6 would be an alternative ... but you can't get hold of it freely.

Jeez ... why is it so difficult to find a simple environment with a decent debugger!

Ahhhh ... Microsoft may have abandoned it, but your local friendly "abandonware" site should have a copy, complete with serial number.

Then you'd just have to apply the Visual Studio Service Pack 6 (that you can still download from Microsoft).

I just grabbed a copy for my own use since I only have VC++ 6, and not the full Visual Studio 6.  :D

<EDIT>

Here's an interesting article on simple graphics programming in VB6 ...

http://www.tannerhelland.com/39/vb-graphics-programming-0/

My feeling is that technozombie (or any new programmer) should just keep things as-simple-as-possible for his first programming, and just draw points, and maybe lines, because that avoids introducing too many new concepts at once.
Title: Re: Learn to code through a series of challenges?
Post by: NightWolve on September 30, 2016, 06:50:06 AM
Ahhhh ... Microsoft may have abandoned it, but your local friendly "abandonware" site should have a copy, complete with serial number.

Then you'd just have to apply the Visual Studio Service Pack 6 (that you can still download from Microsoft).

I just grabbed a copy for my own use since I only have VC++ 6, and not the full Visual Studio 6.  :D

If one went this route, you'll need 98/ME/2K/XP/Vista as I could not get it installed on Windows 7 and I assume above that... The installer completely fails, and no compatibility mode settings will help. So on Windows 7 and forward, you'd need to make use of "Windows Virtual PC" AKA emulation and install Windows XP or something, to get max compatibility with legacy apps and a little more modern feel, plus it can succeed at being installed. If not, for sure it'll install on a Win98/ME virtual instance.
Title: Re: Learn to code through a series of challenges?
Post by: technozombie on September 30, 2016, 03:13:45 PM
I found this compiler called PlayBASIC, does it seem like the right choice to use for what is being suggested?

http://www.playbasic.com/features.php
Title: Re: Learn to code through a series of challenges?
Post by: ginoscope on September 30, 2016, 03:54:50 PM
I develop in Java and C# but I don't work in the game industry.   The thing with coding is that it's more about thinking how to solve the problem than it is typing.  I would agree that something like basic would be a good place to start learning.
Title: Re: Learn to code through a series of challenges?
Post by: NightWolve on September 30, 2016, 04:01:19 PM
To get specific, I remember something called Game Maker from BITD. It'll let you export a game to all sorts of OS platforms too. Since is it a sort of RAD (Rapid Application Development) type builder, just around games versus general-use applications, I suspect it greatly helps people get started as quickly as possible, certainly easier than something like C++ which is more for advanced coders! It'll naturally include samples of simple games to get you started and learn from.

http://www.yoyogames.com/gamemaker/features

EDIT: Here ya go, jump right in from here with video tutorials:

Quote
"MAKE YOUR FIRST GAME!
Difficulty: Beginner/Intermediate

A GameMaker: Studio tutorial for absolute beginners to go from nothing to a completed game using GML scripting, no experience necessary!"

http://www.yoyogames.com/learn
Title: Re: Learn to code through a series of challenges?
Post by: elmer on October 01, 2016, 06:37:22 AM
The thing with coding is that it's more about thinking how to solve the problem than it is typing.  I would agree that something like basic would be a good place to start learning.

Yep, I absolutely agree. It's all about starting to think logically and break down problems.

The language doesn't really matter as long as it doesn't get in the way of that.

Some kind of structured-BASIC (i.e. no line-numbers) is perfect for that.

Then the beginner can transition to something more powerful later on (if they want to).


To get specific, I remember something called Game Maker from BITD.

http://www.yoyogames.com/gamemaker/features

In my mind, that's just too big and full-featured a package to be the best starting point for learning.

It just throws too much capability at you, and provides too much of a library that will avoid the beginner from learning the basics.


I found this compiler called PlayBASIC, does it seem like the right choice to use for what is being suggested?

http://www.playbasic.com/features.php

Yep, that looks OK from the feature-list. I don't know how stable or good it is to work with, but at least you can try things with the free edition before forking out your (very nicely priced) $15 for the full thing.

Just stick to drawing simple points and lines to start with for Pong, and then you can think about 2D sprites later on if you want to continue on to do Breakout/Arkanoid.


Ahhhh ... Microsoft may have abandoned it, but your local friendly "abandonware" site should have a copy, complete with serial number.


If one went this route, you'll need 98/ME/2K/XP/Vista as I could not get it installed on Windows 7 and I assume above that... The installer completely fails, and no compatibility mode settings will help.

Here's a method that's supposed to work for installing VB6 on later versions of Windows ...

http://stackoverflow.com/questions/10495680/installation-of-vb6-on-windows-7-or-windows-8-or-windows-10
Title: Re: Learn to code through a series of challenges?
Post by: NightWolve on October 01, 2016, 06:53:20 AM
If one went this route, you'll need 98/ME/2K/XP/Vista as I could not get it installed on Windows 7 and I assume above that... The installer completely fails, and no compatibility mode settings will help.
Here's a method that's supposed to work for installing VB6 on later versions of Windows ...

http://stackoverflow.com/questions/10495680/installation-of-vb6-on-windows-7-or-windows-8-or-windows-10

Ah, thanks very much man, I'll give it a shot... I still like having VB6 around and working... Call it nostalgia. ;)
Title: Re: Learn to code through a series of challenges?
Post by: elmer on October 01, 2016, 07:07:58 AM
Ah, thanks very much man, I'll give it a shot... I still like having VB6 around and working... Call it nostalgia. ;)

You're welcome!  :)

I just installed it on my Win7 x64 laptop using one of my VC++ 6 product codes, and it's working fine.

The only thing that I needed to do differently was to put the zero-byte msjava.dll file in \Windows\SysWOW64\ instead of \Windows\.

So now I can run VB6 with SP6!
Title: Re: Learn to code through a series of challenges?
Post by: technozombie on October 02, 2016, 01:59:02 PM
I installed that PlayBasic and I'm working through a tutorial. We'll see what happens.
Title: Re: Learn to code through a series of challenges?
Post by: Trenton_net on October 06, 2016, 10:01:17 AM
This is just personal preference, but I found FreeBasic to be a good alternative for people looking to learn programming. It has most of the major features you'd want in a learning language, and it also cross-compiles easily in DOS, Windows, and Linux. It's nice being able to write your code once and have it work all over. But that's just me!
Title: Re: Learn to code through a series of challenges?
Post by: technozombie on October 07, 2016, 09:43:07 AM
The Playbasic is ok so far, ive started on my pong game and have both "paddles" on screen and controllable. I just need to implement a ball and I guess edge/ boundary detection. I'm working for the next 7 days so I won't ger much done.
Title: Re: Learn to code through a series of challenges?
Post by: elmer on October 08, 2016, 05:25:44 AM
The Playbasic is ok so far, ive started on my pong game and have both "paddles" on screen and controllable. I just need to implement a ball and I guess edge/ boundary detection. I'm working for the next 7 days so I won't ger much done.

Congratulations!  :)

Keep on plugging away at it when you have the time.


This is just personal preference, but I found FreeBasic to be a good alternative for people looking to learn programming. It has most of the major features you'd want in a learning language, and it also cross-compiles easily in DOS, Windows, and Linux.

I just took a look at the webpage for it, and it does seem quite nice.  :)

There are all the simple graphics modes and point/line draw that I'd recommend for the 1st project or two while learning.

It's got a debugger, too, although I would call raw GDB very user-friendly.
Title: Re: Learn to code through a series of challenges?
Post by: technozombie on October 08, 2016, 02:58:52 PM
I recently rediscovered my inspiration for coding.  :lol:

https://www.youtube.com/watch?v=KEkrWRHCDQU
Title: Re: Learn to code through a series of challenges?
Post by: technozombie on October 11, 2016, 07:41:13 PM
I made my pong game, its very simple of course, but it works. I couldn't find a way to produce an executable file in the free version of PlayBASIC. If anyone wants to see it I'll try to post it tomorrow.
Title: Re: Learn to code through a series of challenges?
Post by: technozombie on October 13, 2016, 05:04:02 PM
Here is the source code for my pong game if anyone wants to critique it. 

https://drive.google.com/open?id=0BzgVE6j9OyMTQWJlMkVvUmdIbDQ
Title: Re: Learn to code through a series of challenges?
Post by: NightWolve on October 14, 2016, 08:45:09 AM
Here is the source code for my pong game if anyone wants to critique it. 

https://drive.google.com/open?id=0BzgVE6j9OyMTQWJlMkVvUmdIbDQ

And with only 3 pages of code. ;)
Title: Re: Learn to code through a series of challenges?
Post by: technozombie on October 14, 2016, 09:00:56 AM
Here is the source code for my pong game if anyone wants to critique it. 

https://drive.google.com/open?id=0BzgVE6j9OyMTQWJlMkVvUmdIbDQ

And with only 3 pages of code. ;)
Lol, is that good or bad?  Its not really as feature rich as it could be.
Title: Re: Learn to code through a series of challenges?
Post by: NightWolve on October 14, 2016, 10:06:45 AM
If it's actually playable and working, that reflects the power of the high-level language.

With CPUs getting faster and faster, you don't have to bother writing efficient code these days, or care as much about how many thousands of assembly instructions the compiler translates a line of your high-level code into, etc. You can just skip right into the creation process faster and faster... This is a good thing overall in principle I guess.

As a perfectionist though, something will always nag me at the back of my mind with like say Visual Basic executables, more so with the later .NET system... I can't escape it... I just...like producing Win32 executables that talk directly with the Operating System and skip over ANSI "C" wrapper functions that introduce 1,000 assembly instructions before finally calling the OS' API functions...

I dunno, but on the flipside, that's why I'm a slow coder. You can produce lots of software very quickly with RAD type app builders, but the bloat will always bother me even though it's becoming more and more negligible with modern CPUs... Java is still the exception I think, its runtime engine still sucks ballz running doggedly slow. The Operating System built with it for phones and other devices was horrible and died very quickly in favor of Linux variants like Android. I unfortunately bought an early-generation BluRay player with a Java Operating System, and sometimes I wanna break the thing in half!
Title: Re: Learn to code through a series of challenges?
Post by: incrediblehark on June 03, 2017, 10:06:06 AM
technozombie have you made any further progress? This thread is very interesting to me. I have wanted to learn myself since I was younger. A friend of mine started teaching himself python and gave me the book to learn as well but its more of a how to do something as opposed to why its done. After reading through this I think I may try starting with BASIC as well to get a better grasp on more fundamental concepts.
Title: Re: Learn to code through a series of challenges?
Post by: technozombie on June 09, 2017, 04:13:12 AM
I haven't really made any progress. I made my pong style game and never did any more. I get distracted really easy without set goals.
Title: Re: Learn to code through a series of challenges?
Post by: Galad on June 18, 2017, 04:14:21 PM
I think blitz basic is free,you could start with that and create a simple game.

http://www.bettiesart.com/tc/blitz/
Title: Re: Learn to code through a series of challenges?
Post by: Arkhan on June 28, 2017, 08:28:37 AM
http://smallbasic.com/

Microsoft came out with this awhile ago, and is your best bet for modern flailing.

Visual Studio has a free version with a debugger as well.

Knock M$ as much as you want, but I don't think anyone will disagree that their debugger is pretty much the best one available. 

Title: Re: Learn to code through a series of challenges?
Post by: technozombie on June 28, 2017, 09:35:58 AM
I've always wanted to make a game, but I never really had a "vision" for what I wanted to make.
Title: Re: Learn to code through a series of challenges?
Post by: Arkhan on June 28, 2017, 09:39:58 AM
I've always wanted to make a game, but I never really had a "vision" for what I wanted to make.
so make a game about someone who doesn't know what they want to make.

Title: Re: Learn to code through a series of challenges?
Post by: technozombie on June 28, 2017, 03:23:40 PM
I've always wanted to make a game, but I never really had a "vision" for what I wanted to make.
so make a game about someone who doesn't know what they want to make.
Arkhan, you're such a genius will you take me on as you disciple.
Title: Re: Learn to code through a series of challenges?
Post by: Galad on July 01, 2017, 10:24:38 AM
Quote from: Arkhan
so make a game about someone who doesn't know what they want to make.

 :lol: that was great