This article assumes you understand the notiation for file system permissions, and have a basic grasp on the topic. If not, there is a nice starter article on the Ubuntu community wiki:
By default, when you create a file in Ubuntu as a standard user (either in Nautilus or with touch
), it gets the permission of 644
. If you mark that file as executable, as expected, it gets the permission 755
.
What may be surprising is that directories also have a default permission of 755
. Even though it seems like directories aren’t the type of thing that would be “executed”, this flag is actually very important to Linux! (and if anyone can find an article behind the reasoning behind this decision, I would love to find out)
If a directory (or any of its parent directories) isn’t marked as executable, you cannot cd
into it. Although it is browsable in Nautilus, trying to write anything to the folder results in a “forbidden” or “insufficient privileges” error message. Some commands (like ls
) work on the directory, while others (such as stat
) do not.
Links (both to files and directories) have the permission 777
, which I’m assuming is done for the similar reasons as the executable bit on directories.
For external harddrives, USB drives, or SD cards that are mounted in /media/<username>
, if you haven’t manually changed either the mount settings or file system format of the drive, the file system type is likely to be either Fat32
or NTFS
. Here, the file permissions are going to be different, with a value of 600
for files and 700
for directories. Links remain the same at 777
, though it is unclear to me if links created in Linux are stored differently or not on foreign file systems.
As far as I can tell, there is no way to change file and directory permissions, or even mark files as being executable without changing the mount settings, so all files are always stuck with a privilege of 600
. This makes sense as such file systems don’t use the same type of permission settings for files, so storing the permission data would be difficult. In fact, I’m just glad we are able read from and write to those types of file systems from Linux at all!
These are the default values for file permissions in Ubuntu 13.10. They may be the same in other Linux distributions, but I have not been able to verify this personally.
In a standard ext3 file system
644
files755
executable files755
directories777
links to files777
links to directoriesFor removable media (Fat32) and windows partitions (NTFS)
600
files (can’t be executable)700
directories777
links to files777
links to directoriesWhile you can display the permissions of files in a directory with ls -l
, that information isn’t very easy to read:
1 2 3 4 5 6 7 8 |
|
Instead, you can instead use the stat
command to display permissions in the more friendly “octal notation” (source):
1 2 3 4 5 6 7 |
|
And if you want to tweak the output further (such as to tell us whether an item is a file, directory, or link), see the following page (or just run man stat
) which lists all available options:
Unrelated but important side note: Since you are tagging in Git, you are using the -a
flag, right?
You could delete it and re-add it, but all the hard work you put into writing the tag’s description would be lost.
Instead, choose the place in your history where you want the tag moved to, tag it like you usually would, but add -f
(or --force
) to the command; that extra flag will allow you to replace the other tag with the same name. And a pleasant surprise appears if we try to overwrite an existing tag:
1
|
|
Hey! That’s my old tag description! Now you can edit it if you want, or just save it as the way it was.
If you have already pushed the tag to the server and want to fix that, first make sure your local version of the tag is correct. Then all you need to do is make another push
using the same -f
(or --force
) flag.
1
|
|
Remember to alert any other developers on the team if you ever “force” a change like this. If they still have an “old” version of the tag around, it may cause conflicts when they try to push to the server!
Say someone else moved a tag, but the version in your local repository still points to the old commit? First, delete the local tag, then pull in the changes from the remote repo; the new tag will be added automatically.
So, for example (in my case, the tag name is v2.56
and the remote repository is named origin
):
1 2 3 4 5 |
|
In this example, the --tags
flag was actually optional, since git fetch
will by default automatically fetch tags along with any modified branches. But there is no harm leaving it in there for clarity.
If you use GIT in Ubuntu, you may be used to this seeing this several times a day:
Tired of constantly typing typing in your credentials? (especially since GitHub requires an alpha-numerical password, so your standard, “easy-to-type” one won’t do)
SSH is more secure (and although I have not confirmed this officially, it seems to transfer faster than HTTPS). If it is at all possible, use SSH instead of HTTPS. I would be using SSH myself if it wasn’t for a known bug in the modem required by my ISP which constantly drops the connection mid-transfer; Damn you Telia!
When using SSH, you only have to “generate” a key once for every computer you use, store it in the appropriate directory, and every time you connect to GitHub, that key will be used automatically:
If it’s just an issue of blocked ports, GitHub does provide a service for creating an SSH connection (usually port 22
) through the HTTPS port (port 443
) which may get past most firewalls. I’m unsure if this is preferable to connecting over HTTPS or not, but at least the option is available:
SIDE NOTE: There are a lot of old solutions circling the interwebs involving either setting credential.helper
to store
, or by using netrc
, however, in both of these cases the password gets stored as plain-text on your computer. This is usually not ideal.
Instead, you can use gnome-keyring
to store your credentials more securely (thanks to James Ward and marcosdsanchez for this solution). This solution assumes you are using GIT 1.8.0 or newer, which if you installed it via apt
, you are. If not, you can find the latest version of git from the following URL:
1 2 3 |
|
If you are using Arch Linux, you will require a slightly different command, and if you are using OS-X or Windows, GitHub has provided a short set of instructions to use the same GIT feature:
After typing in your user-name and password once the next time you are prompted for it, the credentials should be stored, saving you a lot of typing in the future. If that worked, you are done.
If you really want to require entering your password when connecting to GitHub (perhaps you are dealing with security software and want to avoid any loopholes) but are just tired of typing it in all day, you can configure GIT to store your password for a limited amount of time.
By default, GitHub will store your credentials for 15 minutes. If you want to increase or decrease this amount, use the following command:
1
|
|
Replace 900
with the amount of seconds you want the credentials to be saved. Personally, I would recommend 5 hours (18000
seconds) if you work in an office, and 12 hours (43200
seconds) if you work from home. If you don’t want this setting to apply for all your repositories but only for the current repository, remove the --global
flag.
1 2 |
|
The average developer doesn’t include those extra braces on the second line, and in fact, many will even keep everything on one single line. (You could also pull the braces down so the block of code occupies a full 4 lines of code, but that seems highly unnecessary.)
1
|
|
The reason I add these otherwise unnecessary braces is primarily for debugging. Say in our sample code, the data isn’t arriving at the server; a good developer goes back to make sure the data is being sent in the first place. The following function looks correct (and as a side note should work in a white-space oriented language such as Python), but does not function as expected:
1 2 3 4 5 6 7 8 9 10 11 |
|
A good developer is smart enough to add the required brackets when adding the “debugging code”. I prefer adding the brackets preemptively; the extra time it takes to wrap the code in brackets isn’t that valuable to me.
(I also have a personal philosophy that if
, for
, do
, and while
should always be followed by an open bracket containing code rather than just code on its own, but that just has to do with the way I view the language as functioning behind the scenes. But it’s more difficult convincing other developers based on those grounds.)
I thought the only place to mark which files to hide was inside of a .gitignore
file, ideally placed at the root of the repository. As a result, I would list all files and folders I may want to ignore inside of it. [1]
Instead, GIT has provided us with four places to provide file name patterns, each with its own intended purpose (some descriptions have been taken verbatim from the docs):
Sent as command line arguments (Only supported by some commands) – Mostly only useful for scripts or “temporary exceptions”.
A .gitignore file in the project directory – Patterns which should be version-controlled and distributed to other repositories via clone (i.e., files that all developers will want to ignore)
In the file .git/info/exclude – Patterns which are specific to a particular repository but which do not need to be shared with other related repositories (e.g., auxiliary files that live inside the repository but are specific to one user’s workflow)
In the configuration variable core.excludesfile – Patterns which a user wants GIT to ignore in all situations (e.g., backup or temporary files generated by the user’s editor of choice). Note that you can set the global config value, so every single project you work on will always ignore those pesky files such as Thumbs.db
.
There are also further technical details in which ignores take precedence etc. in case anyone wants some heavier reading:
super()
in your constructor’s code, the Flash compiler will automatically append it to your constructor’s code.
Turns out, this isn’t entirely true. The compiler only adds super()
if it doesn’t see it written out in the constructor. It makes no distinction whether you actually call it or not. Here is a simple little trick if you want to completely hop over calling super()
when creating a sub-class.
If you want more reading on the matter, this information was taken from a forum thread by Krilnon over at the Kirupa forums.
But remember, as I brought up in the forum thread linked to above:
In my opinion, this is pure evil! No good can come of not calling constructors, none at all…
So use with caution!
]]>To assist in choosing a community, I have compiled a list containing details about various communities and my experience in using them. As I haven’t been to every community out there, I would appreciate if you leave your own recommendations and detailed experiences as a comment below.
The list only contains ActionScript communities, but some of them cover other programming languages or topics as well. But remember, if you want to ask a question on a specific topic, you will get much better results asking in a community that specializes in that topic.
For instance, if you had a Java question, you could ask it on the Kirupa forums in the Other (Java, C, C++, etc.) section, but I recommend tracking down a forum with its main focus on Java. Similarly, Box2D and Flixel questions could go in a standard ActionScript forum, but will likely get better answers in their Box2D and Flixel forums.
The Kirupa Forums are my “home”; my forum of choice.
In the beginning, I bookmarked every ActionScript forum I could find, from ActionScript.org to an obscure section of the forums at ArmorGames. Not sure which forum was “the best”, I would sometimes ask the same question in several places (in my defense, I didn’t know any better).
I eventually started using the Kirupa forums more and more. I don’t remember all the reasons why, but one major factor was that I often got better responses there, and would often get tied into long conversations. But in the end, the reason I finally settled down at the Kirupa forums is the same reason that I use ActionScript; it’s not necessarily “the best”, I’m just used to it. I’m very comfortable there, and have had no reason to switch to a new forum.
The Kirupa Forums are just the right size. There are enough experienced ActionScripters (and even helpful beginners) to answer nearly every question within a day or two of its being posted. The questions that usually end up unanswered are the poorly written ones and “not-really-questions” like “i need to make a music player in flash cs5 that uses xml. help plz.”
Sure, in a larger forum there are many more people answering questions, but after a few hours your question is already on page 2, which as we all know is where forum threads go to die. By then, no one except Google searchers will find your thread! Personally, I’m not a fan of huge forums.
To boot, The Kirupa Forums have a nice set of tutorials, and also run contests with prizes from time to time. I thoroughly recommend The Kirupa Forums to any new ActionScripters.
As Kirupa.com is the only forum I’m familiar with enough to give a full review, I don’t know how other forums compare. Let me know what forums you have used, and how you feel about them in the comments below and I’ll add your experiences in here.
Although I haven’t gotten deeply involved with this community, only using it on occasion, I feel it is a brilliant and magnificent way of asking and answering questions.
Unlike “traditional forums” where responses appear from top to bottom in chronological order, the best answers on StackOverflow “float up” to the top. There is no “chit chat” or “small talk”; even the comments that aren’t actually “answers” are small and out of the way. It’s questions and answers, pure and simple.
In the beginning, your powers are quite “limited”; you can’t “upvote”, use links in your answers, or give those comments that aren’t direct “answers”. To earn more privileges, you need to earn points by asking and answering questions well. Unlike Expert’s Exchange (mentioned below), these points don’t go away, but serve as a guard to keep spammers and “low quality askers/answerers” out. But as soon as you have racked up enough points to gain the trust of StackOverflow, you are free to ask, answer, and even edit across the site.
There are more things I love about StackOverflow’s q/a system, but they are beyond the scope of this article and will have to be saved for another blog post.
Be careful with this one. Experts Exchange is a paid service, and in my experience people tend to “expect more” out of a service they spent money on. I have more than once ran into people with the mindset “I payed good money to ask a question here, and you have the audacity to accuse me of using the wrong publish settings? I don’t need this kind of treatment!”
Note that this is only my personal experience. I have had positive responses as well, and others may also have had different results with EE.
Second, Experts Exchange really wants to earn money. It’s not enough that people have to pay to ask questions there, but if you have ever stumbled across them on Google, you know that you can’t even read answered questions without a paid membership. (Exhibit A)
You don’t need a paid membership to get started at EE; you can still see and help answer unanswered questions with a “free account”. If you answer enough questions each month, you get a “free one month membership” which includes asking questions and viewing answered ones.
But if your amount of answered questions per month dips down below the minimum, you are back to a “free account” until you “earn enough” by answering questions. This is regardless of how many questions you answered in the past. The “monthly minimum” isn’t high, but I still find what they are dong to be tacky and close to extortion.
The good news is, if you answer enough questions, you get a free t-shirt. :)
Even though many have moved on to “better technologies”, there is still a slew of great Flash developers on Twitter, especially in the “game development” crowd. You can learn a lot from the things they tweet, and even start some pretty nice conversations.
Remember that many developers have busy lives outside of Twitter. If you do use Twitter to ask questions, as in all communities, sometimes it’s better to ask a “crowd” of people (in this case, Tweeting to all your followers), rather than bothering a single person with your problems.
You would be surprised how often people ask for programming help on Twitter. If you are a fan of answering questions, keep an eye on the #as3 and #flashdev tags if anyone needs help. Some Twitter applications, such as TweetDeck, help you “monitor” tags and receive instant notifications when someone uses it in a Tweet.
The 140 character limit could be quite limiting, so sometimes it may benefit to invite the user to continue the conversation via an IM service such as Skype. If you don’t like giving out your Skype username online, create a new account used only for assisting people with ActionScript. This will also keep your programming contacts separate from your personal ones.
I’m not an IRC person; I have used it, but I don’t frequent anywhere. If anyone knows of any good IRC hangouts, please share them in the comments.
TODO: Insert conclusion that leaves readers inspired to go out and find a community to settle down into.
]]>If you need any help with code but are working on a low budget, I’m your man. I also do tutoring, helping to explain anything you may have missed or still don’t understand fully when learning a new programming language.
We have all been in that situation. You need a small feature added or have a minor item that needs fixing in a programming language you either have never used or are still new to. You have two options.
Spend the next seven hours (or more) digging through Google trying to find something similar, and eventually hack and slash together something that sort of works the way you want it to.
Hire a professional at $75 per hour to do the job.
I have been faced with these choices, and it saddens me that I nearly always choose option #1, wasting hours of my time when someone familiar with the language could have done it in 15 minutes. But if I hired a professional to help me out for every 15 minute job that blocked my path…
Although I reserve the right to decline any job, contact me if you need assistance with any of the following:
Fixing/Tweaking existing code – Do you want that menu on the left instead of the right and to expand when you click on it instead of hovering over it? I’ll fix that.
Debugging – I love searching for and fixing bugs, I don’t know why.
Explaining code – I tend to get illustrative when explaining concepts in programming. Some find this uneccessary, but for others (including myself) it makes concepts easier to understand. Though usually my explanations aren’t that long.
Writing code – I will only write code for small and sometimes medium sized projects. If you want to create a MMORPG from scratch and need a free coder, search elsewhere. But if you want a script to verify the user’s email address when they submit a comment, perfect!
I am very comfortable with ActionScript, and have a firm grasp of the basics and syntax of PHP, JavaScript, and Java.
I am not a designer. I can only help with code, not making things look nice (which includes HTML and CSS).
I can be contacted via the form below, or via the media listed on the contact page.
]]>In the meantime, enjoy the following informative (and practical!) articles by Jackson Dunstan:
To say that I have been “programming” since I was 13 would be a stretch. I knew how to write code, but I was crippled by how much Visual Studio.net generated automatically for me. I never learned many of those automated tasks manually.
Aside from a programming class in high school with a fantastic teacher, I’m entirely self taught. Being self taught is usually viewed as a great thing, though I cannot figure out why.
For an embarrassingly long time I had large “gaps” in my knowledge. As one of many early personal examples, I never learned how to properly use for loops, so I tended to avoid them. In addition, I didn’t realize you could access indexes in arrays with variables, and would instead copy and paste lines several times, filling in hard coded numbers.
Today, I still suffer from this. All but the most basic and common design patterns are still unfamiliar to me. In fact, properly organizing large projects is still a mountain of a task. I’m not done learning.
Perhaps this problem would not exist if I had taken a single course from start to finish. I would take on new information one idea at a time and in an organized manner, rather than jump around from tutorial to tutorial picking up bits a pieces, missing chunks along the way.
There are beginner guides galore to any programming language or library you could imagine, from professional companies such as Lynda and Envato, to independent bloggers such as Untold Entertainment, Michael James Williams and Emanuele Feronato.
Alas, few beginner tutorials prepare you for the “road ahead”. In my experience, the most difficult stage in learning a new language is \“I know the basics and the syntax. Now what?\” During the “intermediate” phase, technical manuals and papers are too advanced, while beginner tutorials are too simple. Either there are too few resources for intermediate developers, or they are too diffiuclt to find.
It certainly isn’t a help when beginner guides will take shortcuts (such as using timeline code rather than teaching to properly write classes) in an effort to make the new information easier to absorb. But similar to the “automatically-generated-behind-the-scenes code” in Visual Studio.net, this may have crippling effects on the students.
On a related side note, successfully self-taught musicians sit down with their instrument of choice, and after much practice one day produce golden melodies from the tips of their fingers (or lips, depending on the instrument).
Can the same really be said for developers? I doubt anyone has summed up their history with “One day I sat down at a compiler, not having read a single book on Objective C. It was hard at first, but after months of trial and error, my fingers eventually produced gold.”
Yes, you may not have gone to an “official” school, but most books and online tutorials are set up in a manner similar to how you would learn a subject in a standard classroom.
Perhaps all the self-taught developer can say is “The internet taught me.”
As mentioned, I can only speak from personal experience on being self educated. I have not taken any college level classes on software development, so I can’t compare my expertise before and after the course. Would I still be facing the same problems after leaving college, or did I miss something crucial learning on my own?
I need more input. Are you a self taught developer? If so…
Engineers, Architects, and Chemists work with their hands on “real life” projects. They of course use their problem solving and thinking skills in their line of work, but in the end, they get paid to develop specific products with practical uses.
Mathematicians and Theoretical Physicists do the exact opposite. They spend all day thinking, pondering, and mediating; finding better ways of describing the universe, and using their minds to solve problems that may not even exist in real life. (Yes, I skewed those descriptions to fit the point I’m making.)
Sometimes their work has practical applications, sometimes it does not.
Similarly, Theoretical Developers are software developers who are more concerned with solving “theoretical” problems than getting any actual work done. When a problem arises, it is more beautiful to develop a solution where all the pieces fit together perfectly than to “Just git ‘er dun”.
Software Engineers and Software Architects on the other hand use software development as a means to an end, a way to put food on the table or get a website up and running. They are more willing to take shortcuts even if doing so may break the Sacred Laws of OOP. These people have also been caught placing code on the main timeline. (yuck!)
These elusive creatures often appear in the wild among Open Source Activists, Wikipedia Authors, and alas, some among Pyromaniacs, starting flame wars, aggressively trying to convince others that their technology is the best.
Some spend hours ranting on how the syntax for programming languages should theoretically be written, even though there is no chance of those changes being applied to the language (ahem).
Or sending code for game prototypes to potential employers that doesn’t actually run because the only code written so far is for a collision detecton API, rather than having focused on making the game playable.
I have previously jokingly compared Software Engineers to “women of the night”; just getting the job done for the pay check. I wish to revoke that statement, pleading beginner’s insanity (see Mount Stupid).
In fact, when comparing the progress of theoretical developers to that of “real developers”, usually it’s the developers working on “real” projects that become successful. And as already mentioned, there are developers who love programming, while still earning money from the products they create (double bonus!).
So which one are you? A Software Engineer, a Theoretical Developer, or a mix of both?
Or perhaps the Theoretical Developer is just a fancy name I invented as an excuse for my lack of “real life” progress…
]]>The following guide was written for 32bit FDT5, but may still work for future or previous versions of FDT. These instructions can of course also be used for any application that doesn’t come with an Ubuntu installer, adjusting the files appropriately.
If you are running Ubuntu, I’m assuming you already know how to use the basics of the command line and how to manipulate (create, delete, change permissions) of files. If anyone wants more details, post a comment and I’ll clarify.
I’m assuming you have already downloaded FDT (they have a free version if you aren’t already using FDT) and extracted the archive.
I would recommend saving the files to /opt/fdt5
(may require admin access, which is easily done without messing with the command line by running gksu nautilus
, assuming you are still using the default file browser) Depending on what extraction tool you use, you may also need to change the permission settings for the files to allow folder access for all users.
If you want to do this the easy way, download the pre-made files from the GitHub repository and install them to the locations specified in the README.
https://github.com/IQAndreas/FDT-Ubuntu-Launcher-Files/zipball/master
You are all done. Enjoy!
Alternatively, you can do all the dirty work yourself (if so, keep reading).
Create a new file named FDT5.desktop with the following contents:
If you want the file to be available to all users of the computer, save the file in
– /usr/share/applications/
Alternatively, if you only want the currently logged in user to have FDT show up in the application menu, save the file to
– ~/.local/share/applications/
Next, create the following script, and save it as /usr/bin/fdt5
Note that the script may be a tad more complicated than it needs to be, but this is the script I’m using since I had to jump through a few hoops getting FDT to work properly in Ubuntu.
You also need to set the icon for the application. The default Eclipse icon is okay, but on my system, both Eclipse for Java and FB4Linux use that same icon, so I would prefer being able to tell them apart.
I included FDT’s fancy, blue dodecahedron icon in the repository, used with permission from Powerflasher GmbH. You can use the icon provided in the repository, or use your own, but which ever icon you use for FDT, make sure to save it to /opt/fdt5/fdt-icon.png
Finally, if you want FDT to stay in the launcher bar, start up FDT, right-click the icon in the launcher, and make sure “Keep in Launcher” is checked.
If the built in FDT SWFViewer quits improperly (which happens from time to time when running into AS3 errors) it will not open the next time you run the SWF. The solution is to delete a few config files for the plugin, which is a simple task, but gets annoying when you need to constantly delete the files.
The following script will delete said config files (assuming FDT is installed to /opt/fdt5
as recommended) though I wish FDT had a button for this inside the IDE instead.
Save the script to /usr/bin/fdt5-clean
and run it by typing fdt5-clean
into the command prompt. The script does not require admin rights to run as long as your FDT install folder has full permission for all users.
Leave any further questions or problems in the comments and I’ll try to help sort them out.
]]>MovieClips
are garbage collected? Is setting everything to null
enough?int
instead of uint
because it’s more efficient.while(--i)
instead, because it is much more efficient than for
loops.hitTest()
is really slow! Every site tells me I should never use it.My answer to all those questions: Don’t worry about it.
Don’t get me wrong, if you are the type of person who worries about these sorts of things right now, you will make a terrific developer one day! But worrying about these things now is just going to make your code more complicated and much more difficult to manage.
As a beginner, this should be your first and foremost rule. If you scratch your head every time you read your own code, coding will be overwhelming and debugging will be hell.
Take these two identical chunks of code as an example:
The first chunk of code is much more efficient than the second, but I wouldn’t want to be the developer that find bugs in that project.
Not at this point, no. First make sure you have learned the basics and syntax of ActionScript. Then, make sure you really know the basics of ActionScript (instead of just thinking that you do while perched on top of mount stupid. Believe me, we have all been there). Finally you can start learning about standard coding conventions and basic performance improvements.
Keep in mind, most performance optimization tips (such as using int
instead of uint
) will shave milliseconds off your total time if you do tens of thousands of calculations each frame.
Often times, the extra milliseconds won’t make a hill of beans difference, so worrying about them while writing the code is a waste of resources. Test your code, and make sure your project works. Then, if (and only if!) there is a problem with performance after everything is complete and working, you can go back and find which areas need optimizing.
Same principle as with optimization, don’t worry too much about garbage collection unless you are building an enterprise-level application. Flash is actually pretty good at taking care of things for you and making sure everything gets disposed of properly. Even if it misses an image here or there, what is one measly Bitmap for a computer with +2GB of RAM? Users won’t notice the difference if your game uses 17 MB instead of 16 MB.
And remember, it’s all disposed once you close the SWF anyway.
]]>Adobe recently announced that they will no longer be releasing updates for AIR for Linux. This saddens me, mainly because the reason I switched from working with .Net to Flash was the “multi-platformness” – the ability to compile once and have your game or application run on any operating system (it has a proper name, but it’s still on the tip of my tongue).
A few games in previous Humble Indie Bundles were actually Flash games (even if the players don’t notice it); Samorost 2, Machinarium, and Trauma. Even though Flash can’t make the most powerful of games, it’s fairly obvious that Flash games are at least playable.
AIR increases the functionality of Flash, and adds mobile devices to the available platforms, all with very little additional changes made to your existing game or application.
I’m sure if a small group of Flash game developers teamed up “Humble Bundle style” they could release a bundle with multi-platform, DRM-free AIR games, with proceeds either going towards charities, or perhaps towards the open source developers working on the AIR binaries for Linux. In either case, the bundle would provide positive publicity for AIR.
I don’t have the influence or resources to do this, but do you?
]]>Remember the good old days of playing Pac-Man at the arcade, burning quarter after quarter until you were #1? You could then laugh in the face of the last high score holder, and brag to all the local children and challenge them to beat your score. (Or maybe not, I was born a few years too late for the glory days of arcade games, so I’m guessing at how the high scores worked back then)
But today, with the rise of flash games, no matter how hard you work at getting to the top, your fantastic score of 189,335 points will place you at position #24,890 in the high score list, with the top scores always being held by cheaters or some Asian kid with an abnormal talent for games and hours of time on his hands.
Perhaps I’m just a pessimist, but if there is no cosmic chance of me even showing up on the top 100, what’s the point of replaying the game to get a better score?
So, what do you think? Did the widespread availability of the internet and the surprisingly large amount of people on this planet kill the classic high score system? (leave a comment if you disagree, I could be wrong)
Or is the high score system still kept alive by Facebook games where you only see the scores of your friends?
I recently purchased the game SpaceChem by Zachtronics Industries.
SIDE NOTE: I have long been a fan of that developer’s flash games, and I’m happy his newest creation is having so much success. SpaceChem is one of my favorite games, and I would really recommend it if you enjoy puzzle games, and it definitely helps if you have a “programmers mindset”. You can grab the demo if you want to try it before purchasing the game.
SpaceChem does an amazing job at including a high score system without “intimidating” the score you worked so hard for.
When you have finished a working design, you see a bar chart of how creation’s efficiency compares to the average user. This allows you to see which areas you could realistically improve your score without being blown out of the water by Sum Yung Gui from Beijing.
If you know of any other games with unique and brilliant high score systems, share them in the comments.
]]>Already the game has had some positive media attention, from interviews on both local radio and television, to several internet news sites including Yahoo news and BoingBoing.
After only having been released for soon two weeks (as of today, June 4, 2011) the game has received about 200,000 plays and $2,500 in donations (and more is likely to follow as time progresses).
Is the game deserving of all this media attention by being awesome and fantastic, with hours of intricate puzzles, stunning graphics, and gripping story lines? No.
Then why so much popularity? The graphics, sound effects (including most of the dialog), and story were all designed by a 5 year old, little girl.
Assume for a second that this game had been released on Newgrounds (which is, from what I hear, the #1 portal for Flash content with not enough quality to be allowed on portals with “higher standards”) and Ryan Creighton (the father and lead developer) had proudly announced that he had produced the game all on his own.
Ryan could then sit back and expect a steady stream of classic Newgrounds comments such as “OMGWTF gay”, “-9999/10”, and “giv me my 2mins of life bak”.
At this point you are probably calling me an insensitive prick and have likely already started to flame me in the comments. But, I am trying to make a point here.
This game takes advantage of at least two “weaknesses” (couldn’t find a better word) of human nature.
First, people love babies, young children, and kittens (for various reasons; you can likely dig up a lot of research on yourself). Anyone who doesn’t believe me apparently doesn’t have family members who have learned to use the “forward” button on their emails.
Seb Lee-Delisle’s iPhone app, Kitten Conveyorbelt, is another game which takes advantage of this exploit ($1 for a slideshow of cats, seriously?)
Somewhat related, the “8 Beyblades for sale on eBay”, despite having several “fake bids”, still received a lot more bid amounts than selling the Beyblades on their own would have. Why? People feel sorry for these crying little children and their situation.
(Next time you try selling your car, include a picture of yourself next to it crying and see if it also works with grown-ups)
Second, humans (at least the empathetical ones) will value items and achievements higher if they were produced when the “creator” was under certain limitations (in the case of Cassie Creighton, limitations in age and game development experience).
On a related note, even I can draw better than this elephant! Why don’t my YouTube videos get 6.5 million views?
Other than the obvious point of “Taking advantage of human psychological flaws leads to more attention and in return buckets of easy money”, there is a broader point to be made (which is by far no new idea):
Presentation is key
As I still haven’t produced even a single game, I feel like some sort of hypocrite (did I use that word correctly or is there a better term?) telling people how to design their games. After all, what do I know?
Luckily, the principle has many more applications. Often when presenting something, you are very limited, such as the title of a blog post, description of a game, or a small introduction in a conversation or speech.
Presenting any creation as “just another of many” will quickly cause the listener to loose interest. What makes your product unique? How does it stand out from the rest? (Note that I do not support lying or over-exaggerating in order to glorify what you are selling! Scumbags…)
Perhaps it will gain more attention if you release it for a good cause, such as donating all income from a game to earthquake/tsunami victims.
Perhaps even take advantage of a few other human psychological flaws, such as curiosity to reel in your listeners (this blog post title got you here, didn’t it?)
I simply cannot end a discussion on exploiting human psychology without bringing up Apple.
As I have said many times before (which someone said before me, but I don’t remember the source), Apple sells a religion, not a product. When you buy their iPhone, you buy an experience, and a ticket into the community of awesome people.
In a nutshell “Cigarettes Apple’s products make you look cool!”
It’s possible, but I doubt it.
This may be a good place to add that all donations and income from Mochi Ads are going directly to Cassie’s college fund (so help her education, and donate! Link is on the game’s page).
Alas, I am neither a Vulcan nor a sociopath, and susceptible to the same flaws of human psychology as everyone else, so yes, I thought it was cute.
The one thing in specific I enjoyed were the small witty bits of dialog. They reminded a bit of the the comments found in Lemony Snicket’s books (sample excerpt).
My favorite quotes from the game (spoiler alert)
Your’e a mouse now. How do you like THEM apples?
That’s what you get for being evil! AND a lemon!
Neither, by writing this post I’m avoiding the PHP work on my plate, and since I’m still getting something done, I can avoid the feelings of guilt that come from procrastinating my real work.
]]>Click the image to go open the SWF
The code is written in AS3 and uses Box2D for the physics and MinimalComps for the components.
At first I wrote the code up as a prototype just to test a concept (and rather than rewrite the code cleanly, I just kept adding onto it so it became one tightly-coupled mess).
I later entered it into a contest held on the Kirupa Forums, and modified it slightly to fit the contest theme.
The source is available on GitHub in case anyone is curious how it was achieved (and yes, I did cheat. It’s not actually dynamic. The movement of all those shapes are “pre-baked” during the “Loading” screen and simply played back afterwards, which is why it is able to take up so little CPU on playback.
]]>TODO: Insert chapter 1. (I was too lazy to repeat the steps just to take screenshots of the process. I don’t feel like going through that again.)
TODO: Insert chapter 2. (Same reason as for chapter 1)
Stay tuned for “Chapter 4: The Code Signing!”
]]>This part describes how “Event Bubbling” works. Note that this is a strong simplification of the actual system (which is a bit more complex, but in the next part I will elaborate on that system), but for 99% of all Event uses, this is the only thing you really need to know about Event Bubbling.
At the office I work, a large part of our work system is set up as a hierarchy of responsibility and work delegation.
At the very top of the tree is Mr. Stan Stage. He’s a great guy. Very friendly, a nice father figure, and a really good boss. He is the boss of all bosses, and in the end, everyone reports to him.
Since there is so much information passed around the office each day, he delegates most of the tasks to a handful of people who work right under him. These people are all “second in command”. One of these second in command is my boss. Unlike Mr. Stage, my boss is very annoying and difficult, and to avoid his wrath, I will exclude his name, and instead just call him “My Boss”.
My Boss has about 20 people working under him, including me. It’s not a great position to be in, but it’s still a very rewarding job. Some of us “third in command” workers have people working directly under us.
I am one of the lucky ones, and have five interns working directly for me. Since I am their boss, they obey my every whim, such as getting coffee for me each morning, or taking out my dry-cleaning. Even though they are only interns, they are still considered to be “fourth in command”.
Since a great deal of what we do at the Office is reported via Events
, my interns are expected to use the event system to report any changes just like the rest of us.
For efficiency’s sake, my five interns have their desks very close to my cubicle, so whenever they dispatch
an event
(by standing up and shouting for example “I was hovered!”) I hear it immediately.
Now, there are two types of Events; Events that Bubble, and Events that do not Bubble.
Some Events are only important to the person to which it actually happened. For instance, one day one of my interns, Chris, stands up and yells “Hey everyone, I got a new car!”
1
|
|
A few of my other interns reacted. However, I honestly did not care. My Boss sure as hell doesn’t care. And as nice of guy Steve Stage is, he really doesn’t care either.
I’m not saying that Chris’s Event
wasn’t important, in fact, it was quite important since it allows him to do his job better and will definitely affect his work. However, there is no need to tell as many people about it as possible. The only people who need to know about the event are people who specifically asked Chris to let them know whenever he got a new car.
1
|
|
Those Events do not Bubble up the corporate ladder.
Now, clicks are VERY important in my line of work (in fact, that’s how we get paid).
We want to let as many people as possible who want to know about the clicks to know about the clicks, but if every single person just stood up and yelled “Someone was clicked!” whenever they found out about it, it would be one disorganized mess and you would hear about the same gossip from eight different people. Instead, we have an organized system for letting everyone in charge know about it.
One day Chris stands up and yells out to everyone “I was clicked!” (dispatching
the event
to everyone that may be listening
to him. Not many people are usually listening to Chris (in fact, most people at the office don’t even know any of my interns). So, Chris only tells everyone specifically listening to him about the "click"
event.
Then Chris walks over to me and says “Andreas. I was clicked. All the information on the click is available in this Event folder.”
Now it’s my turn. I stand up and yell “I was clicked!” (I could tell them “someone in my department was clicked”, but since my interns work for me so closely, their work is considered to be part of my work) A few people are listening to me for the "clicked"
event, (including Nico and Bob) and walk up to me asking for more information. I give them both the file so they have all the information on the event that they need.
Then, I barge into the office of my Boss, telling him all about the event, and handing him a copy of the information. He in turn switches on his fancy intercom system (since he is second in command, he gets certain perks, and is paid too much to have to yell across the hallway) and announces to everyone in the office “Attention anyone who is listening to me. I was just clicked.” A few people are listening
to him, and respond.
Finally, my Boss knocks on the door of Steve Stage and tells him all about the click event. Now, at last, Mr. Stage announces the "click"
event for the last time, telling everyone who is listening
to him about the “click”.
After that it is done. Everyone who needs to know about the Event
knows about it.
Let’s take the example of Betty, who works in accounting. In order to do her job property, she needs to know about every single time a client "clicked"
an employee.
She could listen to every single employee for the "click"
event, but this is a VERY inefficient system. And every time there is a new employee she would need to start listening to them, and when an employee leaves, she needs to remember to stop listening to them.
Instead, because of our nifty little bubbling system, Betty ONLY needs to listen to Mr. Stage for the "click"
event. Since those events bubble
up to Steve Stage, she will be notified of every single click event directly from Steve Stage.
Let’s say one day I’m working at my desk, when a client "clicks"
me directly instead of clicking one of my interns. I stand up and yell to everyone who is listening to me that “I was clicked”, but I do not need to directly tell any of my interns about the click. Unless my interns are specifically listening to me, they will not know about the click and will keep carrying on their work undisturbed. The interns will NOT dispatch any "click"
event either.
The only one who needs to know is My Boss. The events only bubble “up” the corporate ladder, not down.
In order to file the proper paperwork (and hand out promotions or raises where needed) Betty needs to know exactly which person it was who was "clicked"
first. Luckily, all this information is perfectly filled out in the Event
object (the folder containing all the information).
There are two names in the Event
object, target
and currentTarget
. Flash assigns these two names automatically when the Event
is dispatched.
These two properties tend to cause a lot of confusion among beginners. Sometimes they refer to the same person, sometimes they do not. To explain the difference, let’s take another example.
Nico is listening to me for the "clicked"
event.
1
|
|
Chris, my intern, is clicked, and stands up and tells everyone about it. Nico doesn’t even know Chris and therefore doesn’t even know about the event. Chris tells me about the event and hands me all the information.
Now, I stand up and tell everyone “I was clicked”. Nico is listening to me (Andreas) for the event, and walks over to gather all the information.
Then the event continues to bubble upwards to My Boss and finally Stan Stage.
target refers to the person who first dispatched the event. In this case, Chris would be the target. currentTarget refers to the person you were listening to who told you about the event.
Think about currentTarget
for a second. For Nico, currentTarget
would refer to me, Andreas. However, since Betty is listening to Stan Stage for the Event, the currentTarget
property in her event file would refer to Mr. Stage.
Why does the currentTarget
property even exist? I mean if you added the event listener to an object, of course you know what that object is, and therefore the property is pretty much worthless.
However, if used properly, it can save you a lot of code! For instance, perhaps you have several buttons on the stage homeButton
, aboutButton
, contactButton
, newsButton
, etc. You want the button to scale up when it is clicked. You could add the event listeners like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
|
That means, creating a different handler function for each button, which works, but creates a lot of extra code. Then if you want to change details of what happens when a button is clicked, you would need to update every single function.
Instead, you can create one single function which handles the clicks of all buttons. You can calculate which button needs to be pressed by using the currentTarget
property.
1 2 3 4 5 6 7 8 9 10 11 |
|
That’s a lot less code! Now, if you need to change the scaling to 1.3, you only have to update it in one single place!
If you want to attach additional properties to the buttons, (such as setting some custom scale value for each button) you can use the Dictionary object. Look in the FAQ under the appropriate category for links to explanations and example code: http://iqandreas.blogspot.com/2009/09/most-common-flash-questions-as3-faq.html
This is how Flash bubbles its events.
Next step, how to make your own events bubble (The fourth part of this series is still on my TODO list ;)
]]>I originally wrote this thread as a response to a Kirupa forum thread: Passing a string to be a custom event
This is my first draft, so any opinions or thoughts are deeply appreciated, especially if there is anything you still don’t fully understand or would like me to clarify further.
Listen, don’t tell my boss, but those days when work gets slow, I fire up some StarCraft! StarCraft is no fun alone, so Nico, Bob, Larry, and I all play against eachother. The problem is that we all need to be logged on at the same time in order to play together. I’m the one who plays the most, so I am the “Game Master”; the one who starts up the server, chooses a map, and waits for everyone else to join in.
We need some way to alert each other when I start up a StarCraft game, and keep it a secret from my boss (he reads all our emails, so I can’t tell them via email). So, we use the Event system!
We have planned that whenever I am about to start up a new game, I stand up and yell out to everyone “I am about to call Yamato
!” (who our boss assumes is one of my Japanese clients)
Everyone knows that the custom event string
(also known as event type
) for when everyone listening should play starcraft is "Yamato"
. So, ahead of time, Nico, Bob, and Larry listen for my "Yamato"
event:
1
|
|
Now, we may start playing dozens of different games, and I have chosen a different “code name” as the event string for each type of game:
1 2 3 4 |
|
Now, I could create a different type of Event
Folder for each type of game, such as StarCraftEvent
, RuneScapeEvent
, AOEEvent
etc.
Each type of event file would have information inside of it, for instance, the StarCraftEvent
Folder may have the following properties:
– target – Me, since I’m the one “dispatching” the event
– type – the custom event string, in this case “Yamato”
– map – the StarCraft map we will be playing in
– players – a list of all players
– settings – the game settings
And our class would look something like this (note that target
and type
are automatically inherited by the Event
since you extend
it)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
This would be my totally custom made event class! Perfectly customized for whenever we want to start a StarCraft game, allowing everyone to get the information they need!
This is exactly as simple as it was dispatching the "clicked"
event:
1 2 3 4 5 6 |
|
That dispatches an event which alerts everyone who is listening that I am about to start up a StarCraft game.
So, Nico, Bob, and Larry run up to my cubicle and I hand them all the StarCraftEvent
Folder containing ALL the information they need to join in the game.
Now I can create a new Custom Event for each and every game we play and that would alright.
But I noticed, no one really reads the information in the Event
Folder! I spent good money putting together and printing out all the information for those folders, and no one reads them! They get the file from me, then run back to their own cubicles, fire up the game, and throw the Event
Folder directly into the trash.
Surround your pullquote like this {“ text to be quoted ”}
Instead, what if I print out a plain old Event
Folder? All it says is the target
and the type
, but if they want more information (which someone once in a while does) they can ask me for it directly.
FORGET about the hassle with the StarCraftEvent
class, and just do this:
1 2 |
|
99% of the time. That is all you will ever need. You save a lot of unnecessary work.
You don’t always need to create custom Events, usually it is enough just using custom Event Strings.
That is Custom Events 101
Continue to Part #3 – Easy Event Bubbling
]]>