Category: This website

Another extension to the scope of this blog

Another extension to the scope of this blog

MonoGame application running on AndroidWhen I started this blog at the end of February it was to assist sales of my ebooks. The one written and the one being written. Things have changed a bit and the one being written is now the Raspberry Pi book. That book is still being written but it’s not as high a priority now.

But I also have another side project underway which is to do with mobile game development (and maybe eventually Raspberry Pi).  The only thing is, this project uses C# not C or C++. However it is games related and as its my blog, I’ve decided that I shall write about it here as well as the C stuff. So get used to hearing about MonoGame, XNA and Xamarin.

Just so you know. Xamarin is the company (bought by Microsoft a few years back) that was formed by the founder of the Mono Project (Miguel de Icaza)  and is an excellent cross-platform technology for iOS and Android development based on C#.  I wrote two mobile apps (both sadly derailed by events) one of which was the equivalent of the Uber app. I managed to store every one of the 29 million UK postal addresses in the RAM of an iPhone 6.

XNA was a Microsoft technology for creating games on Xbox, Windows and Windows Phone some ten years ago. It reached version 4 but was then dropped by Microsoft. However the MonoGame project took it over and MonoGame is XNA reincarnated.  It’s cross-platform and runs at 60 fps.

The only technology that I believe can rival Xamarin is Google’s Flutter but it is still too new and doesn’t do games. The C# code runtime adds 3.5 MB to the overall executable but is very efficient and fast.

The image is an Android phone I have running an app. It doesn’t look much but that menu will display with the same height and width on any Android phone.  The problem with Android development (compared to iOS)  that there’s over 20,000 different size screens compared to a dozen or so on iOS. My program is scaled to a fixed virtual size and then tranforms that to the real size. MonoGame lets you do that.

A simple programming challenge

A simple programming challenge

Contest
Image by Arek Socha from Pixabay

Background

Around 1981, a British computer magazine (Personal Computer World) had a programming contest and this was one of the puzzles.

There are many 9-digit integers in the range 123456789 to 987654321 where each digit only ever appears once. What is the 100,000th number in this sequence?

Example

The first number is 123456789, the second is 123456798, the third is 123456879 and so on. No digit can repeat so 122345675 is not a valid number in this sequence.

The problem was “Write a program in C or C++ that outputs the 100,000th number as fast as possible. Use any algorithm, except you cannot pre-calculate the answer and then write a program that just prints the result (Somebody actually tried it). Your entry must calculate the number!”.  I’ll give this a month so the deadline is August 14th 2020. Please don’t copy any of the existing answers- you can with a bit of poking around and yesterday’s blog entry find some answers to this.

Prize?

Er fame and glory and a mention on here!

Note

It’s possible to solve this by hand. I did, back in 1981. It took me 20 minutes with a pen and paper. I also wrote a 6502 assembly language version of it than ran on a Vic-20. It took something like 10 hours to count up to the correct answer.

Slight change of pace

Slight change of pace

Networking
Image by Gordon Johnson from Pixabay

I’ve managed one blog entry per day for the last 134 days but a change in side project (I was writing a book to be published, not an Ebook)  but that has to be delayed by at least a year because of an issue at the publisher. In fact I may just publish what I’ve done as my 2nd Ebook.

I’m currently working on networking on a Raspberry Pi. Unfortunately it has to be in C# not C. Networking is a lot easier in C#- you have OOP, task parallel library (far easier than threads), thread pools,. concurrency with async/await and a lot more.  And I can use C# with .NET core or Mono on the Pi.

That said, I will still continue on with game development on the PI. I’ve got my Match Three game half done; I’m quite proud of it and want to get it finished. But I may switch to a slightly less frequent blog posting schedule…

 

Slight change in direction – more C++ and Pi

Slight change in direction – more C++ and Pi

Raspberry Pi
Image by planet_fox from Pixabay

As I said recently, writing about C and games probably isn’t enough to sustain this site, but if I extend it to include C++ and Raspberry Pi and still maintain the overall direction of writing about game development then that I think will do it.

So I’ve added a new page for C++. I’m currently working on the C++ version of Asteroids and making good progress.

I’m striving to write it in modern C++. To that end, the first entry in the C++ page is a link to a very long document: C++ Core Guidelines written by two luminaries of the C++ world Herb Sutter and Bjarne Stroustrup (creator of C++). You should definitely give it a read.

Interesting fact about the Raspberry PI. Did you know that in March 2020, they sold 640,000! That’s pretty amazing! And while that article says that AAA game playing isn’t something you can do on a Pi, we now know that you can run simple 2D arcade quality games on a Raspberry Pi 4.