Team Corona hard at work!

Posted by

Just a heads up:  We’ve got some awesome stuff coming within the next 10 days, and will be deep in the trenches putting the finishing touches on all of it until then. So, please forgive us if we become a little less responsive during that time — or if you hear sounds of loud machinery coming from our office.

Don’t worry, though, it’ll be totally worth it! ;-)

You may now speculate wildly…

 

Ready to get started?

Create amazing games and apps for iOS & Android

31 Comments

MattApril 9th, 2011 at 12:47 pm

Great, so the makeItFly and newToast() functions will be along soon ;)

JoshApril 9th, 2011 at 1:35 pm

what about makeBaconNow()?

DarrenApril 9th, 2011 at 2:32 pm

I can wait to get my hands on makeAngryBirdsClone(withTwist) function

BoboApril 9th, 2011 at 3:32 pm

This is pure BS. I’m sick of this! Haha just kidding, can’t wait!

MoApril 9th, 2011 at 7:47 pm

I vote for makeProfitableGameNow(deviceType, gameType, totalSalesNeeded)

DanielApril 10th, 2011 at 12:21 am

Have you guys release Corona UI yet? Is this it?

uapo15April 10th, 2011 at 12:40 am

I hope that we get Openfeint for Android.

too awesomeApril 10th, 2011 at 1:20 am

Im waiting for the dennys API.
grandSlam()
allAmerican()
bacon()
sunnySideUp()
sides(choiceOfSide) params; eggs, HashBrown, Suasage

NoahApril 11th, 2011 at 6:56 am

I’m anxiously looking forward to the groundbreaking new function: quitYourDayJobToFindMoreTimeToFinishYourApp() although I like the makeAngryBirdsClone(withTwist) function as well. Good days ahead!

non-scalableApril 11th, 2011 at 1:33 pm

I’d like to see them document a reasonable way to implement OOP using Corona. Lua is fine for simple games but project management is a nightmare once you try to make anything more complex, and the OOP attempts I’ve seen so far leave a lot to be desired. The spaghetti code in most of the sample projects and tutorials people create makes one cringe.

Carlos IcazaApril 11th, 2011 at 1:50 pm

@non-scalable : want to write a blog for us on the subject for OOP in Lua in Corona? You are more than welcome to do so.

everyone else : justwaituntilCarlosGetsOutofthecave() api is coming soon so watch out.

c.

DanApril 11th, 2011 at 4:18 pm

Maybe it’s just because I started programming in the time before OOP, but I don’t find it that difficult to organize Corona projects. Certainly, you won’t have the degree of organization possible within C++, but you can still stay organized.

I do hope the problem with retrieving graphics from sub folders resulting in Android crashes gets resolved soon though. Kinda puts a damper on keeping the main folder manageable.

Carlos IcazaApril 11th, 2011 at 4:33 pm

@dan : mac android : images subfolder is working in the latest bits.

non-scalableApril 11th, 2011 at 5:03 pm

@Carlos The problem is that I’m not sure it’s possible with Lua, which is why it seems to be a less than ideal choice to build the platform on. I’d love to be proven wrong though.

Carlos IcazaApril 11th, 2011 at 5:20 pm

@non

eek. even Alexander Stepanov, creator of the STL, has been known to say “I think that object orientedness is almost as much of a hoax as Artificial Intelligence…” …. and he brings a valid argument to the notion of OOP in starting everything as a class (object).

But we can sit here and discuss all the pro’s con’s of OOP, but we are here to make top games. Our Corona Framework is the right tool for building great games.

C.

WalterApril 11th, 2011 at 5:28 pm

Lua allows you to create objects in various ways (which is a blessing and a curse). One popular way is to create prototype-based objects using metatables.

There’s a discussion here (the latest edition is available in print): http://www.lua.org/pil/16.html

Here’s a wiki on all the ways to create objects: http://lua-users.org/wiki/ObjectOrientedProgramming

non-scalableApril 12th, 2011 at 9:45 am

True, you can create objects in Lua in various ways. However, none of them work well with Corona. The main problem is that you can’t subclass things like Display Objects (as you can subclass Sprite in AS3, for example). You end up with a lot of global variables and setting properties of objects from other objects, functions inside of other functions, etc.

I agree that Corona is fast for building simple games, but it gets out of control quickly. Just look at how messy the Ghosts vs Monsters project is, and that’s only 2 levels. I need 30+ levels. I just don’t see any scalability.

WalterApril 12th, 2011 at 10:02 am

Everyone’s got preferences on how to do stuff. But ultimately, your data structures and your architecture determine scalability, not the language (unless we’re talking about ultra primitive assembly languages). We’ve seen plenty of apps done in Corona with 30+ levels. Someone even wrote a level editor for his game.

As for Ghosts v Monsters, that was a challenge to Jon to write an Angry Birds clone as quickly as possible. I believe actual coding time was a handful of hours.

NoahApril 12th, 2011 at 10:59 am

@non-scalable

You should have a look at the Balloon Burst tutorial by Rafael Hernandez.

It is pretty close to OOP I think. Good enough for me at least :)

DanApril 13th, 2011 at 8:44 am

@ Carlos: thanks, I’ll rebuild and see if it now works on android.

@ non: For any game that involves multiple levels, I’d highly suggest building an engine wherein the levels can be defined by data rather than hardcoded whenever possible.

non-scalableApril 13th, 2011 at 2:40 pm

@Dan, I would love to see an example of reading a json or xml file with Corona. I can’t find anything on the site.

Jonathan BeebeApril 14th, 2011 at 4:22 pm

@non-scalable: Yes, if you implement levels in the same way as Ghosts vs. Monsters, you’ll have one huge mess.

My goal with Ghosts vs. Monsters was not to demonstrate the best way to implement levels, I wanted to demonstrate how you can create the game logic for an Angry Birds type of game in a very short amount of time.

Due to time restraints, I decided not to spend a lot of time thinking of how to modularize the levels so that I could just focus on getting things done (since that actually has nothing to do with Angry Birds game logic).

The project I’m working on right now–not affiliated with Ansca, but is definitely using Corona–modularizes all the game logic so that each level module only contains a very small amount of code–and it works great!

Maybe when I get some time I’ll create an example that shows how you can create levels in a non-messy fashion by modularizing all the game logic.

Adam from Crawl Space Games recommends using inheritance in Lua and describes how he did it in Zombies Ala Mode here:

http://www.crawlspacegames.com/blog/inheritance-in-lua/

I personally don’t go that route, but you might prefer it. I personally just stick with modularizing game-logic code and accessing it via the different level modules (which contain only level-specific code, not everything as with Ghosts vs. Monsters).

non-scalableApril 15th, 2011 at 9:47 am

Yeah, I’ve managed to create a decent workaround for OOP. What I’m struggling with now is the fact that there seems to be no way to read in json or xml files with Corona. I want a single “Level” lua file that will set itself up based on an external file. That way I’d have 30 json or xml files that simply specified all the properties of each level, such as the positions of tombstones or wood blocks in your game.

TomApril 15th, 2011 at 2:35 pm

@non-scalable

Corona (and Lua) does support XML and Json data. There are a number of free Lua libraries available. The new CoronaUI includes a XML parser and you can download the Weather_async_demo app from the Corona Code Exchange, which reads and displays XML weather data.

As for json, check out the json.lua library file in the Facebook sample code.

non-scalableApril 15th, 2011 at 2:58 pm

I know there are generic lua xml and json libraries, but they all assume you already have the xml text. But how do you read an xml file into Corona? The ParseXmlFile function in CoronaUI reads from the system resources directory, which is not where my level files would be. I need to read xml files that are in the application bundle.

TomApril 15th, 2011 at 3:25 pm

The application bundle is the system.ResourceDirectory. XML and jason data can be read from a server or local file you bundle with your app or create and store on the fly.

non-scalableApril 15th, 2011 at 5:03 pm

@Tom, I found the CoronaUI xml parser (undocumented in CoronaUI-spec.pdf), but can’t get it to work.
local xmlParser = coronaui.newXmlParser()
local xml = xmlParser:ParseXmlFile(“level1.xml”)

print(xml["level"]) –nil
print(xml[1]) –nil

for i,val in ipairs(xml) do
print(i,val); –never happens
end

KapilApril 19th, 2011 at 10:35 pm

@non-scalable You Just need to set that XML file in your Resource Directory and use it as follows..

e.g.

local filePath = system.pathForFile( “game_config.xml”,system.DocumentDirectory)
local file = io.open(filePath, “r” )

if file then
– read all contents of file into a string
local contents = file:read( “*a” )

xmlTree = XmlParser:ParseXmlText(contents)

io.close( file )

end

Then in XmlTree u will able to get all your XML Data and Accordingly You can generate Levels…

KapilApril 19th, 2011 at 11:44 pm

How do i access xml attributes in above example????
like
How do i access this 1??
I doesnt get it..

Please Help

carlos m. icazaApril 20th, 2011 at 8:51 am

@kapil

best place is to ask in our forums.

C.

Leave a comment

Your comment