Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

13. October 2011

 

*EDIT: 11/06/2011 I wrote an installer that automates this entire process, I recommend checking it out.  Of course, the manual process below will still work.

 

Before you can use PlayN, you need to download and configure it, which is not a completely trivial task. 

 

First of all, you are going to need GIT.  Git is a version control system and if you are working on Windows there are a few ways to go about it.  First is to install Cygwin which is a Linux like environment for Windows.  The other ( and easier ) option is to download it here. ( I used this one ).  Run through the setup, the only option to be aware of is this one:

*EDIT: It was pointed out other Git options such as the EGit plugin for Eclipse exist.

 

image

 

This is the option I used and will assume you will use going forward.  Also I chose windows style line breaks on checkout. Now that Git is installed, its now a matter of downloading the most recent source code from Google.  I assume you have an internet connection, now open a command prompt and change to the directory you want to install PlayN in.  Git will automatically create a “playn” folder, so in my case I used c:\ as the install path.

 

Now type “git clone http://code.google.com/p/playn” and it should look like this:

 

image

 

And after running, it should create a directory called playn whose contents look just like this:

 

image

 

 

If you haven’t already got a Java JDK installed, go get one now.  I started this tutorial off using 7, but truth is Java 6 seems to work better.  So if you don’t already have it, go get it now.

 

Now you need some kind of an IDE.  In this example I am going to use Eclipse, as it seems to be the one that Google most supports.  If you don’t already have Eclipse installed, head on over to Eclipse.org's download section and pick out a version.  In my case I went with Eclipse 3.7.1 Classic x64.  Simple open up the zip file and extract the eclipse folder wherever you want your install to run from.  Run Eclipse.exe and select where ever you want your project files to exist.

 

Now you need to add a couple plugins. 

 

First we need to install the M2E ( Maven ) plugin.  You need to do this inside Eclipse.  In Eclipse, select the Help menu, then Install New Software…

 

In the dialog that pops up pull down the “Works with” box and select “http://download.eclipse.org/releases/indigo/201109230900”.  In a few seconds it will populate a list of options, you want to expand Collaboration and select “m2e – Maven Integration for Eclipse” then click Next, like this:

 

image 

 

Click Next again then agree to the terms and conditions and it will go out, download and configure the Maven integration.  After it is complete it will ask you to restart Eclipse, allow it to.

 

Now we need to add the two Google specific libraries, the Google Eclipse Plugin and the Android Eclipse Plugin.  Both are installed in a very similar manner, just using a different repository.  In Eclipse, select Help->Install New Software.  This time click the “Add…” button and in the “Add Repository” dialog, enter dl.google.com/eclipse/plugin/3.7 like this:

 

image

 

Now click OK and it will again populate the list of selections available.  We need to add another repository for the Android Plugin as well, this repository is located at http://dl-ssl.google.com/android/eclipse/ like such:

 

image

 

Alright, now that those are both added, back in the Install New Software screen, in Works With select our newly created Android repository and select either Android Developer Tools or optionally just select Developer Tools to install everything, which is what I am going to do.  So your screen should look like this:

 

image

 

Finally click Next, Next again, agree to license terms, then Finish.  It will proceed installing the Android tools, you may receive the following warning:

 

image

 

Simply click OK.  Once completed it will ask you to Restart again, choose “Restart Now”.  Now all we need to do is configure the Google Plugin.  Follow the exact same process, Help->Install New Software… and this time in Work With select the Google repository.  I am not specifically sure exactly which plugins and SDKs are required by PlayN, so I simply clicked Select All… disk space is cheap these days right? Smile

 

image

 

Click Next, Next, accept the licensing terms and click Finish.  Now Eclipse is going to do it’s thing… taking a fair bit longer than before.  You may once again receive an “unsigned content” warning, simply click OK again.  And, I bet you saw this one coming… one last request to restart Eclipse.  The last time, I swear!

 

Now that all the tools are created, we need to configure our project.  This is where the m2e plugin we installed earlier comes in.  In Eclipse, in the File Menu select Import.  You should see a list like the following, if the Maven option isn’t there, your m2e install didn’t work properly and try again.  ( Or possibly you didn’t reboot Eclipse earlier? )

 

image

 

You want to select Maven->Existing Maven Projects.  Now for Root Directory you want to navigate to the place Git installed PlayN, in my case c:\playn.  Stupidly you can’t just type the path, you have to hit the Browse button or it won’t well… do whatever it does. Speaking of which, whatever exactly it is doing takes a few minutes.  Many moons later it should look like this:

 

image

 

Click Next, then Finish.  It will in a rage inspiring way that only Java seems capable of, it will appear to reinstall all of the things we just installed then make me a bit of a liar as it asks you to restart Eclipse one more time.  ARGH.  Alright, last time I double promise.

 

Now you have to run the Maven install for playn-archetype.  To do so, switch to the Java Perspective using the Window Menu->Open Perspective->Java Browsing.  On the left hand side should be your Package Explorer with a list of maven projects.  Right click playn-archetype and select Run As –> Maven Install, like this:

 

image

 

 

One the bright side, Eclipse is now fully configured and ready to go.  Now we just create our project!

 

In Eclipse, select File->New->Other...

Now scroll down and select Maven->Maven Project, like this:

 

image

 

 

Click Next, choose your location, I clicked Browse and navigated to my default workspace under my user profile and clicked Next again. In the next screen, check the “Include snapshot archetypes” box, under Filter type “play” then click “com.googlecode.playn”  like such:

 

 

image

 

 

Now click Next.

 

This next screen is again typical Java of making things look way more complex than they really are.  Now you need to provide a groupID and a artifactID, which are bizarro over engineered ways of saying your domain name and game name.  For group id put your domain name ( even a made up one is fine ) in reverse order, for example com.gamefromscratch is what I am using.  Then in ArtifactID put your games name, for example playndemo.  Finally in the properties section gameName will have automatically been created, in the value enter your game name again, like this:

 

 

image

 

Obviously you will want to use different values.  You will see that the packagename is auto-generated based on the values you chose.  Now click Finish.  Not there is a little glitch in Eclipse in that after filling in the value for gameName, you need to click somewhere else on the dialog window to get the Finish button to be enabled.

 

 

Now your Project is created.  If you look in Package Explorer you will now see it ( all 5 of them ).  Here is mine:

 

 

image

 

 

Now it’s a matter of getting things to actually run.  Since we are working on a desktop, lets start with the core ( Java Desktop ) application.  Right click on playndemo-core ( obviously your name will be different ) and choose Run As->Java Application.

 

 

image

 

After selecting Java Application a window will pop up asking you to Select your Java Application.  Scroll down till you find your project it will be named [yourprojname]Java.java like such:

 

 

image

 

 

 

Click it and press OK, and finally the fruit of all our labours!  Our game.

 

 

image

 

 

 

I have to say, that process has to be made MUUUUUUUUUUCCCCCCCHHHHHH simpler if they expect PlayN to catch on.  I mean compared to XNA’s equivalent of downloading and double clicking an EXE, this is simply brutal. Google has a Getting started guide but frankly it assumes a hell of a lot of knowledge of Eclipse, Maven, Git, etc… and still is wrong in some places ( like the Git address ).  Otherwise there is a horrid lack of documentation at this point.

 

 

Well that’s about it, hopefully this guide helped you and if I made a mistake, let me know!

Programming

13. October 2011

 

 

Alright, I may be that last person in the world to discover this, but its incredibly handy.

 

Today I was working with a command prompt and realized instead I would be better served using the file browser in this case.  On a lark instead of grabbing my mouse and launching Explorer I simply typed “explorer . “ and up came Explorer open to the current directory.

 

Very cool.

General

13. October 2011

 

Just a quick note to the people, like myself, that are checking out Google’s new game library PlayN.  The getting started guide says to

git clone https://code.google.com/p/playn

 

This will error out if you try it.  Instead use the url http://code.google.com/p/playn.

 

I don’t know if this is a typo, or if the https version is down.  Anyways, a potential show stopper to someone new wishing to check out PlayN.

General

12. October 2011

Logo

 

Google has released their new open sourced write once run anywhere gaming library, PlayN.  Well if by anywhere you mean Android, Flash, HTML5 or Java that is.  Here is the announcement video:



 

 

In a nutshell, you write your code in Java and it cross compiles to the 4 supported formats.  It’s odd that in the video they announce iOS as one of the platforms that developers need to support ( probably the biggest platform to boot! ) and yet PlayN doesn’t support iOS.  A bit of a headscratcher there!

 

Anyways, I will take a closer look into PlayN and give a review of sorts over the next couple days.

Programming, General , , , ,

5. October 2011

 

So if you want to stay on the bleeding edge, go get it.

 

Or of course you can just wait 10 days for the 2.60 official release.

 

The main changes are:

 

Not really a ton there for game developers yet.  Was kind of hoping 2.60 was when BMesh would get merged in.  Haven’t personally checked this release out and will probably wait for the non-RC release.

Art

Month List

Popular Comments

Exporting from Blender to PS Mobile: Blender to Vita in under 5 minutes.
Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon


30. April 2012

 

BlenderOnVita

We are now going to look at creating a fully textured model in Blender and exporting to a PlayStation Studio SDK project, a simple model viewer.  We create a very simple model, UV map, texture then export it.  At this point, we process it using the PS Studio ModelConverter tool, import it into PS Studio then finally run our code in the simulator.

 

The example model is as I said, brutally simple ( it’s simply a dice, er… die, also known as a textured cube ). However the process for exporting more complex models is exactly the same.  The process isn’t really all that difficult, especially if you know your way around Blender, but if you don’t know Blender all that well don’t worry, I’ve actually captured the entire process in video form.  This video covers exactly the same thing that the rest of this tutorial does, so if you have problems following one, refer to the other and vice versa.

 

 

Modeling, texturing and exporting from Blender to Sony PlayStation Suite SDK in under 5 minutes

 

 

The above video is actually encoded at 1080p and is probably almost illegible at anything less than 720p.  You can watch it on YouTube or Vimeo in full definition.  Again, the video demonstrates exactly what I am going to show below, except the source code.  So if you are the type that prefers to learn by watching, or the type that learns by reading, you get the best of both worlds here!  Alright, let’s get started.

 

 

If you already know how to model, texture and export in COLLADA format using Blender, I suggest you skip ahead to part 2, as the remainder of this section will be quite boring for you… it goes into detail, a lot of detail. Smile

 

 

If you haven’t already, fire up Blender.  We are going to work with the default cube, if you don’t have a default cube select the Add menu –> Mesh –>Cube.  The first thing we want to do is create a new image to texture our model.

 

In the properties panel to your right ( assuming you are using the default layout, which I will for the remainder of this tutorial ), locate the Textures tab and click it.  Like such:

 

image

 

 

Now change “Type” to Image:

image

 

Scroll down slightly to the Image section ( expand it if required ) and click New:

image

 

In the resulting dialog, we specify the texture details.  I am going to name it the ultra imaginative name “Texture” but fell free to call it whatever you want.  1024x1024 is massive overkill for what we are doing, but hey… I like overkill.  When done, click OK.

 

image

 

Now we want to apply some simple texture mapping to our 3D cube.  In the 3D view, make sure you are in “Edit Mode”, either by hitting Tab until selected, or via this menu:

image

 

Now that you are in edit mode, select all the faces of your mesh by hitting “a”.  Now in the Mesh menu, you want to select Mesh->UV Unwrap…->Follow Active Quads.

image

 

Simply click OK at the resulting dialog menu.  Now we want to switch to UV editing mode.  Locate the icon to the bottom left of your view, click it and select UV/Image Editor.

image

 

We now want to make our texture the active image.  Locate the “Browse image to be linked” button, click it and select texture from the list.

 

image

 

Now press A to select all of our faces, then using hit S to scale ( then mouse move, left click when done), followed by G to translate, until our UV coordinates are all over the black image, like so:

image

 

Now we want to quickly paint our dice faces on the texture within the UV coordinates.  From the menubar select Image->Image Painting.

image

 

Now left click to mouse paint the texture like the face of a die.  You can use the left hand panel ( press “N” if not visible ) to change the paint settings.  When done you should have something like this:

image

 

Now, back in the Image menu, unclick Image Painting.  Now we want to save our completed image.  In the same menu as before, select “Save as Image” or hit F3.  In the resulting dialog, locate the directory you want to save the texture to ( make it the same place you are going to save the model ), name it, then click Save as Image:

image

 

Now with that complete, we assign our image to our texture.  Back in the Texture panel ( to the right ), locate the Image section, click the Browse Image to be Linked button and select your texture.

image

 

Now scroll down lower in the Texture panel, locate Mapping, then select the Coordinates: dropdown and select UV.

image

 

Right below that, select the Map: dropdown and select UVMap.

image

 

 

 

All right, now we have a fully texture mapped model ready for exporting.  From the File Menu ( top right ), select File->Export->COLLADA(.dae).

image

 

 

In the resulting dialog, navigate to the same location where you saved your texture, name it ( I used box.dae ), optionally select “Export only selected” then click Export COLLADA.

 

image

 

 

And we are now done with Blender.

 

 

This section has already gotten quite long so I am going to break this post into two parts.

 

 

Continue on to Part 2.

Programming, Art , , , ,

blog comments powered by Disqus

Month List

Popular Comments