Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Lord Windy
Mar 26, 2010

potatocubed posted:

I haven't listened to the podcast but I've read the documentation on the language - it looks a lot like a beefed up Choicescript, which is no bad thing, but I'm not clear on how you turn your conversation engine into an actual game. Do you have to code your own front end in Unity?

E: I Tweeted them and asked. Yes, you have to code your own Unity front-end. The question I face now is "Do I want to learn Unity as well in order to use this language, or shall I try to crowbar this new idea into Twine?"

Big fat "It Depends".

Unity itself as a base isn't that hard to understand. Lots of options, but they are mostly documented. You can also choose to program in Javascript which is a very easy language to pick and move with. Though it appears that they only provided C# bindings (Which is harder to learn, but normally ends up being the better supported) so some would have to be in C#.

If you're looking to upgrade from Twine, might I suggest Tale for Python. It's GPL so you can't sell and must give source, but Python itself is a lovely step into real programming languages. Lots of people just fall in love with it and at this point it can do almost anything any other language can do. Tale itself is loving awesome, if you want you don't have to distribute binaries and can run a web server with a single command.

I am a real programmer™ and if there is any interest I can run a short series on how to get started with Tale. I've been wanting to do an IF game for ages and I zeroed in on Tale as my choice to do it. It would just involve me taking pictures while I do everything :P

Adbot
ADBOT LOVES YOU

Lord Windy
Mar 26, 2010
gently caress it, I'm not well today and I won't get anything done anyway.

So you want to make a Text Adventure but want to use a big kid language

Part 1 - Hello World

For this project, we are going to be using Python 3. Python is one of the biggest languages out there and is extremely easy to learn. It is the language most people first learn in university these days, and once learned you can very easily move to almost any other computer language with ease. Javascript has a lot of similarities.

To install Python 3 (there is a difference between 3 and 2) we will be using a program called Anaconda. Make sure you 3.5, not 2.7, there may be fuckups otherwise. Anaconda is very easy to install, just follow the steps on the website. To make sure it works open up a terminal, command prompt or powershell and type in the command conda and afterwards type python (or in the case of Linux/Mac python3)




If you get something that looks like this, well done! You've got it working perfectly. If it doesn't ask me how to fix it and I'll do my best. If the python doesn't start with 3.5 than try python3 instead of python.

Now we've got conda working, we need to set up something called a virtual environment. A virtual environment separates your normal python environment from one you may need to have conflicting libraries or older versions of things for. Using them religiously will avoid some other issues you can get. It will also let you delete your mistakes safely. They are also super easy to set up. Type conda create --name if_test pip to create a conda environment.



If all goes well, this is what you'll see. If it doesn't, let me know and I'll try to help. Make sure you press y to proceed.

Basically if we break down the command: conda create tells conda we want to make a new environment. --name if_test specifies the name we want to use, it could be anything. pip is a package installer we want to use. It is very important, as it will be how we will install tale. Just to confuse you all, pip and conda are both package installers, but conda works as both package manager and environment manager. Pip has what we want, but conda is just easier to set up for newbies. It will also hook right into PyCharm, the IDE we will use.

Next, type in activate if_test.



This should be the easiest part. On windows, command prompt will likely fail here. Ever OS since Vista comes with powershell which tries to emulate a more traditional Unix console. Cygwin or Git Bash will work just as well otherwise. No command prompt works well. Powershell does not!

We are now in the environment. If you are on Windows, nothing will look different. Macs and Linux will get something at the new line letting you know that you're in if_test. At this point, we can get started with installing Tale. pip install tale will download



If you get any errors, read carefully. They are probably not life threatening or just provide instructions to do. If you gently caress up, create a new environment and try again.

Congrats, we now have almost everything we need to start developing. So let's get to the Hello World portion of this tutorial. It's been all boring up til now. Lets make sure we can run Tale at all. It comes with a copy of an example. We're going to run it as a webservice, mostly because that is my favored form of running games. python -m tale.demo.story --web



You should see this come up if all goes well. Again, tell me if it breaks.

Type/copy the address into your browser and if you're greeted by this:



Then congrats!!!

Part 1 - Complete.

Next will be the start of the game itself. I'll be running through how to create your player character, rooms, how to move between moves and maybe NPCs.

Lord Windy fucked around with this message at 08:42 on Mar 15, 2016

Lord Windy
Mar 26, 2010

Megazver posted:

This is a fun way to gently caress around with Python but not what I'd recommend to anyone who actually wants to publish text adventures.

I disagree. GPL may not be ideal but the library itself is fantastic. Since it is just a library, anything you don't like you can just replace whatever you don't like with your own implementation. It has everything you need to get going. Plus, Python is probably the easiest real language to get into next to Javascript.

Lord Windy
Mar 26, 2010

John F Bennett posted:

Well, I would really like to see the rest of this if you're still up for it.

edit: For those who want to create a text adventure but don't want to do programming, there is also Adrift. I have used it years ago and found it fun to create something with it.

I'm writing it up. Hopefully it will be ready tomorrow/day after. The example code was small, and the documentation didn't do a good job explaining how certain things happen. So I did a heap of playing around to get to grips with how Tale loads rooms/npcs/actors. It isn't necessary to know that to code with Tale well, but I wanted to be able to say how things work instead of leave it at 'here be dragons".

Lord Windy
Mar 26, 2010
Part 2 - Let's get started with Python

Python

I can't teach your how to program basic python in the scope of this tutorial. I do want to make sure you understand that it is one of the easiest languages to learn and there are thousands of amazing free resources. Start at code academy and once you finish unit 4 you will basically have everything you need to get started. I can't really judge how long it will take, but I think maybe 2 hours. If you can, finish the whole thing but it isn't necessary to get started, it would be more to understand several things. You can find more tutorials for python after you finish code academy, but really all you need is Google after that. If you don't know how to do something, just google what you want to do in plain english with python at the end and you will get a result.

Don't be scared of code and programming. At this point in computers, it's pretty much just a craft like needlework, painting or carpentry. There is a minor mound of knowledge you need to know to get started, the first thing you make will be poo poo and you need to keep at it. Then you're going to think you're getting somewhere, make more mistakes and then finally everything will be easy. If you don't believe me look at this from other coders:



This guy explains it better than I could. So please keep at code when you reach the point where it looks hard and you don't think you can do it. It's just computers that are dumb and not you!

I will keep things as simple as possible. You don't have to worry about speed (writing or execution) on projects like these!

Intro to IDE's

An Integrated Development Environment is a fancy type of Notepad. They come with a bunch of nice things that make programming easy. The main two we are concerned about are "Intellisense" (Detecting errors and giving the reason and how to fix them) and a "Run" button (so you don't have to use a command prompt to run the code). Some people you know may have said IDEs are a crutch, just ignore them. I think they are fantastic to start with so you only have to be concerned with writing code and not build systems. If you like using an IDE, use it to your hearts content and ignore anyone who tells you otherwise. If you hate it, just use it for this example and move onto Atom, Vim or Emacs later on.


Pycharm

We will be using PyCharm. I'm not posting a picture of the editor just yet as I don't want to scare anyone off. Get the free community edition. You won't use any features of the Enterprise/Ultimate edition and it will be a waste of $200. Pycharm itself is excellent, I never normally use IDEs but their suite of software is frankly some of the best in the world. They only recently offered community editions. I don't know if you can sell products using it, but you can't sell Tale games anyway so we are the target demographic.

I will explain how to use the few features we need as we go.

Setting up our Project



Great so you've launched PyCharm, and you've been greeted with this screen. It is all very easy from here, select Create new Project



Extremely simple, name your project where I wrote your project name and select the environment we made. It should have python.exe at the end, and have the name of the environment in the path somewhere. It is VERY important that you choose the right one. If you can't find your environment select the little gear and choose 'add local'. If you have the environment ignore this next step.



You need to navigate to your anaconda installation and open up the envs folder. From there select your environment and expand. Inside that list a something called python.exe, this is what you must select and press ok for. For Macs and Linux, it will just be called python or maybe python35 and it may be in a second folder called bin. (That stands for binaries).

python.exe is the interpreter for python. It executes your program, and will look inside the folder it is in to find our libraries.



You should end up with something that looks like this. It doesn't look too hard now does it? I like how clean and simple PyCharm is. Most IDEs are honestly pretty frighting for newbies, but this one hides a lot of the stuff until you need it. Of course, this is probably the least complete IF in the world at this point. So let's get started.



Right click on the project folder, select python file and same it story.py.

It is extremely important that it is called story.py. Tale uses a very odd system to what I'm used to. It looks for a story.py file and then inside a zone folder finds all the modules and locations. There may be more, but I cannot find it in the documentation. This works exceptionally well, just different.




This is what it should look like. There should be an empty file called story.py.

We now get to do our first lot of programming. We're going to start with what is called the 'entry point'.



__main__ is where Unix and Windows goes to start a program. You don't necessarily need this to start a python program properly, it is just very convenient to get arguments from the command line. Like --web from before. The print statement is just to make sure it works.




To run, we right click on story.py and select Run. If we do it once you can choose the run button from the top for the rest of time.



If this is what you see this than everything is going well and we can move onto making it launch tales.



Yeah, things just started looking complicated. Don't be worried if this doesn't make much sense to you. You don't need to understand it to make IF.

gamedir is the directory where story.py is located. This is very important as I'll explain later.

gui, web, mud are true false for Tales. It gets set true if the first command after python story.py is something like --web.

run_story starts your MUD. Now this is where it gets weird, you don't do anything. Tale does it all. It will look for several things in the gamedir. Again, I will explain as I go.

If we run from here, we will get an error. You're going to have to do a few things first.

I'm going to leave it here for today. I thought I would get more done but as I tried writing out rooms, location and the main Story it was starting to get very long.

Part 3 We actually get started.

Adbot
ADBOT LOVES YOU

Lord Windy
Mar 26, 2010

Potsticker posted:

For what reason? Unless you're making very small projects with a minimal amount of files, I can't imagine any sort of programming evironment that not using an IDE wouldn't save you heaps of time.

I program most of my time in C. It's my favorite language, but I've never found an IDE that didn't want to make me tear my hair out. Most are either platform specific or require the use of some arcane build system. Clion, Pycharm's c cousin for example uses Cmake and it has the most complicated and verbose system I have ever seen. So I learned how to use Make, the most common arcane weird build system. I'm really happy I did, since I know how to use it I can build on systems that have no or few IDE options like BSDs or embedded.

You get used to not using an IDE really quickly. It's just a text editor with things built around it. I either use the Atom text editor on my windows computer or Vim with You Complete Me on my Mac. You Complete Me gives me the wavy red lines and documentation links when I need it, though I generally only use it to find the line I forgot to put a semicolon on.

Potsticker posted:

Also, why push Python? It seems to me there are way better options for beginners that are easier to dive into, yet still offer depth when needed. If the idea is a simple CYOA-style, then there's Twine. Want a structured environment with easy to understand components and a graphical interface, there's RAGS. And if you're okay with a being a little less babied, there's TADS, whose basic form is still very human readable without programming knowledge. Adrift I don't remember too much about, except that I ended up preferring TADS or Inform at the time. Of course, now Inform is a mess of trying to emulate English sentences in it's syntax and last I checked (trying to help a friend debug some IF he had written) the documentation was badly arranged and incomplete.

I'm a little biased here as I am a programmer who has never done IF before. Most of the things you've suggested are built around a core existing Engine. Now what if you want to change how the engine works? Without looking into how those options work, I'm guessing that it isn't possible/easy. Now with a proper programming language like Python, it can be very easy to change how things work in an uncomplicated way.

I chose Python as a language simply because I really liked the look Tale. My list of wants weren't huge, the Library had to be updated often, I did not want to use a platform specific language (eg, like TADS language) and the language it did use had to be easy to work with strings (which is almost all of them). Going through a database of IF engines, Tale looked superb. I was so happy with it!

potatocubed posted:

I was going to say, it looks like the main advantage of Tale is that it lets you learn Python while you tool around on your IF project. Speaking only for myself, I find it a lot easier to learn a new skill when I have a concrete end goal in mind. (I got my first Python experience trying to code a roguelike many years ago.)

Megazver posted:

I like Python as well. I just wouldn't write IF in it, unless if it was for the sake of learning Python.

I hope I can prove to you guys that it can be well worth it to write with a programming language over an existing engine. Not that I'm saying that this is better than existing engines, but that it will be more than just a learning experience.

  • Locked thread