don't click here

I want to get into coding, but don't really know much

Discussion in 'Technical Discussion' started by segamaniac, Jul 15, 2022.

  1. segamaniac

    segamaniac

    ️ Change was necessary for a truer me. Member
    Clownacy's Mega Drive/Genesis emulator sparked my want for coding again, but how do I get good, and where would I start? I'm an extreme noob, the only thing I really got nailed down is building code, don't think I'd be much help if that's what I can only really do. I'd like to have coding skills so I could possibly help with other open source projects, make my own possibly too, with an aim on community tools for various game engines. I fear I might never get to be able to achieve this in my lifetime since it's something I'd really like to learn to do, but I may never get to do so because I might never be good.
     
  2. Devon

    Devon

    I'm a loser, baby, so why don't you kill me? Tech Member
    1,245
    1,415
    93
    your mom
    IMO, it depends on what exactly it is you're wanting to do, but at the same time, it's all generally based on the same concepts and logic. You could look up on getting started with something like Python, Java, or whatever as a sort of sandbox for learning how program flow and logic works in programming, and then branching out from there. I personally learned to program using Game Maker 8, way back before Game Maker Studio was a thing. I found GML to be decently easy enough to learn as a newbie, and found it more rewarding to get stuff drawn on a screen rather than stuff written in a terminal. I'm not too sure about options today, though, since I'm past that stuff now, but there's probably something out there. In the end, I think it's best to start off experimenting with something relatively easy, even better if the environment suits what you're interested in learning.

    There's all kinds of different platforms, languages, engines, APIs, etc. etc. to mess around with. You did mention wanting to make tools for various game engines, but what kind of game engines are we talking about? What kinds of tools?
     
  3. DigitalDuck

    DigitalDuck

    Arriving four years late. Member
    5,349
    437
    63
    Lincs, UK
    TurBoa, S1RL
    100% agreed with Ralakimus. If you've never done any programming before, I'd recommend starting with Python - the syntax is easy to understand and getting stuff working takes no time at all. It'll give you the basics of how the logic works without worrying too much about the implementation.

    From there you can move on to a real language. :V

    But yeah, in terms of what language to actually use for a project, it depends entirely on the project. If you're only looking into making something, C# gives you a lot of flexibility plus easy connection with Mono or Godot or Unity. It's also good for UI if you're making things like level editors. Meanwhile if you want to mess with the internals of an engine you're looking at whatever the engine is coded in (which is more likely to be C++). And then if you're interfacing with the web or other devices, or you want portability, your options will change again.
     
  4. President Zippy

    President Zippy

    Zombies rule Belgium! Member
    Before learning a "real" programming language, consider learning how to write shell scripts using either zsh, ksh, or bash. They are all based off the old Bourne shell on AT&T Unix. If you're stuck on Windows, then learn how to use Powershell instead. It's a completely different language syntax (structure), but the semantics (meaning) are similar.

    If you do this, you'll organically learn how package managers, privilege separation, processes, inter-process communication (IPC), services (i.e. daemons), and basic systems administration works. And no shell script is complete without learning how to use the awk text-processing language to read data out of log files.

    When you're done with that, Python is versatile, but if you're interested in operating systems then C is the right way to go.

    ... But if what you're really interested in is games, skip Python and learn how to write C# in Unity3D.

    I would highly recommend learning a shell language first though, as this is the language of the command line.
     
  5. Clownacy

    Clownacy

    Tech Member
    1,060
    607
    93
    Since I was name-dropped, I suppose I should explain how I got into programming:

    My first language was 68000 assembly, which I picked up on from following the various SCHG How-To guides. Fixing bugs that would be introduced along the way was what actually got me to understand the language. I stuck with it because I found making my own personal definitive versions of Sonic 1 and 2 satisfying. This all started around late 2012, when I was a teenager.

    A few years later (about 2014, I think), I figured that I should expand to programming for PC. I chose the C language (C11, though mostly just C99), and developed for Windows using Notepad++ and the original MinGW. I specifically avoided Visual Studio because I wanted a workflow that would be similar to developing on Linux, since I didn't want to 'trap' myself in a software ecosystem that only existed on Windows. Here's the exact tutorial that I used to learn C.

    At first, I developed tiny console programs, but this was boring, so I eventually decided to do something that I found interesting and created a command-line frontend to the KENS compression library. It was fun to make a program that had a practical use and linked to a series of DLL files, but it was even more fun to integrate the source code of those DLL files directly into my program so that DLLs weren't needed at all. Here's the version that used DLLs, and here's the version that integrated their source code.

    After that (2015?), I got bored again, and decided that I should move onto graphical programs instead of console programs. As with before, I didn't want to trap myself on Windows, so I avoided learning WinAPI and DirectX, and instead found the SDL library, which is a platform-abstraction library which provides you with window creation, 2D graphical rendering, audio playback, and input handing that works across Windows, Mac, Linux, Android, and even some game consoles. I used this tutorial to learn SDL.

    It was great to be able to make 'real' programs now, but I still didn't really have anything to do with that knowledge. All I had was a smiley face against a tiled scrolling background. For fun, I swapped out the tiling background with an image of one of Marble Zone's chunks, and then I replaced the smiley face with a sprite of Eggman in his Eggmobile from Sonic 1. Then I thought about making it so that the background would scroll in a different direction based on which direction key the user pressed, while also making Eggman face in the opposite direction to create the illusion that he's moving around. For extra authenticity, I then recreated some of Sonic 2's assembly code in C so that Eggman would hover up and down slightly just like in that game.

    Before I knew it, I had a goofy little program called EGGMANQUEST where you just flew Eggman around an infinite empty space.
    [​IMG]
    I wanted to give Eggman something to do, so I added rings. Then Buzz Bombers. Then a port of Sonic 2's Debug Mode. Eventually, I was making a full-on port of Sonic 2 to PC.

    This port was what made me get good at programming in C: pointers, structs, for-loops, how to refactor, how to encapsulate subsystems... I learned it all because my port required it.

    My point is that I think it's important to have a 'pet project' - something that you work on because it's something that you want to create, and so working on it is fun and worthwhile. I don't work on any of my projects unless I want to, which is why I have so many of them in varying states of completion. It's also why I haven't worked on my Sonic 2 port in such a long time: I've moved onto writing an emulator and an assembler, and porting Sonic Mania to the Wii U.

    With that said, try not to set your goals so high that it becomes intimidating: no one makes a whole emulator or level editor as their first project. In comparison to those, my KENS frontend and EGGMANQUEST are amateur junk, but they were fun at the time and a great way to learn things, and I think that's what matters most.
     
    Last edited: Aug 31, 2022
    • Like Like x 5
    • Agree Agree x 1
    • Informative Informative x 1
    • List
  6. Black Squirrel

    Black Squirrel

    no reverse gear Wiki Sysop
    8,585
    2,481
    93
    Northumberland, UK
    steamboat wiki
    Formal education is preferable, especially if you want to make a career out of it.


    Otherwise:

    https://visualstudio.microsoft.com/vs/community/

    Visual Studio Community Edition is free. Find a C++ tutorial, make little command line things.


    You could do something similar in Python, and it would be easier and quicker, but you'll probably get into bad habits (I should know - I use it all the time!). C# and Java sit somewhere in the middle, but ehhh - you're not likely to run into a more complicated language than C++ in the wild, and starting at the top gives you a better understanding of why higher level languages make the choices they do.

    You can ignore all the "use Linux" calls and fascinations with different compilers. It can be interesting, and there's value in knowing how the compilation process works, but there's plenty of white noise out there. Also, I've been a qualified software developer for 10 years and I've never touched assembly.
     
  7. rata

    rata

    Member
    690
    73
    28
    Argentina
    Trying to be useful somehow.
    I'm actually finding this thread useful because I'm in a similar spot. I just happened to start developing a tool for editing Need For Speed 3 ghost files so we wouldn't have to do it by hex-editing, but also I don't know jack about programming or anything. The only programming I did was at university, a few random console apps the most useful being an angle converter... in Fortran.

    In fact I was going to ask questions about basically the same, aside from youtube tutorials I am going to ask for help here.
    That being said, I will rely on VS2019 cos need for speed is a windows game anyways and I don't care much about linux. If anything, the average linux fan can port it if needed.

    PS: so far I got the dialog to open a file (no code for actually opening nor closing yet) and a button labeled 'Close' that... CLOSES THE PROGRAM! I'll rewrite the whole game in 2 months at this point!
     
  8. MarkeyJester

    MarkeyJester

    Original, No substitute Resident Jester
    2,201
    431
    63
    Japan
    Mathematics is important, especially with something graphical, particularly; coordinates systems, trigonometry, data theory (indexing, hashing, sorting, compression theory), and some basic math knowledge; mean average, difference, a concept of positive/negative. It's not essential to know these right off the bat, but these are things you'll pick up eventually.
     
  9. President Zippy

    President Zippy

    Zombies rule Belgium! Member
    Considering you (Clownacy) had a much better run of self-teaching programming than I did, and that most of what I learned came from my first job after undergrad, I second this.

    I have to admit, as much as I enjoy the product of game development, it's the most arduous and frustrating subdomain of software development. You can automate unit tests for libraries, but the only kind of integration testing you can do is to grab the nearest Joe Schmo and make him play your game with special presets that may hide other problems. Regressions are a small risk, but the real problem is that you can't reproduce most of the oddities in physics, AI, and graphics.

    But more than that, it takes a ridiculous amount of time to make something useful, unlike writing your own version of 'ls', 'rm', or even a simple HTTP library. Hell, I cranked out a JSON parser in 1 day just to teach myself how to use std::variant and std::visit in C++. It can't handle escape characters, and it's likely horribly inefficient, but it works and the API is quintessentially good modern C++.

    Then again, if you (segamaniac) are all in on making a game, there's no sense in starting off writing a redundant toy program that's really only interesting to systems programmers.

    Instead of romhacking, have you considered getting on board with an open source fan game or making your own uber-simple game? Sonic Robo Blast 2 is a good way to get started that only involves C programming.

    ... Or even better, you could write an MD/Genesis game in C, and save yourself the trouble of understanding ASM. Clang can usually optimize code better than even the most attentive programmer.

    EDIT: I added another C++ example to my github account, this time showing off C++ operator overloading's usefulness by implementing a matrix class capable of performing math on complex numbers (numbers with a real and an imaginary component, e.g 5 + 2i).

    I'm doing this right now to teach myself modern C++ (C++17), as opposed to the C++03 I was forced to use at my old job due to IBM's crappy compiler suite on z/OS (XL compiler). I'm trying to escape the whole slimy software industry for medical school, but I need to use the skills I have to contribute to medical research and get recommendation letters while setting aside savings.
     
    Last edited: Jan 13, 2024
  10. Xiao Hayes

    Xiao Hayes

    Classic Eggman art Member
    The most interesting and frustrating thing of this topic for me is how I went through academic learning, yet they only taught me the theoretical use of this all besides the part where you learn to make mass-produced Windows application programs for personal database management (and it still sounds cooler than it is). I was way better with (Borland) C than with Visual (Studio 6) Basic, but no one told us where would we use all those pointers, linked lists and ordered trees, no one showed us how to make something graphical that wasn't already preset, etc. Essentially, when I tried to find a job, I thought I was taught nothing even remotely relevant because job offers sounded completely alien to what I was supposed to know, perception reinforced by the fact teachers told us we would have to learn further by going out in the wild and guessing what could be helpful or which one would be a good book for our progress. What's even worse, we learnt nothing about translation between languages; PHP does SQL, but how? Well, don't expect a teacher to explain, just use that SQL you learnt on that web programming language you learnt, and don't ask questions. Sort of.

    In short, you must be very invested in programming to keep trying, because it's DIY or nothing, and be grateful you live in the world of Internet 2.0 (or whichever version they consider we're now on), because at least now there's a way to try. I'm supposedly good at this but I lost all my will. I code human brains by writing stories and tabletop game manuals instead.
     
  11. Black Squirrel

    Black Squirrel

    no reverse gear Wiki Sysop
    8,585
    2,481
    93
    Northumberland, UK
    steamboat wiki
    At some point it all clicks and you know how to go about solving problems. But that "point" comes to different people at different times - I was half way in to my three year course before I started to get confident in what I was doing, and even then they say it takes 5-7 years to master the language.

    Spoilers: it takes longer because they add new features, and you might not be exposed to them in a real working environment with company coding standards.

    But that's "master", as in, "you don't have to look things up". Except you'll probably have to look things up anyway - I'm writing code for machine tool controllers - they don't teach that in schools.


    I think if I was trying to inspire my younger self now, I'd point out something like this:

    https://forums.sonicretro.org/index.php?threads/things-to-mirror.39197/page-15
    We're currently going through press sites to mirror offficial artwork and screenshots to Sega Retro. So it doesn't get lost in the system, it would be nice to have consistent filenames.

    Write a tool that can batch-rename files. Yes you can do it in one line of batch scripting but screw that noise - do it in C++.

    Relatively simple task with a real world use case. Now make convert all the BMPs to PNGs. Worry about making games later.
     
  12. segamaniac

    segamaniac

    ️ Change was necessary for a truer me. Member
    Hey y'all, I wanna thank you for all the feedback, I lurked on this forum every so often and heavily appreciate it! I'm happy to announce that I've made my first program in Python under the name of twitterpng, which downloads png images from Twitter by adding '?format=png&name=4096x4096' at the end of the image url. You can find it here on GitHub, feel free to make commits, forks, and the alike! Still wanna learn C along the road, but I felt that my limited knowledge and Python's syntax was perfect for this job. I plan on keeping this thread open for maybe others who are in the same position as me and learn something here too or any further advice anyone may have. Once again, thank you greatly! ;)
     
  13. I used to do C, C++, x86 assembly for work many years ago. I got out of the computer world 16 years ago, but have done a bit of hobbyist level programming and projects. I've been teaching myself Python just for fun. One resource if you're looking for gradually increasingly complex projects is the yearly "Advent of Code" (https://adventofcode.com/). Absolutely free, can do prior years. The only caveat I have for these is as one gets into later in the yearly problems, the person who set up the projects seems to assume familiarity with some Computer Science college subjects. On the other hand, there's plenty of help on Reddit as well as example code on github (https://github.com/search?q=advent+of+code) to see how other have solved the problems in the language of your choice.

    I forget which year, but at least one of the challenges involves writing a simple CPU emulator, even.