Best Practices in Coding

WrightWorth

I've just finished the tutorial in Quest and I'm quite excited to begin crafting my game. But I'm afraid I'm starting too ambitiously. A major part of the game I'm planning involves an elevator. I've searched through the forums and found that Jay already has a code sample for elevator action: https://textadventures.co.uk/forum/samples/topic/3212/elevator-action. He mentions that he has "learned a lot" writing the code. Meaning, even he, a more experienced coder found the task a bit of a challenge--more so, if I, a beginner, would dare to do it. That said, I don't want to borrow Jay's code sample because I feel like it wouldn't be mine. I feel like I have to earn it first by studying code and then attempt to build an elevator myself.

I need some help and the kind of help I'm asking for is some direction because I'm really in the dark here. Ideally, I was hoping for some coding tutorial as comprehensive as the Quest tutorial (haha) but after searching the forums, there is none. So, I'd appreciate it if people could suggest paths I could take after having taken the tutorial. I learn by doing so the "functions", "types", and "elements" tabs in the Quest documentation are all Greek to me. Code samples would be great if only I knew where to start because there are so many. It would be helpful if for example, you could reply a list of links which point to the best practices in coding that would not only help me get a feel of coding language but preferably, something that would train me in building an elevator as Jay did. I'm also asking for advice if I should sign up for coding websites like CodeAcademy so I could learn more extensively. I'm an avid adventure game fan and I feel like I could develop games like The Longest Journey and Life Is Strange someday but first I have to start by building this elevator for my first textadventure. Any help and moral support would be awesome. :)


The Pixie

Quest uses its own coding language, so websites like CodeAcademy may not be so useful (and Jay was presumably talking about learning the ideosyncracies of Quest).

I have a large number of tutorials, most of which are for coding:
https://github.com/ThePix/quest/wiki

This one, for example, takes you though building a very simple lift system:
https://github.com/ThePix/quest/wiki/Transit-System


OurJud

Out of sheer curiosity I looked up the two games you dream of developing, and if you can do either of those with Quest, then you're nothing short of a miracle worker, let alone a good coder.


WrightWorth

Thank you Pixie for the tutorials. I think they're exactly what I'm looking for. :D
And OurJud, of course I don't hope to make those kinds of games with Quest because in the first place these are obviously not textadventures anymore and already incorporate graphics. What I meant to say is that Quest is a way for me to begin exploring my aspirations in developing games. The most important thing for me in any video game is the story and Quest can help me develop my skills for storytelling.


OurJud

Ah, fair enough.


Anonynn

I know this doesn't exactly pertain to your question but it may help you to develop bigger games with Quest and trust me, it's a LIFE SAVER.

Open a Word document...or Excel. Whatever you're most comfortable with.

After that, make a list of every single variable as it appears in your game. It'll help you keep track of everything so much easier. Trust me. For big games you'll need it.

Anonynn.


hegemonkhan

I myself found quest 4 years ago, having zero coding knowledge, but I've been able to learn coding all thanks to quest, and am taking programming classes now at college (and was amazingly very well prepared for them, all from/thanks to quest! Well, quest helped for the first/basic programming classes, as the higher ones are about stuff you won't/can't learn from quest and most basic coding sites, as higher programming classes go into coding design / data structures, Assembly: low-level languages, and the computer archetecture: the circuitry design, logic gates and the different physical components/modules built of-from them. Though Jay, Jaynabonne, is a user/moderator here, who has lots of programming exerptise, was gracious to help me with assembly, so I was able to get help on it indirectly from quest as well. There's some really knowledgeable coding users here, as resources as well as the quest software itself. Pertex and Sgreig are also extremely knowledgeable, and of course Pixie, and Alex himself as well, though he's moving on now from his Quest endeaver/development. We also have some very knowledgeable users too, some stay, but some leave, but quest has picked up a lot recently, so hopefully we'll get more experienced coders as users).

this is what I'd recommend:

  1. download notepad++ (a really great free editor for coding: reading, writing, editing, troubleshooting, and understanding code, as it color codes the code, as well as having many coding languages, and lots of great editing features/capabilties that I still need to learn, lol):

https://notepad-plus-plus.org/

a 'text editor' software (examples of 'text editor' software: notepad, wordpad, Apple: text editor, etc --- BUT NOT THESE FOR CODING as they're just for basic normal writing/'ms word' editing. Notepad++ is an example of a text editor for coding editing or just even just basic normal writing/'ms word' editing as it has really useful features/capabilities, but it's much more useful for coding) is good for reading/writing/troubleshooting code, but it's not an IDE/SDK that let's you compile, link, and test/run code. if you're interested in being a programmer, you need IDEs/SDKs.

https://en.wikipedia.org/wiki/Integrated_development_environment
https://en.wikipedia.org/wiki/Software_development_kit

some of them (free ones, though some of the sites make it difficult/confusing to get to the free versions... of course... grr, and also got to make sure you're going/getting to/the legit software of them):

(these do use up a pretty lot of space/memory, be warned)

MS Visual Studio (C++)
?Python SDK/IDE? (forgot it's exact name)
JDK (Java)
Netbeans (Java)
Eclipse (???)

and here's a very good site for various software (including some of the IDEs/SDKs: see 'Developer tools' and 'Runtimes' sections/categories):

https://ninite.com/


and for general coding, codecademy.com, is good for beginners and up. There's also 'udemy'(.com, I preseme) I think, but I've not tried it, and I think it is for more advanced coders... but not sure, and there's tons more sites, including infinite coding forums you can use.


  1. learning the basics of (using) quest (its GUI/Editor and all of its basic capabilities) and getting a taste into the mindset of coding / game making ("if" usage), which will take quite a while to slowly train your brain in, as it's not natural thinking.

tutorial ( http://docs.textadventures.co.uk/quest/tutorial/ )

try to do everything in the tutorial, ask for help if you need it (most people including myself have/had trouble with the orc/saying/bob/defibrilator parts --- these are definitetely the hardest parts of the tutorial --- frankly they shouldn't be in the tutorial as they quite advanced compared to the rest of the basic stuff that is the tutorial)

  1. unfortunately, actually trying to do your own stuff yourself for/in your own game, is very different from the tutorial giving you specific things with step by step instructions, on doing them. Also, you're likely finding yourself overwhelmed, as while doing the tutorial steps by steps made sense, you're now on your own, and are confusing and not understanding truly all the concepts and terms that you thought made sense through the tutorial, you're overwhelmed, confused, and lost. This is where I myself found myself. There's a huge gap/jump from the tutorial to trying to do your own stuff yourself for your own game.

XanMag has tried to help bridge this huge gap/jump, via his tutorial 2 'templates and tutorial' demo game, which helps guide you through, step by step, a lot of the basic things you want to do in a game. So, I highly recommend this after doing the tutorial:

http://textadventures.co.uk/forum/games/topic/5940/quest-tutorials-and-templates-published

  1. however, to truly make a game, you need to learn the "bread and butter" of game making / coding: Attributes and the 'if' Script usages, as these, especially, when used together, let's you do 90% of everything you want to do in a game. The basics of using quest, only enables so much. Learning Attributes usage and the 'if' Script usage, opens up 90% of the game making possibilities for you, indeed these are... "THE TWO SUPER SCRIPTS". You can try using my guide or there's Pixie's guides on trying to learn this stuff.

http://textadventures.co.uk/forum/samples/topic/5559/attributes-and-if-script-guide-by-hk

  1. next or along with #3 or instead of (before) #3, I'd recommend starting by learning and understanding this:

http://docs.textadventures.co.uk/quest/guides/character_creation.html

as it helps with some basic Attribute and 'if' Script usage (as well as also the very useful 'show menu / ShowMenu / get input' Scripts/Functions as well as a taste of using the much more advanced but extremely useful List Attributes)

  1. after the 'character creation', look at (study / learn) other guides/code samples --- coding / libraries / etc (especially use/study Pixie's and Jaynabonne's guides --- most guides are Pixie's --- he's/she's a beast with helping others by all the public guides!) and also get more familiar with quests capabilities (it's Scripts, Functions, Elements, Objects' Attributes, Attributes: Attribute/Data Types, Scopes, and etc --- see the top menu items on doc site/link):

http://docs.textadventures.co.uk/quest/

http://docs.textadventures.co.uk/quest/guides/
http://textadventures.co.uk/forum/samples
https://github.com/ThePix/quest

http://docs.textadventures.co.uk/quest/scripts/
http://docs.textadventures.co.uk/quest/functions/ (categorical order)
http://docs.textadventures.co.uk/quest/functions/index_allfunctions.html (alphabetical order)
http://docs.textadventures.co.uk/quest/types/ (Attributes: Attributes / Data Types)
http://docs.textadventures.co.uk/quest/elements/ (these are the 'physical things' of quest / quest's coding)
http://docs.textadventures.co.uk/quest/elements/object.html (the built-in Attributes of the 'Object' Element)
http://docs.textadventures.co.uk/quest/scopes.html (a convenient link/page for/of just the 'Scope' Functions/Scrips --- they can also be found in the 'Scripts' and/or the 'Functions' links)

  1. learn using Lists/Dictionaries (List/Dictionary Attributes), iteration, looping, and etc:

http://docs.textadventures.co.uk/quest/guides/using_lists.html
http://docs.textadventures.co.uk/quest/using_dictionaries.html

http://textadventures.co.uk/forum/samples/topic/5137/list-and-dictionary-extensive-guide-by-hk
http://textadventures.co.uk/forum/samples/topic/5138/explore-and-travel-code-sample-by-hk

  1. keep learning more and more, and/or more advanced coding stuff...

if you want to see my own struggle with learning quest and its coding:

http://textadventures.co.uk/forum/quest/topic/3348/noobie-hks-help-me-thread


getting better at coding/design/practices, comes with time and experience and practice... the most important thing is "getting it to work", as you can forever, improve upon code.... perfectionists like me (well, a wanna-be / attempting perfectionist, lol) fall into this trap... always trying to make code better... all that matters is getting it to work... and as you improve... you can go back and improve your old code and/or organize it better... but don't get trapped in constantly trying to improve code, as there's no end, code can always be improved and/or better organized...


Quest is it's own coding language 'aslx', but generally can be broken up into two parts:

1. the "physical/body or English language analogy: nouns", which is similiar to 'xml/html' (web) languages: the 'tag' ('<xxx>xxx</xxx>') coding
2. the "actionable or English language analogy: verbs", which is the 'scripting' (any NON-tag coding), which is similar to C++/Java scriptings

(3. Attributes are a weird/strange hybrid of 1 and 2, think of them as like 'traits/characteristics or English language analogy: adjectives/adverbs', but aren't truly either 1 or 2, either --- They're hard to explain conceptually at least for me)

quest also shares some features of Python (Lists/Dictionaries)

quest is also able to use JS (JavaScript) and CSS/UI/GUI stuff too (I don't know this stuff yet)


depending on the software's programming, your coding can be read by the computer/software horizontally or vertically, however, usually coding is vertical (as 'blocks'), as it's easier for humans to read (actually horizontal coding is nearly impossible for humans to read), unless it is just a short coding line, then it's usually written horizontally (as 'lines')

  1. here's some example of the 'tag' coding:
<asl version="550"> // beginning of the 'asl' tag block
  // your entire game content/code goes here (EVERYTHING MUST BE IN THIS 'asl' Tag block), so the/this 'asl' tag is technically your actual GAME/GAME OBJECT
</asl> // end of the 'asl' tag block

// ---------------------------------------

// this is just your 'game settings/etc' Object, it's NOT your actual full/entire game / code / content. Yes, this is a bit confusing.
<game name="xxx"> // beginning of the 'game' tag block... I think you get the idea now...
  // the various global/game-wide settings/controls/actions-scripts, the 'start' Script (this stuff is done at the beginning of the game, so it's good for intro dialogue/character creation like stuff), and whatever-like (author, version, firstpublished, etc), Attributes go here
</game> // end of the 'game' tag block... I think you get the idea now...

<object name="xxx">
  // content
</object>

<function name="xxx">
  // content
</function>

<verb>
  // content
</verb>

<turnscript name="xxx">
  // content
</turnscript>

<type name="xxx">
  // content
</type>

etc Elements

scripting examples:

// my way of explaining the scripting's generic syntax forms:

NAME_OF_OBJECT.NAME_OF_ATTRIBUTE
or
NAME_OF_OBJECT.NAME_OF_ATTRIBUTE = VALUE_OR_EXPRESSION
or
NAME_OF_OBJECT.NAME_OF_ATTRIBUTE = NAME_OF_OBJECT.NAME_OF_ATTRIBUTE OPERATOR VALUE_OR_EXPRESSION
or
NAME_OF_FUNCTION/COMMAND
or
NAME_OF_FUNCTION/COMMAND (Arguments/Parameters: inputs)

// -----------------------

if (test.score >= 90) {
  test.grade = "A"
} else if (test.score >= 80) {
  test.grade = "B"
} else if (test.score >= 70) {
  test.grade = "C"
} else if (test.score >= 60) {
  test.grade = "D"
} else {
  test.grade = "F"
}

set (player, "strength", 100)

player.strength = 100

do (player, "kiss", frog)

foreach (color_string_variable, split ("red;blue;yellow", ";")) {
  msg ("The color is " + color_string_variable + ".")
}
// outputs:
// The color is red.
// The color is blue.
// The color is yellow.

msg ("hi")

player.alias = "HK"
player.alias = john smith"

game.turn = game.turn + 1

player.strength = player.strength + 5

player.damage = player.weapon.damage + player.weapon.damage * (player.strength / 100)

orc.current_life = orc.current_life - player.damage

etc etc etc

hegemonkhan

@ Anonynn and anyone else:

you can also use library files too

http://textadventures.co.uk/forum/samples/topic/4808/organizational-designs


Log in to post a reply.

Support

Forums