0

Learning Lua Scripting- Part 4: Working with Strings

Posted by Dr. Burton on March 14, 2017 in Amazon Lumberyard, Corona, Lua, Tutorials |

In this tutorial, part 4 of our series on learning Lua scripting, we will look at some of the tools available for working with Strings in Lua.

Tutorial:

Concatenation in an important concept in all programming languages.  In Lua, concatenation is accomplished by using two periods in a series or ..
[codebox 1]

There are many escape sequences available in Lua including newline:
[codebox 2]

The example adds a new line (\n), a tab at the beginning of the newline (\t), and quotes around the word “newline”.  One caveat to using escape sequences; they do not require any spaces around them.

One last tip for creating strings in Lua.  If you want to create a multi-line string, you can use [[ ]] to encapsulate the string.
[codebox 3]

 

Resources

If you would like print resources, there are several books on Lua available.

Programming in Lua by Roberto Ierusalimschy, one of the lead architects of Lua.  Great technical intro to the language.



Lua 5.2 Reference Manual
also by Roberto Ierusalimschy, is, as the name implies, a less expensive reference manual.  Useful for the experienced coder who just needs to look up some of the details of
the language.

Lua Programming Gems by L. de Figueiredo, W. Celes, and R. Ierusalimschy is an older (2008) collection of code snippets that can be useful.


Editor –

We used the Zerobrane editor in all of our video demonstrations.

Our books:
We have several books on Corona and Amazon Lumberyard (both of which use Lua as their scripting language):
Learning Mobile Application & Game Development with Corona – Learn to program in Lua and how to make mobile apps! eTextbook for those who are new to programming.

Beginning Mobile App Development with Corona – Introduces mobile application development for those who already know how to program.

Game Design Fundamentals with Amazon Lumberyard – For those who are new 3D Game development, this eTextbook introduces how to make a game using Blender, GIMP, and Amazon Lumberyard.

The idea of writing a textbook on the Lua Scripting language has been floated to me.  While I greatly value Dr. Ierusalimschy, our styles of instruction are very different.  Leave me a comment if you would like to see a Lua Scripting textbook.

 

Next Lesson: Part 5 – Math and Math Library

Tags: , ,

0

Learning Lua Scripting – Part 3: Variables

Posted by Dr. Burton on March 14, 2017 in Amazon Lumberyard, Corona, Lua, Lumberyard, Tutorials |

Part 3 of our tutorial series on the Lua scripting language.  In this tutorial we explore the variable system in Lua.

Lua uses an untyped variable declaration system.  That means that you do not need to decide on what type a variable is, just declare it with the keyword local.

Lua variables can store nil, number (floating point), strings, boolean, tables, functions, userdata, and threads.

By default, any new variable has the value of nil until given a value.

That doesn’t mean that Lua doesn’t type its variables! It does.  If you use the command type, you can see what variable type is being used in the storage:
[codebox 1]

The print command in this code example will result in “number” being displayed in the console.  All numbers are stored as double precision floating point variables.

Boolean can be a little tricky for evaluation.  If the variable has no value (or nil), it will evaluate (ie. when using if..then or while structures) to FALSE.

We will explore tables in depth later, but for now, you should know that tables are declared with the curly brackets {}:
[codebox 2]

To work with the contents of a table, you can reference the object based upon the index.  Note that table indexes start counting at 1, not 0!
Thus the above code example would output the first object in the table: “a string”

 

Resources

If you would like print resources, there are several books on Lua available.

Programming in Lua by Roberto Ierusalimschy, one of the lead architects of Lua.  Great technical intro to the language.



Lua 5.2 Reference Manual
also by Roberto Ierusalimschy, is, as the name implies, a less expensive reference manual.  Useful for the experienced coder who just needs to look up some of the details of
the language.

Lua Programming Gems by L. de Figueiredo, W. Celes, and R. Ierusalimschy is an older (2008) collection of code snippets that can be useful.


Editor –

We used the Zerobrane editor in all of our video demonstrations.

Our books:
We have several books on Corona and Amazon Lumberyard (both of which use Lua as their scripting language):
Learning Mobile Application & Game Development with Corona – Learn to program in Lua and how to make mobile apps! eTextbook for those who are new to programming.

Beginning Mobile App Development with Corona – Introduces mobile application development for those who already know how to program.

Game Design Fundamentals with Amazon Lumberyard – For those who are new 3D Game development, this eTextbook introduces how to make a game using Blender, GIMP, and Amazon Lumberyard.

The idea of writing a textbook on the Lua Scripting language has been floated to me.  While I greatly value Dr. Ierusalimschy, our styles of instruction are very different.  Leave me a comment if you would like to see a Lua Scripting textbook.

 

Next Lesson: Part 4 – Working with Strings

Tags: , , , ,

0

Learning Lua Scripting – Part 2: Print and Comments

Posted by Dr. Burton on March 14, 2017 in Amazon Lumberyard, Corona, Lua, Lumberyard, Tutorials |

In this Learning Lua Scripting tutorial, we will cover the use of print for displaying information to the console and how to comment a line.

Tutorial

While I go into a much longer explanation in the video, here is the least you need to know:
Using print, you can easily see where you are at in your program and the value of variables:
[codebox 1]

As all good programmers know, comments are an essential to being able to keep track of where you are at on a large program or just to remember why you did something a specific way when you resume coding after a long weekend:

[codebox 2]

Resources

If you would like print resources, there are several books on Lua available.

Programming in Lua by Roberto Ierusalimschy, one of the lead architects of Lua.  Great technical intro to the language.



Lua 5.2 Reference Manual
also by Roberto Ierusalimschy, is, as the name implies, a less expensive reference manual.  Useful for the experienced coder who just needs to look up some of the details of
the language.

Lua Programming Gems by L. de Figueiredo, W. Celes, and R. Ierusalimschy is an older (2008) collection of code snippets that can be useful.


Editor –

We used the Zerobrane editor in all of our video demonstrations.

Our books:
We have several books on Corona and Amazon Lumberyard (both of which use Lua as their scripting language):
Learning Mobile Application & Game Development with Corona – Learn to program in Lua and how to make mobile apps! eTextbook for those who are new to programming.

Beginning Mobile App Development with Corona – Introduces mobile application development for those who already know how to program.

Game Design Fundamentals with Amazon Lumberyard – For those who are new 3D Game development, this eTextbook introduces how to make a game using Blender, GIMP, and Amazon Lumberyard.

The idea of writing a textbook on the Lua Scripting language has been floated to me.  While I greatly value Dr. Ierusalimschy, our styles of instruction are very different.  Leave me a comment if you would like to see a Lua Scripting textbook.

 

Next Lesson: Part 3 – Variables in Lua

0

Learning Lua Scripting – Part 1

Posted by Dr. Burton on March 14, 2017 in Amazon Lumberyard, Corona, Lua |

Lua has become an important player in the world of scripting. It is the scripting language used in Amazon Lumberyard, Corona SDK, World of Warcraft, Adobe Lightroom, Love2D and many, many other systems.

Why Lua?

Lua has become so popular because it is very light weight to include as a scripting language (37K!), it is easy to learn (usually less than 20 minutes if you know any other programming or scripting language), yet powerful enough to create complex applications.

Tutorial

Part 1 of our tutorial series covers how to setup your system to do Lua development (don’t worry, it’s short and painless) and provides a little history of the Lua scripting language:

Resources

If you would like print resources, there are several books on Lua available.

Programming in Lua by Roberto Ierusalimschy, one of the lead architects of Lua.  Great technical intro to the language.



Lua 5.2 Reference Manual
also by Roberto Ierusalimschy, is, as the name implies, a less expensive reference manual.  Useful for the experienced coder who just needs to look up some of the details of
the language.

Lua Programming Gems by L. de Figueiredo, W. Celes, and R. Ierusalimschy is an older (2008) collection of code snippets that can be useful.


Editor –

We used the Zerobrane editor in all of our video demonstrations.

Our books:
We have several books on Corona and Amazon Lumberyard (both of which use Lua as their scripting language):
Learning Mobile Application & Game Development with Corona – Learn to program in Lua and how to make mobile apps! eTextbook for those who are new to programming.

Beginning Mobile App Development with Corona – Introduces mobile application development for those who already know how to program.

Game Design Fundamentals with Amazon Lumberyard – For those who are new 3D Game development, this eTextbook introduces how to make a game using Blender, GIMP, and Amazon Lumberyard.

The idea of writing a textbook on the Lua Scripting language has been floated to me.  While I greatly value Dr. Ierusalimschy, our styles of instruction are very different.  Leave me a comment if you would like to see a Lua Scripting textbook.

 

Next Lesson:

Part 2: Print and Comments in Lua

 

Tags: , , ,

Learn to make Apps and Games!

Posted by Dr. Burton on January 15, 2017 in Uncategorized |

Burtons Media Group is dedicated to providing the connection between technology and education.

We have 3 textbook nearing completion:

Quantity:  

Pre-release order:

Textbooks Currently available:

File Type :

We provide FREE updates to our eTextbooks!

If you are faculty and would like a review copy of one of our textbooks, please contact sales@3.130.98.7

Brian G. Burton, Ed.D.
CEO of Burtons Media Group
DrBurton@BurtonsMediaGroup.com
Twitter: @DrBrianBurton
Facebook: www.facebook.com/BurtonsMediaGroup
YouTube: https://www.youtube.com/user/DrBBurton

0

Learning Lua

Posted by Dr. Burton on July 1, 2016 in Corona, Lumberyard, Mobile, Tutorials |

The Lua scripting language has been rapidly gaining in popularity over the last several years.  It is now the core of many popular tools including (but not limited to) Corona SDK, Amazon LumberyardAutodesk Stingray, and WoW.

As I have been preparing for my classes, I recognized that a series of tutorials in the Lua scripting language would be beneficial.

For experienced programmers, a great resource for learning Lua is the official guide Programming in Lua. There are also some great resources on the Lua.org

I will be using the ZeroBrane IDE for all of my Lua examples.

Lua receives extensive treatment in my Corona SDK books.  You can check them out on my website, Amazon, or Apple iTunes.

Here are the tutorials in order:

Part 1: Provides some background on Lua, introduces the ZeroBrane IDE and covers the obligatory “Hello World”

Part 2: Using print and comments with troubleshooting tips!

Part 3: Variables – Learn about the types of variables and taking full advantage in Lua

Part 4: Strings- How to work with strings variables in Lua.

Part 5: Math & Math Library – Lua has a lot of great math tool available.  A quick overview of how to use the math library.

Part 6: Functions – how to use functions in Lua

https://youtu.be/_nyDPEMRaDA

Part 7: Scope – Variable scope can be tricky! A quick introduction to scope in Lua

https://youtu.be/ftsJaVL5mj8

Part 8: String Library – just like math, strings have a great set of tools built into Lua

https://youtu.be/YRGxjYd8b10

Part 9: If-then: Using if-then in the Lua scripting language

https://youtu.be/yTFIbMgiRcw

Part 10: Using loops in Lua

https://youtu.be/QVvyrpp9L0E

Part 11: File Input & Output: Lua has an easy to use IO system!

https://youtu.be/t6rt6TVUxJs

Part 12: Tables – an introduction to data structures in Lua

https://youtu.be/foYvA_RDvdA

Part 13: Generic For Loops – also known as ipairs and pairs!

https://youtu.be/iaJOA47qYGE

Part 14:  Closure – No, this has nothing to do with relationships! A closure is an anonymous function… very handy!!
https://youtu.be/YzZV4VGgjXw

Part 15: OS Library – a whole host of functions such as date, time, clock, etc.
https://youtu.be/58QmUb9VRX8

Part 16: Modules – working with modules – libraries of code to make your app development faster and easier.
https://youtu.be/O2U5tae6Tgw?list=PLxgtJR7f0RBKGid7F2dfv7qc-xWwSee2O

0

8 Game Engines for your Next Project

Posted by Dr. Burton on March 27, 2016 in Corona, Game Development, Lumberyard, Mobile, Unity3D |

So you want to make that killer game ?!  If you want to jump into making the game, then you don’t want to spend time writing the engine (rendering, physics, sound, etc).  Here are a few top picks in game engines:


Cocos2D

Cocos2D is an open source (free) engine (LGPL MIT license) available for developing on the iPhone or Android.  Several popular games have been published with Cocos2D.  More information is available on their site: http://www.cocos2d-iphone.org/ or http://code.google.com/p/cocos2d-android/.  I have had several students develop with Cocos2D, but none have published a game yet.  Cocos2D is only available for the iPhone or Android.
Cost: free, MIT license
Dev. Platform: Mac (iPhone/Android) or Windows (only Android?)


Corona SDK
by Corona Labs
If you’re interested in developing 2D games or graphic software for multiple platforms, Corona provides a smart choice.  With Corona, you develop your application using lua, and Corona exports the proper code to be compiled by the proper environment.   You can easily make games or apps for both iOS and Android.  Corona supports iPhone/iPad and Android development.  http://www.coronalabs.com  We like Corona so much, we wrote several books: burtonsmediagroup.com/books/coronasdk
Cost:  Free.
Dev. Platform: Mac, Win

iTorque by Garage Games
I have been a torque developer for many years (back in the days of TGE).  I used Torque to develop the environment for my dissertation research, and taught the engine for several years at Missouri State University.  So I was very pleased to learn that GG now offers a Torque 2D for the iPhone.  Torque 2D is based upon TGB, and allows a simple port to the iPhone (assuming they don’t get caught-up in Apple’s new OS 4 language, which by the talk on their site, they don’t expect any problems).  iTorque is $750 149 for indie developers (first $100,000).  It currently only supports 2D, but a 3D version is in development. http://www.garagegames.com
Cost: $750 99
Dev. Platform: Linux/Mac/Windows

Lumberyard by Amazon
It’s not often that we get new players that create a major game engine.  Lumberyard is based upon the Cry Engine, but has been modified to streamline multiplayer.  The engine is free, but if you are going to have server you must use Amazon Web Services (that’s how they are pay for the development).  The installation is somewhat painful, but once you get it installed, wow!  Best part is scripting is in Lua, so we can leverage our Corona experience.  https://aws.amazon.com/lumberyard
Cost: Free
Dev Platform: Windows (Mac is promised for the future)
Supports VR?  Yes

Marmalade by IdeaWorks3D
Marmalade is very popular with a lot of developers and has some big name apps under it’s umbrella.  Coding is C++, but does support HTML 5 hybrid.  For game development, it utilizes Cocos2D and Box2D. It supports a broad array of devices. Trial period is short (only 30 days).
http://www.madewithmarmalade.com
Cost: $149 for iOS/Android; $499 for iOS/Android/Blackberry/WP8
Dev. Platform: Mac/Windows

ShiVa by Stonetrip
ShiVa is a 3D game development platform for developing for Linux, Mac, Windows or mobile devices such as the Android, iPhone,  iPad, and Windows Phone.  ShiVa uses a player to run the game developed on the appropriate platform.  There is a Personal Learning Edition available for free to develop for Windows or Mac.  It will run on Windows or a Mac with Parallels (i.e.  A Mac that has Windows installed through Parallels). Scripting is done in Lua.  Stonetrip is working on a solution to the whole iOS4 issue that could keep deployment happening to the new iPhone/iPads that will put everything into compliant C/C++ code and make Apple happy.
http://www.stonetrip.com/
Cost: €169
Dev. Platform: Windows (or Mac with Parallels).


Unity 
by Unity
Unity is becoming an increasingly popular engine for both the desktop and now the iPhone.  Some of my students have successfully published games and iPhone apps using the Unity3D engine (before they took my classes!).  What makes Unity attractive, especially for the student is that it is free to get started (desktop version). Scripting is in JavaScript/C#.
Following a popular licensing scheme for game engines, you do not have to purchase the pro version ($1500) until you have over $100,000 revenue in a year (VERY attractive to those who are getting started).   Again, if your company makes over $100,000, you are expected to purchase the pro version of the Unity engine for $1500. 
http://unity3d.com/

Cost: Free for basic, $1500 per pro lic., required if your organization makes over $100K (including colleges & universities).
Dev. Platform: Mac or Windows
Supports VR? Yes

UNREAL/UDK by Epic Games
Epic Games has made the UDK (Unreal Developers Kit) a lot more attractive to Indie developers.  UDK is now available free of charge for developing your game.  When you are ready to publish you pay $99 license fee.  Like Unity3D, your first sales are yours too keep: $50,000.  After $50,000, you are required to pay a 25% royalty on all profits.
http://www.udk.com
Cost: Free-ish; 25% royalty after first $50K in sales
Dev. Platform: Windows
Supports VR? Yes


What direction am I going (Updated Spring 2016)?

I have given this a LOT of thought.  I’m regularly asked by my students and others which engine(s) I am using.  For 2D development, I have decided to go with Corona SDK.  I like the platform and being able to develop for multiple mobile & desktop systems at the same time (I liked it so much, that I wrote the book).

For 3D, I have been working in VR/AR for the last several years, so we were back to Unity even though Unity is NOT supportive of higher education in their pricing model any longer.  That all changed with the release of Lumberyard.  All projects going forward will be in Amazon Lumberyard.  We were already using AWS for our server so Lumberyard is a significantly cost savings for our ongoing development.

For 3D I am leaning toward Unity3D or ShiVA.  I say that with some hesitation as I have invested a lot of time in java Monkey Engine (jME) and love to develop in Java.  That being said, Unity is very appealing as is ShiVa with its Lua scripting. With easy deployment to Windows, Mac, and Linux plus web browser, they look very attractive for my next research project (of course, jME has many of these features as well, even Android support in the next version.. thus my difficult decision).  My final 3D decision will be made once/if the iPhone OS 4 issue is resolved.

Update (2011): I have made the decision to go with the Unity3D engine for 3D development.  Thanks to an aggressive program for educational use, knowing some of the people who work at Unity, and recent advances in the engine, the scales were firmly tipped in Unity’s direction.

Note: I have included current (2010) pricing on each of these engines.  This is in addition to your developers license for the Apple iPhone ($99/year) or Google Android ($25/year).
Yes, there are other engines available (oolong, SIOS, Edgelib to name a few), but I have decided to focus on the engines I’m most familiar with.  If you would like to provide me with information on other engines, I will be happy to include it in my review.

Update: I have added the ShiVa engine to the list as well as mentioning the development environment that you will need (for those who are strictly developing on a Mac or Windows).

Update: I have updated pricing to 2016 numbers.

Tags: , , , , , , , , , ,

0

New Books Coming Soon!!

Posted by Dr. Burton on March 27, 2016 in Cloud Computing, Corona, Education, Game Development, Lumberyard, Mobile |

We have been working on several new textbooks here a Burtons Media Group.

Isometric Game Development with Corona SDK (tentative title) is a new, intermediate level book that shows how to create isometric-style games using the Corona SDK.

 

Game Development Fundamentals: Lumberyard & Blender (tentative title) is a new series on developing games using Amazon Lumberyard & Blender.  We will explore the Lumberyard 3D game engine and how to develop immersive game environments using open source or free tools.

 

Is there a particular book that you are most interested it?

Tags: , , ,

0

The Cloud, 3D Worlds, and beyond!

Posted by Dr. Burton on December 31, 2014 in Uncategorized |

There are many exciting projects in the works here at Burtons Media Group.
We have been spending a lot of time in the cloud lately.
There are several books, apps, and games in development that are dependent on a strong backend service to handle the multi-player/multi-user aspects.  We have settled on Coronium.io and Coronium.GS for handling this important aspect.  You can expect to see tutorials and books on implementing cloud solutions in the very near future.
We are also working on some projects that require a 3D engine.  Originally we were leaning toward Unity 3D, but for a variety of reasons we have begun shifting toward HTML5 engines.  We are currently evaluating several tool sets.  We’ll post the direction that we settle on and of course post learning resources as we begin developing.

We continue to update our Corona and Unity eBooks and eTextbooks several times a year.  Be sure to update your copy by clicking on the Books tab above then selecting Book-Update.

0

Corona Graphics 2.0: Composite.reflect

Posted by Dr. Burton on June 30, 2014 in Corona, Mobile |

While I have made an effort to document all of the composite, effects, and generators for Graphics 2.0 in my Corona books (see the Books tab above), there were a few that do not have a direct translation to a similar effect in Photoshop or other graphic editing tool.  Thus, I thought I would take this opportunity to provide a little bit of guidance for these effects.

In this post we will look at the composite.reflect effect.  To clearly see what was happening, I created a simple graphic to show the impact of light, dark, and grayed areas when the texture is applied to an image.
My base image is the book cover for Learning Mobile Application & Game Development with Corona.  The texture image is a simple png file that goes from red, to green, to blue, to grey.

LMGADCtexture2

 

 

 

 

The output of reflect is similar to using a colored light on an object.  The end product will show the color saturated with the texture color.

output

 

 

 

 

 

The Code Example
[codebox 1]

For more details about various composites, effects, and generators, check out Learning Mobile Application & Game Development with Corona!

 

 

 

 

Copyright © 2010-2019 Burtons Media Group All rights reserved.
This site is using the Desk Mess Mirrored theme, v2.5, from BuyNowShop.com.