• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
  • entries
    707
  • comments
    1173
  • views
    432745

1GAM March and new Scribe feature: calling labels by variable

Sign in to follow this  
Followers 0
Programmer16

715 views

So, I started working on my March game for One Game a Month which is going to use both my GameJolt library and Scribe. It is going to be a roguelike (coincidentally; I had decided to make it a roguelike halfway through February, before they had decided on the theme lol) based on a short story I have (almost) finished. The story has a post apocalyptic setting and revolves around a young man named Henry on a quest to find his dying father some help.

Here is a shot using placeholder art:
Screenshot2.png
This is a shot of the starting map: the bunker you and your father are living in. You wake up and the power is out; you check on your father (top right bed) and he has you go check on the generator (which is obviously not in working condition, seeing as how the power is out.)

I ran into some issues with Scribe here, mainly due to the lack of support for nested conditionals and loops. I was going to try to implement them (which I've already tried before), but I decided to take a whack at implementing another feature: calling labels using the label name stored in a variable. This kind of simulates a switch statement. Here is an example: if @fatherState == null @fatherState = 0 goto @fatherState 0:LockInputSay "Henry, can you go check on the generator?"yield @someoneIsSpeaking == trueSay "Don't forget that the password is 34719"@fatherState = 1yield @someoneIsSpeaking == trueUnlockInputgoto exit 1:LockInputSay "I thought you were checking on the generator?"yield @someoneIsSpeaking == trueSay "Remember, the password is 34719"yield @someoneIsSpeaking == trueUnlockInputgoto exit exit:// Since we cannot nest conditionals or loops// we use a label.

So, the first run of the script fatherState will be null, so we set it to 0, then we jump to the label 0, run through it's commands, set the state to 1, and then jump to exit. Every run after that we will just jump straight to 1, run our commands, and then jump to exit (I know that it seems kind of redundant to put the "goto exit" right above the label since we would fall through to exit, but this way we are all set if we need to add more states.)

As a side note, this is what I would consider proper use of the yield command. When I call the Say command it creates a label, positions it at the top of the screen, makes it visible, sets the variable someoneIsSpeaking to true, and then creates a task that will set someoneIsSpeaking to false and hide the label in 3 seconds. Remember that yield is the opposite of while: it loops until its condition is false and it is best to use the condition that will cause the loop to break if the variable isn't updated. This is why I check against true; if the variable isn't set it will be null and if it is ever set, it will eventually be set to false. If we used "yield @someoneIsSpeaking != false" and the variable is never set, we'll end up with an infinite loop.

Anyway, you can now call labels using literal values or variables (obviously they have to contain a valid name.) I'm going to take another whack at implementing nested conditionals and loops, but for now this should get me by. For now I am off to try to get some more work done on the story.

[edit]
I decided to sit down and focus on nested conditionals...thirty minutes later and viola, Scribe now supports them (testing nested loops at the moment.) Here's an example script: @var1 = 10@var2 = 3@var3 = 10 if @var1 > 4 if @var2 > 5 if @var3 > 6 Console.WriteLine 'All are true' else Console.WriteLine 'The first two are true' elseif @var3 > 6 Console.WriteLine 'Only the first and third are true' else Console.WriteLine 'Only the first is true'elseif @var2 > 5 if @var3 > 6 Console.WriteLine 'The last two are true' else Console.WriteLine 'Only the second is true'elseif @var3 > 6 Console.WriteLine 'Ony the third is true'else Console.WriteLine 'None are true'

[edit]
And now nested loops are in: @index1 = 0 while @index1 < 3 @index2 = 0 Console.WriteLine 'Index1:' @index1 while @index2 < 3 @index3 = 0 Console.WriteLine ' Index2:' @index2 while @index3 < 3 Console.WriteLine ' Index3:' @index3 @index3 += 1 @index2 += 1 @index1 += 1

Getting both to nest properly took a bit of work now and will be a bit of work to refactor, but it is definitely a feature that was needed. Now to verify that mixed nesting works properly.

1
Sign in to follow this  
Followers 0


0 Comments


There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now