February 5, 2010 at 2:02 am (Seneca)
As part of prepping for c3dl’s upcoming release I had modified a demo that Peter Callaghan had made into a game. Its a 3D take on the old asteroids game that is written entirely with JavaScript using webGL (If you want to play it you will need a webGL enabled browser… ) Instead of seeing your ship from top down, you see the space as if you are sitting on ship. you can rotate around and shoot asteroids that are flying towards you (hit A and D to rotate left or right). To hit an asteroid click on it.
Here is a screenshot:

My initial game was ok but had a few bugs in it. I have since cleaned it up and added scoring. I even added an end game model. One snag that I really am stuck on has to do with sound. Firstly I found out how easy it was to add sound using html5 audio tags… I thought it would be alot harder but apparently not. I added an <audio> tag to my page, and in the js just loaded it and played. about 5 lines of code in all… however I have hit a few snags and I am not sure why.
Firstly, I couldn’t get the audio to load in Webkit… I thought at first that it was because the format (ogg) was unsupported so I put in a bit of code to load an mp3 instead but that didn’t work either. I’m going to have to probably play around with a simpler demo first. I’m trying to find out if it needs to be enabled right now (like webGL) but so far have not found anything about having to enable it.
The other problem I ran into which I really really don’t understand is that on minefield, when I ran my game locally, it had no problem loading the audio file. It played and didn’t have any trouble. But when I uploaded my files to make them available to the web the sound broke… this makes no sense to me as to why this would be the case. So far I have checked these issues:
- relative path is correct (actually no path…the file is in same folder as html)
- the permissions are correct
- the transfer seems fine
- files are in the directory
I really don’t understand why it should not work from my site while it worked locally. I have checked it out with firebug and it seems the audio object is created so I’m not quite sure where to check next. In any case perhaps I’ll take a page from my old school days and sleep on my bug…
Leave a Comment
January 4, 2010 at 6:21 pm (Seneca)
The new year has begun and I’m back at work. I took some time off around the holidays to hang out with friends, and generally relax. I even made a turkey this year with stuffing and mash potatoes that didn’t come from a box! I am feeling much more refreshed now and I’m ready to get back to work.
This semester I will be teaching OOP244, DSA555 and GAM671. I will be moving my notes that were originally done in ms word to a wiki. I had originally planned to do it in straight html but I am finding that the editing tools there just isn’t quite up to what I want. Its fine for normal text but any time I want to do something more out of the ordinary it seems to just bug out. There is a good chance that this is simply the editor I’m using is not configured properly but a wiki is just so much easier to edit.
So far the main drawback is that I do not have a good way of transfering my diagrams. I do not like ascii art and I think that good diagrams are important. I’m trying out inkscape but it is a bit complex for what I want to do. I think that simplest way for me to do it (at least for now) is to screenshot and save as .png files the diagrams from my old notes.
Leave a Comment
December 8, 2009 at 10:39 am (Seneca)
While reading the Dave’s blog about FUDCon, I was reminded that the mini gdb guide I wrote years ago for my students is woefully inadequate. I have used gdb since my days in university and while it is not the prettiest debugger, I’ve always found that it did what I needed it to do just fine but I don’t think many students are aware of it or make use of it.
While the guide I wrote covers the most common commands, most students still find it difficult to navigate through their code with gdb. I would be interested in rewriting it but I think that it would be useful if the students could try it out on a piece of code that wasn’t their own. Usually students often first try the debugger when they are unable to get their code running for an assignment. Unfortunately this is also usually pushing up against a deadline and learning to use the debugger isn’t on the top of the to-do list… common attitude is to just stumble through assignment with printfs and hope that the bug will get fixed some how. It would be nice if there was a way for students to be able to go through a series of small tutorials where they can go through some buggy code, step through it and learn to use the basic commands.
I would like to know is if anyone out there has some small pieces of code that have some or all of the following feature
- compiles… not interested in syntactic bugs here just logical ones so code with syntax errors are not really what I need.
- clear, easy to understand specs… can’t fix something if we don’t know its broken
but is buggy… in other words it exhibits one or more of the following problems
- crashes (causes a segementation fault)
- gives the wrong result all the time(or unexpected results)
- gives the wrong result sometimes
If you do and don’t mind sharing it, would love to get it so that I’m not inventing a bug.
Leave a Comment
November 30, 2009 at 2:57 pm (Seneca)
This Thursday (Dec. 3, 1pm to 6pm) my Gam667 class will be doing a field trip to a motion capture studio where we will look at the process of capturing real actor movements for use in games. My class is not big so we can take a few others that have interest in this area. If you are interested in checking out a motion capture studio and what they do, please contact me. This is a really cool field trip so if you are available, I’d highly encourage you to join us!
1 Comment
November 29, 2009 at 9:44 pm (Seneca)
Currently C3DL’s Development news feed is included on the Planet CDOT. Recently while looking at other people’s work on WebGL I came across the WebGL planet. I figured, it was a good idea to have our dev news there so I asked Chris Blizzard to add us to the feed.
Chris then told me that the planet was having trouble parsing our feed and that a stray character may be to blame. I found this odd of course because it always showed up on Planet CDOT. However, I know that the planet software was different for the two so perhaps one was stricter than the other when it came to blog feeds. I decided to investigate this.
I was not sure where to start as my experience with blogging software is pretty limited. I decided to start searching for planet venus (the software used by Planet WebGL) since it was the one thing I know was different between planet CDOT (which worked) and Planet WebGL (which didn’t). I came across a lot of articles on the 2nd planet from the sun, but much less about planet venus the blog feed tool . I decided to try looking at it from the wordpress perspective to see what else I could find. Eventually I stumbled upon http://feedvalidator.org/ It lets you check if anything is wrong with your blog feed.
Upon putting in the c3dl feed, I discovered that there was indeed something wrong. It was in one of the posts which had an <a> tag that didn’t have any url (basically <a href = “”>some text </a> ) . I took it out and the validator indicated that there were no longer any errors in the feed. Sooo lessoned learned. Not all planets are as forgiving with their tags, check your feeds and make sure everything is good. Hopefully this will solve the issue with Planet Venus
.
2 Comments
November 28, 2009 at 2:17 am (Seneca)
Having had a fairly long day, I was thinking about going to bed “early” (before 2am) when I decided that I just should check out Planet CDOT before sleeping. Although I don’t blog as much as I should, once in a while some things make me want to blog to put in my thoughts on the matter. Thus, my quick 10 minute pre-bedtime blog browsing is turning into a much longer pre-bedtime blog writting session.
Dave Humphrey blogged about comments being possibly harmful today. Well that caught my attention because I know that I am one of those teachers that thinks that code should have comments in them. However, having read Dave’s blog, I can’t say that I disagree with him. I too have been led astray by comments left in some source file. Sooo… to procrastinate on going to bed I figured I’d write what I think I would prefer for comments because I think there is a time and a place for them but the comments written should be meaningful and have semantic knowledge.
My thoughts are simply as follows… I hate comments that repeat code. This is actually something that I have observed students do and it is a pet peeve of mine. Comments should say something that code does not or possibly cannot say. If your code is so complex that no one can possibly understand it without a comment… perhaps it is time to consider rewriting it so that it is understandable.
For example, I ask my students to provide a data dictionary… that is variables should have comments stating what they are used for. And once in a while I get comments like:
double weight; //a double holding the weight
err…???? What I want to know at this point is why on earth this person is coding in english inside the comment… If I wanted to see code in English I would use COBOL (/shudders). Repeating your code in your comment is not useful. A comment should provide information that cannot be gleaned from your code… for example:
double weight; //the weight of the car in kg
I don’t need to know that its a double or that its name is weight because I’m fluent in the programming language. it would be like saying:
/*this loop runs 10 times*/
for(int i=0;i<10;i++){…}
really? nah… it cannot be…how did I ever manage without that comment (/sarcasm)
The other situation where I think it is useful to actually have a comment is in the function description. That is, when you code a function you should be able to state what it does (not how, just what), what its expected return values are and what argument it expects. While how you implement that function may change, what it does should not change nearly as readily. Thus, the focus of your comments really should be on a very high level what (and even sometimes a short why) but forget about the how .
Anyhow… my 10 min. blog reading session is now way longer than 10 min. Time to sleep.
Leave a Comment
November 4, 2009 at 10:57 am (Seneca)
Well, I finally succumb to peer pressure and signed up for Twitter (my id is cathyatseneca). I had resisted joining it because I know that I’m fairly easily distracted while at the same time focusing on something that is really a distraction.
So far I have made 3 tweets (one was more like a note to myself to check out certain apps). There was a silly comment/joke I tried to write but I ran out of characters so I didn’t bother with it. I can see that fitting in your tweets to the given length will definitely be a challenge. Unlike blogs where you can go on and explain your points, twitter is definitely a place where you need to say what you want to say and do it quickly.
As of day one the distractions have not been too bad but I don’t have too many people I’m following or are following me so far. Maybe it will grow as the list grows. For now though, its ok and I can keep up with it
1 Comment
November 2, 2009 at 11:57 pm (Canvas 3d, FSOSS, Seneca, open source)
This year’s FSOSS was a bit smaller than usual which is to be expected given the state of the economy and a flu virus that seems to be jumping around like a mad grasshopper. However there was still a quite a bit of neat stuff going on. I didn’t get to go to as many talks as I would have liked to but I did catch Al MacDonald’s (side note, Al’s site does NOT use Flash!) talk on Processing.js.
I was really interested in it because it is similar in some ways to my own project, the Canvas 3D JS Library. Processing.js is a language for programming graphics and animations by drawing onto the Canvas Element using the Processing Language. I had learned a bit about Processing.js before hand but seeing Al McDonald explain it was much much better.
The neat part about Processing.js is that not only will it allow you to create stunning visual effects but being part of a web page means that you can drive the visualization with data from the web. Al showed a demo of a search engine that visualized search results with processing code. Drawing with processing requires only that you include the Processing.js files as part of your page (similar to how c3dl works). It does not require add-ons.
There are several students at Seneca working on adding more functions to Processing.js (it is not the complete processing language after all). Part of this will include adding 3D functionalities to processing.js using WebGL. As c3dl has already done a lot of work in this area, we are looking forward to working on this aspect with the Processing.js project.
One strange thought I had while attending the Processing.js talk was that for some reason it reminded me of Apple Logo (or was it Apple Turtle?). This was the second programming language I ever learned (the first was BASIC). It ran on my old Apple II and basically you can use it to draw pictures by giving commands to a “turtle” (think of it as a cursor that told you where the pen was). As the turtle moves, it draws a line. You could tell it to go forward, backwards, turn a certain amount lift the pen or put it back down and a probably a whole bunch of other stuff that I cannot remember now. It was not a fast language but it was really cool because I could visually see what my instructions were doing. Although I had not used it in years nor was it a practical language it was part of what sparked my interest in programming when I was young.
With that in mind, I can’t help but to think how this could be a really good way to introduce to programming for students at younger grades. It has some very unique benefits:
- It’s seems to be a simple language to learn.
- It’s highly visual and graphical (its not just text… /yawn /boring)
- It’s open source (no proprietary licensing required to develop or publish with it…just a text editor and a browser)
- It’s part of the web, you can do some really neat stuff that interacts with the web and data on the web.
- What you do is on the web…you can do something, publish it and show off your work.
I have done workshops for high school students in past to trigger their interest in programming. I think something like this would be far more interesting than plain old web pages.
Leave a Comment
October 19, 2009 at 10:59 pm (Canvas 3d, Seneca, open source)
I’ve been watching the Seneca Open Source planet for a little while and noticed that a few students are using Git. A friend had recommended it to me when I was working on my website for school this summer. For those of you using a mac with Git, you may be interested in trying out GitX. It has a nice gui for some of the tasks (not all… I still had to got to command line for some stuff).
Leave a Comment
September 7, 2009 at 7:25 pm (Seneca, open source)
A new school year is about to begin and this semester promises to bring some very interesting challenges indeed. The courses I have taught in the past were usually C++ based. It is the language I am most familiar with and the one that I am most comfortable with by far. This fall I will teaching something totally new/old… COBOL.
Why? I am not exactly sure how I ended up with this course… but somehow I did. It is not a language I am familiar with but I have always believed that programming languages are usually not all that different. There are however little nuances to each language that make them unique and special. Grasping that nuance is the key to becoming fluent with it.
While I was studying at the University of Manitoba, my uncle, CT Leung, was teaching a night class in COBOL at the University of Winnipeg. He had asked me if I wanted to take the class as I would be able to transfer the credit back to my school. My reaction then was along the lines of “ha ha… funny, why would I want to take COBOL?”. Ah… well guess my uncle is getting the last laugh now. As I was prepping for this course, my uncle spent a bit of time going over some of the those COBOL nuances with me. Cindy Laurin has also very kindly helped me with learning about the AS400 environment and providing some much needed resources for this course. I would like to thank both my uncle and Cindy for their help
I am now working on putting up my course materials for this semester. Mostly this involves getting my web page in order. This past summer I created a new web page for myself. It is built with Django and so far it is definitely easier to manage than my old site (basically a bunch of html files that I would modify by hand). It is not without problems though. I made a couple of stupid design decisions that I am currently kicking myself for. For example, I decided I only needed 1 programming standard (I was clearly half asleep at that time). This is great when all my courses were C++ based but I really can’t use it for my COBOL class. I also should have made the ability to add non-html style notes for my notes link. Most of the notes that I have for my courses are done in word. I would not mind redoing them but that will require time and being able to keep my old notes posted while developing new notes is really not a bad idea. However, these issues should be pretty easy to fix.
Still much to do so time to get back to it!
Leave a Comment