Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon
18. May 2012

 

Someone on the PlayStation Suite forum recently asked if there was an implementation of the Box2D physics library that would work with PS Suite.  Initially Box2Dx looked encouraging, but in the end it relied on some unsafe ( as in the keyword ) code, plus it was quite a bit out of date.  In my searching though, I did stumble upon the Farseer XNA a prominent XNA physics library.  It depends on some XNA data types, but nicely, the library includes them!

 

So I set about trying to get FarSeer working with PlayStation Suite, which proved to be a fairly simple task.

 

First you need to create a PlayStation suite library, then copy across all of the code/folders from the archive.  Make sure it is FarSeer Physics Engine class you download, the other versions have dependencies that don’t work.  Now you have to make one very small code change.  You need to open DynamicTreeBroadPhase.cs and change internal struct Pair : … to public, like this:

 

public struct Pair : IComparable<Pair> //MJF made public

 

And that’s it.

 

Compile it as a PlayStation Suite library and add it as a reference to your project and you are off to the races.  You can download the DLL I compiled for PlayStation Suite right here if you don’t want to or can’t build it yourself.

 

Now, the reason I’m not really calling this a tutorial is, I haven’t bothered to actually take the time to figure out how to use FarSeer, I just modified their sample enough to verify it runs on the PlayStation Vita.  Due to the screwy decision to make the origin the bottom left, you need to alter their examples accordingly, but otherwise everything works fine.  Here is a sample of extremely poorly configured gravity.

 

using System; using System.Collections.Generic; using Sce.Pss.Core; using Sce.Pss.Core.Environment; using Sce.Pss.Core.Graphics; using Sce.Pss.Core.Input; using Sce.Pss.HighLevel.GameEngine2D; using Sce.Pss.HighLevel.GameEngine2D.Base; using FarseerPhysics.Common; using FarseerPhysics.Controllers; using FarseerPhysics.Dynamics; using FarseerPhysics.Factories; namespace FarTest { public class AppMain { private const float MeterInPixels = 64f; public static void Main() { Director.Initialize(); Scene scene = new Scene(); scene.Camera.SetViewFromViewport(); Vector2 midPoint = scene.Camera.CalcBounds().Center; // Create circle and ground sprites Texture2D texture = new Texture2D("/Application/circleSprite.png",false); TextureInfo ti = new TextureInfo(texture); SpriteUV sprite = new SpriteUV(ti); sprite.Quad.S = new Vector2(98,98); sprite.Position = new Vector2(midPoint.X - 98/2,Director.Instance.GL.Context.GetViewport().Height-98); Texture2D texture2 = new Texture2D("/Application/groundSprite.png",false); TextureInfo ti2 = new TextureInfo(texture); SpriteUV sprite2 = new SpriteUV(ti); sprite2.Quad.S = new Vector2(512,64); sprite2.Position = new Vector2(midPoint.X - 512/2,0); //Physics time World world = new World(new Microsoft.Xna.Framework.Vector2(0,-10)); Body circleBody = BodyFactory.CreateCircle(world,96f /2f,1f, new Microsoft.Xna.Framework.Vector2(sprite.Position.X,sprite.Position.Y)); circleBody.BodyType = BodyType.Dynamic; Body groundBody = BodyFactory.CreateRectangle(world,512f, 64f/2,1f, new Microsoft.Xna.Framework.Vector2(sprite2.Position.X,sprite2.Position.Y)); ; groundBody.IsStatic = true; groundBody.Restitution = 0.9f; groundBody.Friction = 0.4f; // Now update the sprite //circleBody.ApplyLinearImpulse(new Microsoft.Xna.Framework.Vector2(0,-50)); sprite.Schedule( (dt) => { sprite.Position = new Vector2(circleBody.Position.X,circleBody.Position.Y); world.Step(dt); }); scene.AddChild(sprite); scene.AddChild (sprite2); Director.Instance.RunWithScene(scene); } } }

 

 

And here are the results:

 

physics

 

 

The only real gotcha in the code is to make sure you use the Microsoft.Xna.Framework.Vector2 when calling FarSeer code and PSS’s Vector2 when dealing with PSS code.

 

 

Obviously, my ground is a bit bouncy, my gravity is a bit wonky, but it is a working physics simulation! Smile

General


13. May 2012

 

I am just thinking about what project I want to embark on next and this is one currently in my head.  I am going to continue focusing on creating PlayStation Suite SDK tutorials but as a sideHTML-5-Logo project I am starting to think about creating a Massively Single Player Offline Role Playing Game ( MSPORPG! ) tutorial series.

 

It seems that, like it or not, HTML5 is going to only become more and more important to game development.  Therefore it is an area I have some interested in personally learning more about.  I have prior Javascript and HTML experience, as well as more recent Node and Appcelerator experience, but as a gaming platform it will all be new to me, which is kind of fun. Also I grew up on CRPGs, games like Ultima and the old AD&D Gold Box games are the reason I am a gamer, so I have always wanted to make a simple RPG.  With the recent releases ( and success ) of Dungeons of Dredmor and Legend of Grimrock, it’s obvious that the old school role playing games are still popular.

 

 

So I ask you all, would you be interested in a series of tutorials covering a) HTML5 gaming b) making an RPG?  Again, this would be in addition to the regular tutorials/topics I cover.

 

So… interested?

General


9. May 2012

 

As you may know, if you want to publish on MacOS or on any iOS devices, you need to use animage Apple computer.  This can represent a rather large expense to many Indie developers ( no, I am not going to get into the ancient Mac price war argument! ).  What if you want to test with a Mac, but can’t justify the cost ( or space like in my office ) of another computer?  Wouldn’t it be great if you could rent a Mac as you needed it?

 

Well, that is exactly what MacInCloud offers!  Basically they rent out Mac machines over the internet on a time share basis.  Even better, these Macs are obviously targeted towards (game) developers, as it comes pre-loaded with a ton of game development software. This sounds wonderful to me, as even though I own a Mac ( an iMac ), I am more often on the road than not and I have no desire to lug around two laptops with me.  I’ve tried remote desktop’ing into my home Mac on occasion, but the experience was never all that nice.  Let’s take a look at how well MacInCloud pull it off!

 

 

If you are the type that flips ahead to ruin the ending, click here to jump to the verdict.

What does it cost?

 

Well that depends.  There are 4 ways to pay, and each one has a serious impact on the cost.  First and most expensive, you can pay as you go, which as of the time this was written is 1$ per hour.  Next, you can rent for the entire day for 8$.  You can also rent by the week and month, these prices all depend on the amount of time you need per day.

 

Here is a breakdown of prices for renting per week and month.

 

  Weekly rental Monthly rental
3 hours a day usage 12$ 20$
5 hours a day usage 15$ 25$
8 hours a day usage 19$ 30$
Unlimited usage 22$ 49$

 

Weekly and monthly rentals both include the first day for free ( well, 1 cent ), you can think of this as a trial period.

Note, and this is very important. You will be rebilled automatically until you cancel your subscription using PayPal! Not a big deal, but something you should be aware of upfront.  This applies to daily, weekly and monthly plans, but not to pay as you go plans. I will cover canceling your subscription later on, the process is pretty simple but a tad confusing.

 

So picking the right pricing scheme is a very tricky process.  If you just need a couple hours, pay as you go is obviously the ideal plan, but gets pricey quick.  For example on the 8 hours monthly plan, assuming you maxed your usage out, your hourly rate would be just 13 cents an hour!  On the other hand, paying for hours you aren’t going to use is just stupid.  It’s a tricky balancing act deciding which plan is right for you.  Initially I am going to go with the monthly 5 hours a day plan.

 

Sign up process

 

Sign up is almost as simple as it gets.  First you need to create a site account here.  That is just a website account, your email and password only, not a subscription.  In my case I am going with a monthly subscription, and its simply a matter of going to the Pricing menu, selecting the plan you want  then click Subscribe.  This will bring you to PayPal ( which is the only payment option ).

 

Here is the line item as it appears in PayPal:

image

 

You initially are billed only a penny for your first day.  A bit of a warning, this kind of stuff can be problematic with Visa/Mastercard.  I’ve received calls from fraud protection when really small transactions are charged against my card.  Don’t sweat it, it’s not a bad thing if you receive this call, it’s just the banks computers being cautious, just warning you it might happen.  If you cancel in the first day, you will not be billed for the service.

image

 

You will now be redirected back to macincloud.com and presented with your Mac server name as well as your username and password.  This information will also have been mailed to whatever email account is linked with your PayPal account.  You are now signed up.

 

Logging In

 

There are two ways to log in to MacInCloud.  The easiest is to use their browser based client, which recommends you use Google Chrome.  I will start with this method.  Save your credentials from the the welcome email/page and head on over to http://www.macincloud.com/member-area/browserconnect.

 

image

 

This part of the process isn’t as obvious as it should be, as you currently have two sets of user names and passwords, the one you got when you signed up for the site and the one you got issued after paying.  They did a really poor job of telling you which username/password to use.  Coincidentally, it’s the site ( your email ) password you use here, not the one they assigned you.  Note to MacInCloud, you should really add some text to explain this!

 

Anyways, once you have logged in, you will be brought to this screen:

image

 

This is where you use the credentials they assigned you.

Somewhat annoyingly, these are the resolutions you are limited to:

image

 

My native resolutions are 1920x1080 and 1366x864, so these selections aren’t ideal for me.  This was one of the problems I had when remoting my personal iMac and I did find it irritating.  Also, given the fact you are using credentials that were assigned to you, it would be really nice if this screen had a “remember my username and password” option like the prior screen where you need it less.

 

You are greeted by this screen initially.

image

 

 

Then…

 

Well, then it doesn’t work.  It worked exactly once, I resized the window and I got a Java EOF error.  Since then I have been unable to log back in using the webclient.  I tried in Firefox and same problem, then I tried in IE9 and it simply isn’t supported.

 

So, if you are here for the web client… go elsewhere, it simply isn’t ready for prime time.  Plus in the very brief period of time I was connected, it was exceedingly slow.

 

 

Connecting using Remote Desktop

This is the main way to connect.  You download the zipped connection file in the welcome email, extract it and you are presented with the following options. 

 

image

 

Double click the selection that is most appropriate to you and your connection.

 

image

 

Use the provided username and password to log in.

 

And you are now at your desktop.  Can you tell by the fact the iPhone simulator is loaded already exactly what kind of developers they are targeting?

 

image

 

 

So what is installed already?

 

This is one area where MacInCloud really shines.  The following software was pre-installed:

  • Adobe DreamWeaver CS 5.5
  • Adobe Fireworks CS 5.1
  • Adobe Flash CS 5.5
  • Adobe Illustrator CS 5.1
  • Adobe InDesign CS 5.5
  • Adobe Media Encoder CS 5.5
  • Adobe Photoshop CS 5.1
  • Cocos2d 1.0.1
  • Corona SDK stable and development versions
  • Dropbox
  • Eclipse
  • Firefox
  • Chrome
  • GameSalad
  • Office 2011
  • MonoDevelop
  • OmniGraffle Professional
  • RhoStudio
  • Stonetrip
  • TestFlightSDK
  • TextWrangler
  • Titanium Studio
  • Xcode

 

Curiously absent?  Unity or any 3D applications.  Otherwise it’s pretty much a whose who of game development applications.

 

What the heck is going on here?

 

This may be one of those weird karma issues, but in my brief period trying to test this, my connection dropped… a lot.  Within an hour I had 10 disconnects from my ISP ( Rogers in Canada ).  For the record I haven’t had my internet connection drop in months, and I’ve experienced 10 in the last two hours?

 

Again, as I said, it might be horrifically bad timing…

 

Or MacInCloud and my ISP don’t play well together.  I know not to blame RDP, as I literally use it every day to remote control my servers.  However, when I used my Phone’s LTE connection, I didn’t have a single issue.

 

 

What’s the performance like?

 

Well, this is the biggie, isn’t it?  How well does it actually perform.

 

I tested with two devices, my home cable connection and my phone LTE connection.  The speed of your connection is obviously going to be a big factor, but both connections should be considered above average.

 

I can’t really describe how it performs, so instead I will screen capture both in action and let you judge for yourself.  I start each with a speedguide test so you can gauge my connection against your own.  To contrast, I remote desktop to one of my servers ( ironically enough, hosted by the same company MacInCloud use ) to compare against remote controlling a Windows server.  HD movie here.

 

Evaluating MacInCloud performance

One word, disappointing.

 

How do I quit?

 

Log in to your PayPal account.

 

On the main screen, locate your “My Recent Activity” part, click the details link:

image

 

Now in the subscription details, at the very top you should see:

image

 

Click the Cancel link

image

 

Click the Cancel Profile button.

 

And…

image

 

Your PayPal subscription is now canceled.    If you go back to your recent activity, it should now look like:

 

image

 

And now you will no longer be billed.

 

 

So then, what’s the verdict?

 

Not great I am afraid to say.  While making the screenshots on how to cancel, I went ahead and cancelled.  When I signed up I fully intended to go for the full month but the performance was just so appallingly bad.  Frankly when I remote controlled my iMac from home the performance was actually quite a bit better than with MacInCloud.com.

 

It is possible I just caught them on a bad bandwidth day, so you have little to lose for trying it yourself.  Perhaps in your case it will work better.  Both of my connections are quite quick and neither was even close to functional.

 

Now, if you just want to log into a Mac to compile your code and publish it to the AppStore, this service might prove useful.  However, to actually do any development, I just couldn’t see anyone having the patience. Actually debugging a running game I think would be simply impossible.

 

I hope MacInCloud.com massively increase the speed or that I caught them on a bad day, as their idea is brilliant.  The execution however leaves a lot to be desired.

 

You can of course try it for yourself, it won’t cost you a cent!  Well… it will cost you exactly one cent.

General


9. May 2012

 

 

A few days back I was contacted about translating some of my Vita tutorials into Spanish.  Well the results of that conversation are available here on IndiceVita.es.  This is my imagespritesheet tutorial translated into Spanish.  I believe they are going to translate more tutorials in the future, so if you prefer reading Spanish to English, be sure to check it out! You need to register to be able to access the forum.

 

Is the translation good?  Beats the heck out of me!  My Spanish abilities begin and end with “La cerveza, por favor”, which frankly has served me well! Smile

 

On this topic, if you are interested in translating any of my content to another language, either hosted on your own site or hosted here, feel free!  The only thing I ask in return is a link back to the original source tutorial ( AKA, credit ) and a link to the finished product, either emailed to me ( mike [at] gamefromscratch [dot] com ) or as a comment.  It’s always cool seeing something you’ve written in a different language… even if you are reading it through a half illegible Google translation!

General


9. May 2012

 

I logged in to my Safari account this morning as part of my daily ritual to check which newbookcover books have been added and I discover they’ve added Beginning iOS 3D Unreal Games Development.  So what’s so special about this book?  Well, there are a couple of things… First off, although there are a half dozen books on using UDK on the market, this is to my knowledge the first book focused specifically on mobile, the area I am most interested in.  Second, I’ve been meaning to look closer into the Unreal engine and this book looks intriguing.  So this book has certainly been added to my reading list.

 

For those of you that don’t yet have a Safari account, the book is also available on Amazon.com and is shockingly inexpensive right now.  It’s currently $24.34 for the dead tree version and $17.59 for the kindle version.  If only all tech books were priced like this I wouldn’t have to subscribe to Safari! Smile

 

Anyone out there doing mobile development with UDK?  I would be curious to hear what your experiences have been.

General


AppGameKit Studio

See More Tutorials on DevGa.me!

Month List