In the first installment of this article we had a look at how to load and display a tile based map. In this second post we will take it one step further by implementing scroll (movement) management – which is an essential part of our chosen genre of games.
Continue reading
Monthly Archives: April 2013
Game programming – Part 1
When I was a kid I used to play tons of games on my Commodore 64 machine. This was the number one gaming machine of the early 80’s and was only surpassed by the Commodore Amiga in the late 80’s early 90’s in terms of popularity. The reason these machines were so popular was not just the games you could play on them, but also the fact that you could make your own games and applications on the same machine. They were not like the PlayStation or the xbox of our days – which turns brilliant children into customers only, with no means of playing with the device and exploring what it means to create.
Continue reading
The Smart Contest 2013 – Topic for the second round
We are definitely in a playful year this year.
“The Smart Contest” is soon entering the second round.
The topic this time will be “Game development”.
Hopefully, you learned a few things from our articles on “Graphics programming”. These tips and tricks might come handy now. If you missed them, take a look here:
Take also a look at the entries from the first round of the Smart Contest:
During the last few days of April we will publish a series of articles to get you started on game development in Smart Mobile Studio. Stay tuned! This will be a comprehensive step by step tutorial.
In the mean time, you should head over to delphi.org and listen to Jim McKeeth’s interview with Jason McMillen on game development. Jason is the guy behind Pascal Game Development, and he shows you several interesting resources.
If you google “HTML5 games”, you will find lots of cool examples of what Smart Mobile Studio is capable of producing.
So, pick your favorite game and start the thinking 😉
In case you missed it:
First prize in each round will be a tablet (iPad, iPad mini, Android based tablet, Windows tablet). Value ~750 USD
Q: Will it be possible to participate with a trial version of Smart Mobile Studio?
A: Yes! 😀
Best regards,
The Smart Mobile Studio Team
Game programming
This article will be published on the 25th.
Stay tuned…
Do you wanna try Game Development with Smart Mobile Studio?
Then this is your big chance.
The second round of “The Smart Contest 2013” will be all about “Game development”.
Take a look at the announcement.
Best regards,
The Smart Mobile Studio Team
Summary of The Smart Contest 2013, Round 1 – Graphics
You can now take a look at all the entries for “The Smart Contest 2013, Round 1 – Graphics”.
All the projects are presented in our showcase area.
Round 2 will be conducted in May, so stay tuned. The topic for this round will soon be announced…
Graphics competition results
We are proud to present the winner of the Smart Mobile Studio graphics competition!
And the winner is .. Bioptopia webgl demo by Mattias Andersson – Congratulations!
You can testdrive the demo live by clicking here (Chrome is prefered)
In Mattias own words:
The demo consists of two parts — the first part is about drawing isosurfaces constructed by using a marching cubes implementation by Aaron Hochwimmer. The second part unites the isosurfaces with an extension of the CFDG language, which I call “3D-CFDG” (see http://www.contextfreeart.org for the original 2D implementation.) This was an idea that I had planned to implement at some point and this contest seemed like the perfect opportunity.
We congratulate Mattias with the #1 demo – job well done!
About the author
I kindly asked if the author could write a few words about himself, his background in demo coding and where he came from in terms of technology (being old Amiga hackers we naturally asked him if he ever did some coding on 16 bit computers). He was kind enough to reply with a short description. Again — hat off Mattias! Great work!
Lennart asked me to write a few lines about myself, so here it goes:
While I was certainly around in the old Amiga days (I’m born in 1981), I was a bit too young to actively engage in the “demo scene” myself. However I did help a friend of mine set up a BBS (we spent a lot of time working on fancy ANSI animations.) Those days you would download things by dialing up different BBSs with your 56k US Robotics modem; things such as music modules, demos and other cool stuff.
Some of the more prominent demo groups at this time were “future crew” and “triton” and they made some really spectacular demos. Triton was from Sweden (like me) and they wrote an amazing piece of software called FastTracker II, which was really way ahead of its time as far as software development goes (IMO.) I guess one thing I learned from this episode is that you don’t have to be a huge corporation in order to produce something great that a lot of people can benefit from. Ideas always originate with the individual and by crafting your ideas into something useful, it will benefit the whole of humanity (and quite possibly your own ego as well.) I guess this is one of the things that have motivated me to participate in various open source projects, such as Graphics32. I have also worked for a few years on a quite advanced image editing software that incorporates a node-based filter graph editor as well as a whole bunch of filter modules. I’m planning to continue this project after releasing my current Android project (a Z-brush-like software for Android that seemed like a more achievable short-term goal. P.S. Very good to now be able to test it on a tablet!)
Alright, now some words about my contest entry. The interesting part is clearly the CFDG implementation that I’ve managed to extend to three dimensions. CFDG is a simple language for describing geometric vector objects. There are some basic operations: scaling, translation, rotation and color adjustment. Additionally you know some predefined 3D “drawables”, such as a sphere, a cube or an extrusion along a lattice (you can add any primitive you like.) You define rules that will recursively invoke other rules. Recursion stops when the current scale parameter is smaller than a certain threshold value. Multiple versions of a rule can be implemented, whereby the effective rule will be randomly selected. This produces some very interesting geometric objects as can be seen by the end of the demo. One challenge in the implementation was how to move from one 3D reference space to another space transformed by a certain rotation. Fortunately I realized that quaternions would work ideally for this application. I encourage anyone interested in 3D graphics to learn about the benefits of quaternions.
Final verdict
Norway and Sweden have always been like two brothers. We like to tell jokes about each other, since we live right next to each other on the map I mean), have fun competitions from time to time (like the fact that we beat the crap out of your ice-hockey team last year) and we all meetup in the viking ship demo party once a year. Following Norwegian tradition we decided to deduct 10 points from the demo since you are in fact from Sweden — but we have to admit that even then you still won, so fair is fair: great work Mattias! You won this compo lock, stock and barrel!
New feature in the labs
The Smart Pascal to JavaScript compiler has become very sophisticated over the years, and we wanted to take this technology one step further. In the upcoming release of Smart Mobile Studio, we will support compilation to human readable documentation.
Yup. You read right. Over the years, we have experienced that many programmers struggle to communicate the code they have written to other people. Especially designers and managers. So we took on some creative glasses and gave the feature a second look. After a thorough review of the Pascal parser and a structured review of how we communicate program snippets during lectures, we came up with something brand new and spectacular. An Object Pascal to Human readable documentation compiler. Codename OP-2-HRD-C++. (We added the ++ in the compiler part of the abbreviation to get more google hits).
“Show me the code!”, you say? OK, Here we go:
In (almost) every project you have ever written, you have some custom data types. Right? Well, describing this to someone non-technical can be tedious, difficult and boring. With this new feature, you can just compile to “human readable documentation” and hand over the generated pdf-file.
For example:
[code language=”Pascal”]
type
TPerson = record
Name: String;
Age: Integer;
end;
TPersonArray = Array[0..9] of TPerson;
[/code]
is compiled into:
[quote]In this project we have two data-types. We have a record named TPerson, and an array that can hold 10 elements of TPerson. The array is named TPersonArray. The TPerson record holds Name in a string field (unicode characters are supported), and Age in an integer field, which means that you can register values from -2147483648 to 2147483647 in this field.
[/quote]
Isn’t that just brilliant?
We actually have some output options with this compiler feature, so it’s possible to specify if the target is “to designer”, “to programmer” or “to manager”. If you, in this case, choose “compile to programmer”, you will get some useful additional information about that array:
[quote][…]The array is named TPersonArray and it’s zero-based – so be careful with any off-by-one mistakes![…]
[/quote]
We’ll give you another example with a control statements:
[code language=”Pascal”]
if (Person.Name = ”) and (Person.Age = 0) then
ShowMessage(‘The record is empty.’);
[/code]
Is compiled to:
[quote]The program will then show a message saying “The record is empty.” if, and only if, the Name field of the Person record is empty and the Age field of the Person record is 0.[/quote]
Now, for a loop like this:
[code language=”Pascal”]
for x := PersonArray.Low to PersonArray.High do
begin
Console.WriteLn(‘The name is ‘ + PersonArray[x].Name);
end;
[/code]
you will generally get an output like this:
[quote]The program will then enter a loop that iterates trough each items in the PersonArray variable. For each iteration, the text “The name is ” will be written to the console along with the Name field of the record that is contained it the current array element.
[/quote]
But! We have actually added some nice compiler magic to the OP-2-HRD-C++ compiler.
So, if you try to compile this snippet:
[code language=”Pascal”]
for x := PersonArray.Low to PersonArray.High-1 do
for y := PersonArray.Low+1 to PersonArray.High do
begin
if PersonArray[x].Name < PersonArray[y].Name then
Swap(PersonArray[x], PersonArray[y]);
end;
[/code]
You will actually get this “to manager” output:
[quote]The program will perform a bubble sort on PersonArray. The bubble sort algorithm is very simple and not very efficient. The management should add a few hours of refinement and optimization to this method…
[/quote]
Pay particularly attention to the request for more time to programming. We strongly believe that the management will allocate more budget to the programming task if they are faced with serious computer-generated concerns like this!
If, however, the documentation is intended for programmers (i.e. yourself), then we’ve added a friendly reminder:
[quote]The program will perform a bubble sort on PersonArray. WTF!? A bubble sort algorithm?! Is this a school project or something? You’d better clean this up before someone else sees it. What if Nick Hodges will review this code in the future?
[/quote]
We hope this new feature will make the everyday life of a programmer better.
—
Sincerely,
The Smart Mobile Studio Team