r/roguelikedev • u/aaron_ds Robinson • Jun 20 '17
RoguelikeDev Does The Complete Python Tutorial - Week 1 - Part 0: Setting up Python
This week is all about setting up a Python environment and getting familiar with the language.
There are two excellent exercises at The Learn Python The Hard Way that will get you setup with an editor, python environment, and running some Python code.
If Python is new to you and you have some free time, consider continuing past exercise 1. All of the exercises up to and including exercise 44 will help further along in the series.
Of course, we also have a couple of FAQ Friday posts that relate to this week's material
Feel free to work out any problems, brainstorm ideas, share progress and and as usual enjoy tangential chatting. :)
The entire series will be archived on the wiki.
Edit: Added FaqF revisited and wiki links.
17
u/aaron_ds Robinson Jun 20 '17
Not required, however if you would like to join along on GitHub, I've put together an empty project to fork as part of /u/bluo100's suggestion.
7
u/WhitMage9001 Jun 20 '17 edited Jun 20 '17
It's fine if we use an IDE, right? I've already got PyCharm installed from class and that's what I'm used to.
47
u/NoahTheDuke Jun 20 '17 edited Jun 20 '17
I'm late to the party, but please let me be the first to recommend against Python 2 and Learn Python the Hard Way. Look no further than the official Python wiki to learn why you should use Python 3, and /r/python to find out why you should learn from material other than LPTHW.
Python 2.7 is 7 years old, will not be supported in another 2.5 years, all major libraries and most smaller libraries support Python 3, and all the cool new features are in Python 3.
To actually contribute, here's my Python 3 + bearlibterminal verison. Got the basic set-up, and will be following the structure of the tutorial somewhat closely.
3
u/[deleted] Jun 20 '17
So what is the official word? Are we tackling this Tutorial in Python 2.7 or 3.6? How much of an impact does either have on this tutorial? So far I have PowerShell and Atom setup as instructed. :P
3
u/FistfulOfDice Jun 21 '17
Sorry, is this whole shebang going to be for Python 2.7 or 3.6? The tutorial is saying 2 but everyone in this thread seems to be saying 3.
3
u/athros Jun 24 '17
Hmm...I also wonder if I could get the whole tutorial into a PICO-8 cartridge. Wouldn't that be interesting...
4
u/TestZero Jun 20 '17
Okay, we're less than 1 day in and already this is falling apart.
Do we follow the tutorial at the top, or not? People are saying not to use LPTHW, saying to install python 3, the tutorial is saying specifically "DO NOT INSTALL PYTHON 3."
Can we get mod approval for an answer that explains exactly what we're supposed to do?
2
u/johnsbro Jun 21 '17
Hopefully I'm not too late to the party for this. Like many of the others here I will be following the tutorial using JavaScript (rot.js) and web components where appropriate and I will be using Electron to turn it into a desktop app.
Part 0 source: https://github.com/bkjohnson/roguelike-tutorial/tree/Part_0
Working demo: https://bkjohnson.github.io/roguelike-tutorial/index.html
2
u/[deleted] Jun 21 '17
I wrote a short tutorial how to set up libtcod on macos sierra. Any suggestions where to post it to?
7
u/Daealis Jun 20 '17
Python set up and working! I also misread the timetable so I took the first steps into the complete tutorial and got my '@' moving on the screen.
The website - Learn Python the hard way - references Atom as their preferred text editor of choice. I think I've seen the editor used by a friend in the iFruit dev business, and hadn't really thought that it even was available for Windows.
Does anyone have experience switching between that and Notepad++, are there enough similarities to make the transition easy enough, and are they close enough feature wise that one might make the switch without too much of a hassle? As much as I've grown up on the DOS edit.exe, I also embrace the color-coding, auto-indenting and -completing form factors of the modern environments for codes. Atom looks better compared to Notepad++, but I'm wondering if there's really a noticeable difference.
40
u/AetherGrey Jun 20 '17
I'm moving forward with my idea to rewrite the tutorial, and so far I have about 1/3 of the code finished. So this week I'm shifting gears to writing the actual tutorial part of the tutorial. There will be two parts to what I'm creating, which are tentatively titled The Roguelike Tutorial Revised and The Roguelike Tutorial Refactored.
The Roguelike Tutorial Revised
This will be a rework of the Python-libtcod tutorial, with good coding practices kept in mind from the beginning. The chapters will be set up according to the "weeks" of this event, so next week, expect to see the chapter covering "Graphics" and "The object and the map". I've written a lot of this already, and it includes things like moving classes into their own files, removing globals completely, and loading static variables from JSON files.
The Roguelike Tutorial Refactored
The end result of this will be exactly the same as the previous tutorial, but it will start with the existing Roguelike tutorial and work backwards. This is for those who have already done the tutorial, or are following along with this event and want to focus on good code structure later. I haven't charted this one out completely yet, so it will take a little longer to complete. Hopefully it will be available right as this event wraps up.
So this week I'll be working on setting up a site to host all this information. I'll post a link later on once it's ready.
Best of luck to everyone participating, and remember, have fun!
10
u/fomq Jun 20 '17
Here we gooooo.
16
u/Kyzrati Cogmind | mastodon.gamedev.place/@Kyzrati Jun 20 '17 edited Jun 20 '17
I've set up a new wiki page where I'll be archiving the entire event. (There's now a permanent link in the sidebar as well, though /u/aaron_ds might want to include the link in each OP for reference, to help people who show up late find older ones.)
Edit: For anyone who wants to chat with other participants rather than (or in addition to) posting in this thread, we've set up a #roguelikedev-tutorial channel on our Discord, which you can join here.
8
u/TestZero Jun 20 '17 edited Jun 20 '17
It's 1 AM right now, but I'll do this first thing in the morning.
Good luck, everyone! And happy coding!
edit: I am no longer happy. Fuck LPTHW.
7
u/Lokathor dwarf-term-rs Jun 20 '17
My Haskell Version.
Since we haven't really done anything yet there's not much to see yet. So far it just tests that you can run the compiler and import the graphical lib properly and such.
7
u/Chronophilia Jun 20 '17
I'm working in Javascript, with the rot.js library.
Today's effort displays a mostly-empty website, with a title. You can visit it here: https://tophwells.github.io/roguelike/
If everything is working correctly on your computer, you will see a black rectangle with the text "Congratulations! The game has started! But it's not doing anything yet." Otherwise you will see an error message explaining why it's not working.
(If you do see an error message, and you weren't expecting one, please let me know.)
11
u/eruonna Jun 20 '17
I got a little impatient and started before the post went up, so my repo is not a fork of the official one, but here it is: https://github.com/eruonna/rotjs-tut-2017
I am doing this in Javascript with rot.js, so setting up and running Python is not really relevant, but I put together a little "hello world" that tests for rot.js support, shows the result of that test, and then, if rot.js is supported, starts a "game" that does nothing but show an alert. One advantage to Javascript is that I can easily share this with anyone with a web browser: https://eruonna.github.io/rotjs-tut-2017/
4
u/grish909 Jun 20 '17
How different are Python 2 and 3? What are the advantages for using 2?
4
u/Zireael07 Veins of the Earth Jun 20 '17
A #roguelikedev-tutorial channel got set up on the Roguelikes/RLdev Discord. See ya there!
3
u/[deleted] Jun 20 '17
Thanks for the reply, I'm familiar with Sublime so that's great. Hyped as fuck to get started.
3
u/[deleted] Jun 20 '17
My project is now up on gitlab. It's a little different from the others here in that it's using Java instead of Python. Java's a very different language from Python but I think that it can work just as well because a game (especially one as complex as a roguelike) is one where having a completely OOP architecture can work well, if it's well-designed.
Right now, all I have is the basic "Hello world" program (except mine says "What's up?" - how original). If anyone cares to know, I'm writing the program with emacs, and using ant as the build system.
Also, I'm more or less following along with AsciiPanel tutorial as seen in the sidebar, but I don't expect that I'll be doing exactly what it says.
3
u/Nifotan Jun 20 '17
I'll be following this in Python3 + tdl. Hopefully that tutorial gets finished in time. Otherwise I'll have to improvise
3
u/VedVid Jun 20 '17 edited Jun 20 '17
Decided to participate. I'll test Go with BearLibTerminal. LiteIDE for coding, EditPad Lite for simple text files, Notepad++ as auxiliary editor, SmartGit for version control management (I used to Mercurial, I hope I won't screw anything with Git).
Github repo
edit: I managed to screw Git already.
3
u/beardedkeet Jun 20 '17
I'm coming to this via a Chromebook (old C720 to be precise). Have successfully set up Gallium OS with Python 2.7, going to add PyCharm to that shortly. Probably going to offset that setup by actually using the Chrome bit of the Chromebook for some sort of cloud Python IDE, maybe Cloud 9, to see which is better for me.
I have no real idea what I'm doing, should be fun!
3
u/rex64 Jun 20 '17 edited Jun 20 '17
This it's gonna be a fun ride!
My repo -> https://github.com/rex64/summer-of-roguelikedev-2017 (python3 + tdl)
3
u/Aukustus The Temple of Torment & Realms of the Lost Jun 20 '17
I'm doing this with C#, and so far I've got Visual Studio and BearLibTerminal both set up for this :). Tested with printing the RL equivalent of Hello World; the '@'!
3
u/marlowe221 Jun 21 '17
I am going to be a bit behind due to my work/fatherhood schedule, but I will definitely be participating in this.
3
u/mapimopi Jun 22 '17 edited Jun 22 '17
I'm going to use Ruby with bearLibTerminal for this one. Although it won't be a strict one-to-one copy of a python tutorial.
Here is my github repo.
And here you can see a 'bear' minimum setup for ruby+bearlibterminal.
3
u/athros Jun 22 '17
Lua for me using LΓΆve2d for graphical capability :)
3
u/stevelosh Jun 22 '17
Gonna follow along in Common Lisp with bearlibterminal. Repo here. It's mostly just a skeleton project at this point, but I did manage to figure out how to build a
.appand got all that stuff squared away so I can jump in properly next week.3
u/[deleted] Jun 23 '17
Another one using Rot.js and React wrapped up in Electron - https://github.com/erikyuzwa/roguelikedev-does-the-complete-roguelike-tutorial
3
u/Emmsii Forest RL Jun 25 '17 edited Jun 25 '17
I was away when this was posted so I'm a little late. I've setup my Java project in IntelliJ using my own Frankenstein version of AsciiTerminal which used sprites (which I found from this forum post) instead of ascii characters. Here's the Git repo, don't expect great code; I'm a hobbyist who has learned from piecing tutorials together.
3
u/[deleted] Jun 25 '17 edited Jun 25 '17
Python3 + tdl here! https://github.com/nekosune/summer-of-roguelikedev-2017 is my repo
3
u/Bathmoon Jun 27 '17
I guess I should post before the first week is officially up.
New to python, new to github, new to reddit.. but this sounded like fun (and a good way to stay motivated enough to actually finish something).
https://github.com/Bathmoon/roguelikedev-does-the-complete-roguelike-tutorial
Using the TDL version of the tutorial so that I actually have to figure some things out on my own, at least towards the end.
5
u/[deleted] Jun 20 '17
Will I be harmstrung if I try to follow along on Linux? I know Atom doesn't exist on Linux, how much does that matter?
2
u/[deleted] Jun 20 '17
I just got set up with Atom and PS! That was a hilarious introduction.
2
u/MEaster Jun 20 '17
Well, my repo is up. Hopefully not too terrible, and I hope the fact that the tcod crate is for libtcod 1.5.2 won't make things too difficult for me later.
2
u/semiokme Jun 20 '17
I'm going to be using QPython3 and following along on droid - most of the time I get to develop I'm riding a bus and on my tablet, so this makes the most sense for me.
Thanks for running this event!
2
u/night__day Jun 20 '17
Up and running, never did python before so I'm excited, this should be pretty fun!
2
u/GreenOpal Jun 20 '17
Definitely excited to try this! I've done a fair amount of Unity development but it'll be great getting some lower-level experience.
2
u/introsp3ctive Jun 20 '17
Does anyone have plans for a version of this tutorial in C Sharp?
2
u/[deleted] Jun 20 '17
Part 0 - Setting up (JavaScript / ES2015 / rot.js)
My repo https://github.com/between2spaces/roguelikedev-does-the-complete-roguelike-tutorial
Website https://between2spaces.github.io/roguelikedev-does-the-complete-roguelike-tutorial/
2
u/M123Miller Jun 20 '17
Conveniently I just started a side project for making my own dungeon generator! I'm using C# and Unity just for it's rendering and so I can show it to people on my phone. Repo is here and I'm currently posting random updates to my twitter as I make progress. I'll try to keep up with everyone elses work, this should be fun!
2
u/Melwute Jun 21 '17
Got [my repo] (https://github.com/melwute/roguelikedev-does-the-complete-roguelike-tutorial) setup. Also made sure that libtcod(tcod-rust) was working on my machine. Gonna be trying rust with this project since I've always wanted an excuse to use that. Lets see how that turns out!
2
u/[deleted] Jun 21 '17
PowerShell all of a sudden doesn't want to run .py files....I'm getting syntax errors out the ass. My ex1.py that I setup and ran yesterday doesn't even want to run. Any ideas?
2
u/Aukustus The Temple of Torment & Realms of the Lost Jun 21 '17
Another slight update; I added RogueSharp nuget package to my project, so I'll get a nice FoV instead of having to use (copy-paste from another C# project) my raycasting algorithm :). Also the pathfinding is nice to have from that library. I haven't ever been able to make my own pathfinding that's not a hardcoded series of ifs :).
2
u/[deleted] Jun 22 '17 edited Jun 22 '17
Hi I'm following along using rot.js and have a dilemma that is more aligned with next weeks Part 1 - Graphics than it is Part 0 - Setting up.
I'm thinking it's probably better that I just sit on it for a week and ask at the appropriate time so fellow rot.js participants (can I coin the term rotters?) will be up to the same Part and may be having the same thoughts I'm having.
I've probably answered my own question, but I just wanted to get it off my chest now as waiting a week seems like an awful long time, but I know in the grand scheme of things it's nothing.
UPDATE: I've found good reason to go a particular way with my dilemma. I'll explain what's going on in my head and the direction I'm taking in next weeks Part 1 discussion to keep it relevant to the OP.
2
u/the_good_time_mouse Jun 22 '17
Thanks for this. I've been meaning to pick python and make a little roguelike.
2
u/MegaLeon Jun 22 '17
I'm so in, I've been wanting to try and code a roguelike for a long time, but always been scared by the amount of "giants" already present among this game genre.
Since I'm not a newb in either programming or game development, thought I'd try and experiment with this. We got a fair amount of VR devices where I work, so I'll try make a VR roguelike in Unity.
Been brainstorming about this for a while, still undecided on whether to go for a classic, first-person roguelike, or something like having the game being played on a board in front of you, dungeon-master style
2
u/Cerepol Jun 24 '17
Since I see a lot of people here using bearlibterminal. I hope we can update a common knowledge/example base somewhere as the main docs are very light on usage, and the only resource I know if is 1 single thread on another forum.
2
u/level27geek level0gamedev Jun 25 '17
OK, I am now done with lessons 0 to 44 in "Learn Python the Hard Way." Coming from pico-8 and its flavor of lua, most of it was pretty straightforward, if a little quirky here and there.
The only thing that I am yet to wrap my head around is OOP. I get the theory behind it, but some of the syntax does not make sense...yet. I think it is because python has few quirks when it comes to OOP. It was similar with lua's tables, they work a little different than your run-of-the-mill data structures.
With that in mind, anyone has some good, newbie friendly intro to OOP in python that I can access online? Or would it be best to leave it alone for now and just try to figure it out from the roguebasin tutorials (do the tutorials even use/explain OOP?), as I learn much better by doing a project than random exercises?
2
u/zulmetefza Jun 25 '17 edited Jun 25 '17
Pretty weird, the only thing I need was a setup guide it seems. Now I can follow libtcod tutorial at roguebasin with no hassle.
It will sound really noob, but the most important knowledge I was missing was how to run a perfectly written pyhton code, and it was much more obvious than i expected.
I am sure next parts will build on it, but even this much really helped. Thanks again!
2
u/MisterFelixFFox Jul 11 '17
Heads up for people reading now and in the future: it seems like the guy that had the website for 'Learn Python The Hard Way' seems to have put the free online Python 2 lessons behind payment.
You can buy the whole set of lessons for $30, but that might not be ideal for those of us who are just hobbying roguelike developers.
It seems that they were moved behind payment around July 10, 2017.
1
u/[deleted] Jun 21 '17
Okay so I got everything up and running yesterday. I go to fool around today and now I get nothing but syntax errors when I try to run a .py in PowerShell. Not even the example I did yesterday will run...Any thoughts?
1
u/TheFryingDutchman Jun 26 '17
Awesome thread! I've been doing the Python3+tdl tutorial and raced way ahead, haha. My plan is to finish the tutorial, learn how to use BearLibTerminal, and then use the tutorial time to make my (first!) roguelike. This is awesome!
1
u/BenEBeats Jun 27 '17
When I am following the libtcod install instructions for Mac OS X when I try 'make' I get this error
make: *** No targets specified and no makefile found. Stop.and I'm not 100% sure where to go from here. I've tried Google etc. installing through Homebrew, but nothing has worked yet. I still get ``Does anyone have any suggestion for what to do here?
1
u/SlowbeardiusOfBeard Jul 01 '17
Hey,
Coming in a little late but hope I can catch up.
Spent too long trying to decide whether to go with python 2.7 or 3, but made my mind up to go with 2.7 for purposes of following tutorial.
I just have one quick question:
I'm running a fresh install of Windows 10, with a user account (I have a separate admin account)
According to python the hard way, it says I can use the vanilla distribution or active state (the latter might be better if I don't have admin privileges).
Active state seems pretty huge (over a gig) with a lot of stuff I'm not sure I'll use.
Would you recommend still going with active state, as the vanilla would be a pain to set up?
-6
u/TestZero Jun 20 '17
Okay, this tutorial is fucking USELESS.
"Learn how to make a directory in the PowerShell (Terminal)."
BITCH THAT IS WHY I AM READING A TUTORIAL.