Some misc newbie-type questions

Hello all,

I would like some clarification of some various (random) questions i have to make sure everything is ok or if i’m doing things wrong, etc… Any replies would be great!

  1. Fonts - if i use a specific, unique font for my app, i include the file. However, what if i use, say, Helvetica or Impact or some generic font found in macs (and only develop for iOS), would i still need to add the font to the app? Say i use Impact, do i still need to include the font?

  2. In some of my files, at the top i define a variable local mr = math.random(). Later in the code, i may then use something like: local i = mr(1,10). Do i still need to define a randomseed before or after my local mr? Or can i assume everytime local i will be a random number between 1 and 10?

  3. If your app is ready to deploy to corona’s servers, should i comment out or delete completely any print comments/code? What happens when i leave print code in the file (i use these for testing/debug), does it simply do nothing except take up just a little more space in file size?

  4. Naming an app - my first app i’m building is a simple quiz type game, nothing fancy (or special for that matter!). I’ve already noticed some similar named apps on the app store (iOS) by different developers/people and was wondering what is the rule of thumb here if the name is something generic like Maths Quiz or Brain Training? I don’t think these generic type of words are trademarked (its like not say Angry Birds or Tiny Wings), so can i use this as part of my app name?

  5. I want to start using my game dev moniker and not my personal name. Can i change my username and email with my Corona SDK? Or do i have to de-authorize my current version and re-download it again using my new credentials?

Apologies for the long newbie questions, but thanks for reading!

Cheers, [import]uid: 175094 topic_id: 35682 reply_id: 335682[/import]

Sorry, regarding point 5, i just found in the account link when logged in there is a small edit text link, and in this page contains your username and email. So question, can i simply change this to AwesomeNewName and email@awesomeNewName.com respectively? And essentially continue using corona installed on my mac?

Also want to add:

  1. Apple submission - my current apple id is my personal email, for which i have loads of app purchases, etc. If and when i submit my app, do i still use my own personal log in and simply specify my AwesomeNewName (and contact email) within the profile/account pages? Or should i create a new apple id and use that instead? Does anyone here separate the two - personal and work?

Thanks! [import]uid: 175094 topic_id: 35682 reply_id: 141897[/import]

  1. Fonts depend on the platform; iOS and Android don’t always have the same ones. Anything that is already included in iOS does not need to be manually included. You can look at iosfonts.com for an accurate list.

  2. I’m led to believe you only need to set the seed value once.

  3. Somebody else can better answer but to my understanding prints are okay, warnings are not?

  4. Generic can be okay I think but you have to be a bit careful; for example Brain Training might be trademarked by Nintendo.

  5. I believe you can change your forum name in your user settings here. Click the “account” link at the top of the page once you’re logged in.

  6. Unless you have a business ready to go you’ll have to submit under your personal account. It’s safe to use your existing apple ID but I know some folks use a different one. I don’t believe there is a way to transfer your iOS development license between accounts though so keep that in mind [import]uid: 41884 topic_id: 35682 reply_id: 141898[/import]

I’d like to add to Richard’s posts.

  1. Fonts. Many fonts like Helvetica are copyrighted and you cannot legally distribute them with your app. If your device has Helvetica then you can use it but you can’t include it. There are very few fonts that are common to all devices. iOS will handle Helvetica. You can do device detection to set reasonable defaults for the various devices.

  2. Do you need to seed the random number generator? How frequently? That answer is “depends”. You may want to have a repeatable sequence of random numbers. I once was engineering a massive-multiplayer space game. I needed hundreds of star systems, each star system had multiple planets and moons, and each planet/moon has land masses, atmospheres, cities, etc that I had to track the data for. It was enormous and frankly too big a task for the computers of that time. I was able to define each system in a single number. By seeding the random number generator with a fixed seed for each world, I could randomly generate the entire star system, down to the people living on the world with one number. Another example is card games like Solitare where you might want the player to select a game number to play the same sequence of cards over and over. In this case, you’re going to seed the random number generator with a fixed number. However… In most cases you just want random numbers and don’t care about repeating sequences, so call the seed function once at the beginning of your program.

  3. You don’t deploy your code to our servers. You deploy them to the various vendors (Apple, Google, Amazon, Barnes and Noble). It would probably be a good practice to turn off your prints before submitting them. Some apps generate a lot of messages and I’m sure the vendors don’t want to see all of that. I’ve never heard of an app being rejected for it.

I wouldn’t go and delete all your print statements. Instead before you deploy live, you could at the top of your main.lua add something like:

print = function() return true end  

Which would basically short-circuit the system’s print statement which would have the effect of turning off your print. I personally use a little more complicated version of this in my apps:

local debugMode = true  
cachePrint = print  
function print(...)  
 if debugMode then  
 cachePrint(unpack(arg))  
 end  
end  

And I just have to set the value of debugMode to either true or false.

[import]uid: 199310 topic_id: 35682 reply_id: 141918[/import]

Thanks for the replies guys, appreciate it!

I think for fonts, i may take a look at Google Web Fonts, as i seem to remember a lot of the fonts there were free to use - even for embedding in commercial apps?..

I looked at some examples of math.randomseed(os.time()) and all of them seem to simply use that actual line without attaching it to a local variable. I am now likewise doing so, although i’ve added it to my main.lua - whereas my local mr=math.random is situated within some of the levelsX.lua. o you see this as being a problem?

I’ve also actually used quite a number of _G. variables, also all defined in main, to store some game stats, because it is used throughout the whole game. After testing out the mem usage, my game seems to hit a limit of around just under 5MB total. Does this sound a lot to you? I’m actually using Director class, and as each new level is loaded, the mem usage goes up. Cycling between levels and the menu, etc, mem usage seems to go up and down. After all levels have been played, it hovers around the 5MB mark. I hope what i described is typical/normal when using Director!..

Finally, i imagine when the time comes, i’ll duplicate and create a final v1 folder and take off all the print and mem usage/debug code and clean up any other commented out code i don’t use.

Cheers, [import]uid: 175094 topic_id: 35682 reply_id: 142084[/import]

Fonts
Well, like he and I said, all of the stuff already embedded can be used freely too, but yeah, otherwise you need to look at the license to be sure. (The other important thing you need to do is actually test that the font works; let’s just say using an external font can be very hit-or-miss sometimes…)

MR
You’re just making a shortcut variable, which is fine. There is actually a minor speed benefit to localizing functions like that. If you’re not using a library function much just call it (math.random(x)) and if you’re using it a lot in any specific lua file, just make a shortcut local mr = math.random

Memory
That’s not a big number really. And storing _G. vars is not horrible. If you notice usage continuing to climb you’ve probably got a leak somewhere, but if it (roughly) stabilizes somewhere then you’re okay. [import]uid: 41884 topic_id: 35682 reply_id: 142090[/import]

Sorry, regarding point 5, i just found in the account link when logged in there is a small edit text link, and in this page contains your username and email. So question, can i simply change this to AwesomeNewName and email@awesomeNewName.com respectively? And essentially continue using corona installed on my mac?

Also want to add:

  1. Apple submission - my current apple id is my personal email, for which i have loads of app purchases, etc. If and when i submit my app, do i still use my own personal log in and simply specify my AwesomeNewName (and contact email) within the profile/account pages? Or should i create a new apple id and use that instead? Does anyone here separate the two - personal and work?

Thanks! [import]uid: 175094 topic_id: 35682 reply_id: 141897[/import]

  1. Fonts depend on the platform; iOS and Android don’t always have the same ones. Anything that is already included in iOS does not need to be manually included. You can look at iosfonts.com for an accurate list.

  2. I’m led to believe you only need to set the seed value once.

  3. Somebody else can better answer but to my understanding prints are okay, warnings are not?

  4. Generic can be okay I think but you have to be a bit careful; for example Brain Training might be trademarked by Nintendo.

  5. I believe you can change your forum name in your user settings here. Click the “account” link at the top of the page once you’re logged in.

  6. Unless you have a business ready to go you’ll have to submit under your personal account. It’s safe to use your existing apple ID but I know some folks use a different one. I don’t believe there is a way to transfer your iOS development license between accounts though so keep that in mind [import]uid: 41884 topic_id: 35682 reply_id: 141898[/import]

I’d like to add to Richard’s posts.

  1. Fonts. Many fonts like Helvetica are copyrighted and you cannot legally distribute them with your app. If your device has Helvetica then you can use it but you can’t include it. There are very few fonts that are common to all devices. iOS will handle Helvetica. You can do device detection to set reasonable defaults for the various devices.

  2. Do you need to seed the random number generator? How frequently? That answer is “depends”. You may want to have a repeatable sequence of random numbers. I once was engineering a massive-multiplayer space game. I needed hundreds of star systems, each star system had multiple planets and moons, and each planet/moon has land masses, atmospheres, cities, etc that I had to track the data for. It was enormous and frankly too big a task for the computers of that time. I was able to define each system in a single number. By seeding the random number generator with a fixed seed for each world, I could randomly generate the entire star system, down to the people living on the world with one number. Another example is card games like Solitare where you might want the player to select a game number to play the same sequence of cards over and over. In this case, you’re going to seed the random number generator with a fixed number. However… In most cases you just want random numbers and don’t care about repeating sequences, so call the seed function once at the beginning of your program.

  3. You don’t deploy your code to our servers. You deploy them to the various vendors (Apple, Google, Amazon, Barnes and Noble). It would probably be a good practice to turn off your prints before submitting them. Some apps generate a lot of messages and I’m sure the vendors don’t want to see all of that. I’ve never heard of an app being rejected for it.

I wouldn’t go and delete all your print statements. Instead before you deploy live, you could at the top of your main.lua add something like:

print = function() return true end  

Which would basically short-circuit the system’s print statement which would have the effect of turning off your print. I personally use a little more complicated version of this in my apps:

local debugMode = true  
cachePrint = print  
function print(...)  
 if debugMode then  
 cachePrint(unpack(arg))  
 end  
end  

And I just have to set the value of debugMode to either true or false.

[import]uid: 199310 topic_id: 35682 reply_id: 141918[/import]

Thanks for the replies guys, appreciate it!

I think for fonts, i may take a look at Google Web Fonts, as i seem to remember a lot of the fonts there were free to use - even for embedding in commercial apps?..

I looked at some examples of math.randomseed(os.time()) and all of them seem to simply use that actual line without attaching it to a local variable. I am now likewise doing so, although i’ve added it to my main.lua - whereas my local mr=math.random is situated within some of the levelsX.lua. o you see this as being a problem?

I’ve also actually used quite a number of _G. variables, also all defined in main, to store some game stats, because it is used throughout the whole game. After testing out the mem usage, my game seems to hit a limit of around just under 5MB total. Does this sound a lot to you? I’m actually using Director class, and as each new level is loaded, the mem usage goes up. Cycling between levels and the menu, etc, mem usage seems to go up and down. After all levels have been played, it hovers around the 5MB mark. I hope what i described is typical/normal when using Director!..

Finally, i imagine when the time comes, i’ll duplicate and create a final v1 folder and take off all the print and mem usage/debug code and clean up any other commented out code i don’t use.

Cheers, [import]uid: 175094 topic_id: 35682 reply_id: 142084[/import]

Fonts
Well, like he and I said, all of the stuff already embedded can be used freely too, but yeah, otherwise you need to look at the license to be sure. (The other important thing you need to do is actually test that the font works; let’s just say using an external font can be very hit-or-miss sometimes…)

MR
You’re just making a shortcut variable, which is fine. There is actually a minor speed benefit to localizing functions like that. If you’re not using a library function much just call it (math.random(x)) and if you’re using it a lot in any specific lua file, just make a shortcut local mr = math.random

Memory
That’s not a big number really. And storing _G. vars is not horrible. If you notice usage continuing to climb you’ve probably got a leak somewhere, but if it (roughly) stabilizes somewhere then you’re okay. [import]uid: 41884 topic_id: 35682 reply_id: 142090[/import]