Team Corona hard at work!
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…
Posted at
12:01 pm, April 9th, 2011 in
Announcements
Great, so the makeItFly and newToast() functions will be along soon
what about makeBaconNow()?
I can wait to get my hands on makeAngryBirdsClone(withTwist) function
This is pure BS. I’m sick of this! Haha just kidding, can’t wait!
I vote for makeProfitableGameNow(deviceType, gameType, totalSalesNeeded)
Have you guys release Corona UI yet? Is this it?
I hope that we get Openfeint for Android.
Im waiting for the dennys API.
grandSlam()
allAmerican()
bacon()
sunnySideUp()
sides(choiceOfSide) params; eggs, HashBrown, Suasage
I’m anxiously looking forward to the groundbreaking new function: quitYourDayJobToFindMoreTimeToFinishYourApp() although I like the makeAngryBirdsClone(withTwist) function as well. Good days ahead!
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.
@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.
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.
@dan : mac android : images subfolder is working in the latest bits.
@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.
@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.
@non
see : http://developer.anscamobile.com/code/object-oriented-sample-game-framework
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
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.
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.
@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
@ 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.
@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.
@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).
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.
@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.
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.
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.
@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
@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…
How do i access xml attributes in above example????
like
How do i access this 1??
I doesnt get it..
Please Help
@kapil
best place is to ask in our forums.
C.