Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon
13. July 2014

 

You may notice over time on GameFromScratch.com the way code is posted changes quite often.  There are a few reasons for this.  First and foremost, I most commonly use Live Writer when writing blog posts on Windows.  Originally I used a plugin that did code formatting like you see in the C++ tutorial series.  It was really flaky though and eventually just stopped working.  Short of a complete OS re-install there wasn’t any way to get it running again.  Obviously this wasn’t an option.  I switched to a different Windows Live Writer plugin for text formatting, but it only supported a couple of languages and I have probably done code samples for over a dozen language, so that was a bit of a deal breaker.

 

Quite often though, I am working on a Mac and that makes Live Writer a complete non-starter.  On Mac I use a program called MarsEdit, which has an OK RTF paste option and I can get code markup via Sublime Text like described here.  On Mac, code samples, such as in this series, were entirely dependant on the application I used.  Meanwhile on Live Writer I used a plugin called VSPaste, which in reality just pastes an RTF file from the clipboard to Live Writer, and generally it works OK.

 

The problem, in both cases, is if the RTF copy didn’t go as smoothly as I hoped.  Sadly this is quite often, posted code from IntelliJ ( with RTF copy plugin or using IDEA 14 which builds it in ) or WordPad for example just don’t work.  The line breaks don’t turn out correctly and it ends up looking like this:

public class DesktopLauncher {    public static void main (String[] arg) {        LwjglApplicationConfiguration config = new 
LwjglApplicationConfiguration();        config.width = 720;        config.height = 1280;        new 
LwjglApplication(new SetCenterIssue(), config);    }}
ïÿiªá€

 

… not exactly ideal.

 

The end result was to write my code in whatever IDE I am using, then paste it into Eclipse or Sublime Text and paste, whichever has the best formatting.  If that sound’s like a bit of a pain in the ass, well, it is.  In the long run I should look at using something like Gist for all code segments.  For now though I’ve found a nice little work around.  It’s still an extra step, but it’s much smoother.

The above example posted as HTML:

public class DesktopLauncher
{
    public static void main (String[] arg)
    {
        LwjglApplicationConfiguration config = new 
        LwjglApplicationConfiguration();
        config.width = 720;
        config.height = 1280;
        new LwjglApplication(new SetCenterIssue(), config);
    }
}

 

Or as RTF:

public class DesktopLauncher
{
    public static void main (String[] arg)
    {
        LwjglApplicationConfiguration config = new 
        LwjglApplicationConfiguration();
        config.width = 720;
        config.height = 1280;
        new LwjglApplication(new SetCenterIssue(), config);
    }
}

As you can see, it’s not perfect, in the case of an RTF paste, the background isn’t copied.  I am used to this already with Visual Studio paste, I manually go in and edit the generated HTML’s background color each time I paste a sample.

 

So, what am I using now?  A wicked little program named Highlight that is available for basically every platform out there.  The program has an amazing amount of versatility, and since it isn’t a plugin, it’s not going to break every time I look at Live Writer funny.  It’s available both as a command line utility or using a GUI and has an amazing amount of functionality.

 

The work flow is pretty simply… either point it at your source file, or copy your file to the clipboard.  Pick the language of choice ( it’s basically got all of them covered ), pick your formatting options, then paste it back to the clipboard.

 

Here is the main screen of Highlight in action:

image

 

The language choices… ( or, at least, some of them ):

image

Let’s just say, every language I could think of needing ( TypeScript, JavaScript, HaXe, C#, C++, etc… ) was there.

Then the code formatting options:

image

 

You can export to a number of different sources:

image

 

And for each output format, you’ve got a number of options, such as below for HTML:

image

 

So, if you need to paste code samples into a blog or other project, you owe it to yourself to check out Highlight.  It’s one of those products I wish I found 4 years ago!  For you command line warriors, there is a disturbing amount of flexibility available.  For example, you could recursively convert all .cpp files in a hierarchy of directories to SVG with a single command.

 

Oh and best of all, it’s completely free!

 

So, if you notice yet another change in the way code is formatted on GameFromScratch, this is why!  Hopefully it will be the last major change in a long time, and code samples should look more consistent across platforms from now on!

Totally Off Topic


17. January 2014

 

OK, right up front I’ll admit I was a bit asleep at the wheel on this bit of news, as it actually happened last week…

 

Anyways, Havok have released the 2D Toolkit for ProjectAnarchy.  Project Anarchy is a bundling of Havok game development tools for making mobile games, all completely free ( as in beer ).  They also somewhat recently announced indie friendly pricing for supporting desktop targets.  The core of Project Anarchy is the Vision engine, as well as several dedicated libraries Havok makes for Physics, AI, Animation, etc.  Many of these libraries are routinely used in AAA games.  If alt textyou are interested in learning more, I created a tutorial series shortly after PA was released.

 

The 2D toolkit aims at making 2D game development easier as the tools are primarily geared towards 3D development.  In Havok’s own words, 2D Toolkit is:

 

Although you can make 2D games with Project Anarchy out-of-the-box, it takes some custom code to get spritesheets working and doing basic 2D collision through LUA. This sample 2D toolset gives you a couple new entities and utilities to create 2D games entirely through LUA without having to write any custom C++ code. There is still a lot of work left before this can be considered polished, but this is the first step and we wanted to give you, the community, a first look at this so that you can provide us with feedback early on.

Features

  • Adds two new entities: Sprite and 2D Camera
  • Automated sprite generation using Shoebox
  • Runtime playback of spritesheets
  • Collision detection and LUA callbacks

 

The toolkit also ships with 3 samples, Shooter, Impossible and Physics.  This is very much a work in progress, with not all features yet available across all supported platforms.  The toolkit is open source and hosted on Github.

News


30. June 2013

 

Some time back I purchased Codea for my iPad.  Codea is a Lua based game programming kit for creating iOS games on the iPad and frankly it’s really kinda cool.  That said, actually typing code on the device is a bit of a pain, so I looked coming up with an alternative.  It worked, but it certainly wasn’t ideal.  Today I was on the AppStore and I noticed Codea had an update and added something called Air Code, which allows you to connect to Codea using your web browser.

 

Using Air Code is really easy, in Codea on your iPad, open the side menu and select AirCode:

1

 

Then it will tell you the address to open in your browser.  Your computer and iPad need to be on the same network for this to work:

2

 

Open that address in your desktop browser and a list of your available projects will be displayed:

image

 

You then select the code file to edit and the editor appears:

image

 

As you code in the browser, it updates live on the iPad:

3

 

That is very very very cool.

Right now the editing functionality in the browser is quite limited.  It’s basically a text editor only now.  Hopefully in the future they add intellisense support and possibly debugging.  This is a very nice start though, and easily gets around the lack of keyboard support.  Nicely, this process doesn’t require a Mac either, any web browser should work fine.  Coding on one screen and seeing the changes reflect live on the other is actually a very intuitive way to code.

I did run into a small bug, in that focusing away from Codea to check email, when returning I could no longer connect via browser.  Shutting down and restarted Codea fixed the problem.

So, if you have an iPad and another PC and want to create games, Codea is a very cool product and worth checking out!

Programming News


15. May 2013

 

So, it is now available for download, although the version is 0.1, so expect some warts!  Oh, the “it” in question is Google’s new IDE for Android development based on IntelliJ by Jetbrains, a developer I am a huge fan of.

 

Now I am going to take a tour of the IDE.

 

Welcome screen:

image

 

New Project Screen

image

 

New Project Part 2

image

 

New Project Part 3

image

 

New Project Part 4

image

 

Code Editing Window / Code tips

image

 

 

Error Dialog

image

 

Debug device chooser

image

 

 

Debug Window

image

 

 

GUI Editing

image

 

Screen size options:

image

 

 

Theme selector

image

 

 

Multiple Device preview

image

 

I experienced no crashes, everything was very intuitive and quick, other than initial loading.  I’m initially quite impressed.  IF you are wondering, this IDE *ONLY* works for Android projects.

News


15. May 2013

Today during the Google IO event there was an announcement that both shocked and pleased me.  They are releasing a new IDE for Android development.  Best of all, it's based on IntelliJ, easily my favourite Java IDE.

 

AndroidStudio

(Photo's are from Verge )

 

One of the coolest new features is the addition of a tool allowing you to see your code running on a multitude of different devices at the same time:

Verge super wide

 

I can say easily one of the things I hate most about Android development is Eclipse, which is pretty much the defacto tool for Android. You could always work in IntelliJ or Netbeans, but it was never quite as seamless and always seem to have a gap or two in functionality.  Any news that might potentially keep me away from the hateful IDE that is Eclipse is great news to me!

 

You can read more about the announcement over at The Verge.  As of yet, no downloads are available on Googles websites.

 

 

Edit: Download link now available.  Also, so hands on screenshots available here.

News


GFS On YouTube

See More Tutorials on DevGa.me!

Month List