Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

6. June 2012


I can always tell when Diablo 3 servers are being patched as I get an influx of visitors viewing this page.  I wrote that when I was experiencing crashes when they last patched the Diablo 3D3Boom servers.  It would appear the server patch crashes are still occurring.


To people having this problem, this post is a much more concise description of the problems I had, and the fix.  So if you are unable to log in to Diablo after a server patch, or the patcher is giving you “Diablo III is already running” or “Diablo III has stopped working”, this might be the fix to your problem.


Basically what it boiled down to is the Blizzard installer gave me the en-GB ( Great Britain ) installer instead of the en-US one.  This is all fine and good, until Blizzard releases a patch.  The problem is, the US patch is released first, causing all the people connecting to the US servers with a non-US client to crash until the other servers are patched.


It may be possible to work around the problem by manually editing the patch_url in your agent.db file, I had some initial success this way.


However, the *best* solution, is to reinstall using the client native the server you are playing on.  Granted, this is a giant pain in the backside, especially if your internet connection has usage caps!


That said, the actual BEST solution, is for Blizzard to fix this problem, or failing that, roll out all the patches at once!


Hopefully this helped a few of you get over the Diablo 3 patching woes!  If nothing else, it allowed me to create that Diablo mushroom cloud graphic. Smile



EDIT: For those that don’t want to re-install, you can try editing the patch_url manually.  Worst case scenario… you will have to re-install! Smile


To do so, follow these instructions.  Of course, these instructions are for switching to the Asian server, so substitute en-US for American, and en-GB for European servers.  Also, be sure to note that there are multiple copies of the file you need to edit, not just one!

Totally Off Topic

5. June 2012


As part of the same document that announced the PlayStation Mobile compatible phones fromplaystation-mobile-on-htc HTC, Sony also released a list of developers currently working on PlayStation Mobile content.  Give it a look and I believe that you will agree that it is fairly impressive:





List of Third Party Game Developers and Publishers



ASGARD Co.,Ltd. 
CYBERFRONT Corporation
eitarosoft, inc.
FromSoftware, Inc
GungHo Online Entertainment, Inc.  
HAMSTER Corporation




Atomicom Ltd.
Beatnik Games Ltd. 
Big Head Games Ltd.
Crash Lab Ltd.
Futurlab Ltd. 
Green Hill
Honeyslug Ltd.
Icon Games Entertainment Ltd. 
Omni Systems Ltd.
Origin8 Technologies Ltd.
Playerthree Ltd. 
Index Corporation 
Kadokawa Games, Ltd.
Kadokawa Shoten Publishing Co., Ltd. 
MarvelousAQL Inc.
NCM Entertainment Corporation / Forever Entertainment S.A. Group
Nippon Ichi Software, Inc.
Pygmy Studio.Co., Ltd.
Q Entertainment Inc.
SEGA Corporation
SUCCESS Corporation
34  companies in total
22 companies in total
Pompom Software Ltd.
Quirkat Inc.
Retroburn Game Studios Ltd.
Ripstone Ltd. 
SFB Games Ltd.
Spinning Head Software Ltd. 
Thumbs Up
Tikipod Ltd.
Triangle Factory
Wired Productions Ltd.




Some pretty impressive names in there, from Sony, From Software and GameLoft to Nippon, Tecmo and Sega.  If you want, you can download the original PDF here.  The press release is available here.  With heavy weight support behind their effort, Sony may become a big player in the ( currently horrible? ) Android game market.



So, if Sony had this many developers lined up and working on PlayStation Mobile games, why didn’t they mention that at the E3 press conference???  I am sure nobody would have minded a few minutes axed out of the Wonderbook demonstration!


5. June 2012


At E3, Sony announced that Sony PlayStation Suite would be rebranded as PlayStation mobile.  More importantly, they announced that HTC would be the first 3rd party Androidatt-htc-one-x manufacturer to release a PlayStation certified phone, but they never went into any details about what that phones would be supported.  It appeared to be an HTC One that he was holding on stage.


Fortunately, that information is available on Sony’s Japanese corporate site:


The license program to expand PS Mobile, dedicated for portable hardware manufacturers. SCE will not only license logos but also provide necessary development support. As of June 5, 2012, the line-up of PlayStation™Certified devices include the HTC One series of smartphones, HTC One™ X, HTC One™ S, and HTC One™ V. Content developed with official version of PlayStation®Mobile SDK will be available on those devices later this year, also Xperia™ arc, Xperia™ acro, Xperia™ PLAY, Xperia™ acro HD, Xperia™ S, Xperia™ ion, Xperia™ acro S from Sony Mobile Communications AB, and "Sony Tablet" S and "Sony Tablet" P from Sony Corporation.


It seems strange that the information was here, but not as part of the official announcement!


Anyways, there you have it.  PlayStation Mobile is coming to the HTC One X, S and V phones, in addition to Sony’s existing lineup.  Now lets just hope they sign a deal with Samsung soon!



4. June 2012


As was just announced at E3, Sony has rebranded PlayStation Suite to 


All of our existing tutorials will will still work exactly the same, and I will rebrand them as I come to them. I aim to make this site “the site” for all your PlayStation Mobile programming needs.


Code wise, absolutely nothing has changed, but if you are coming here from a search engine and you run into a post referring to the  PlayStation Suite SDK, you now know why.



Other than the change to PlayStation Mobile, Sony has now officially announced a partnership with HTC, bring PlayStation mobile to more devices!  Long rumoured, it is nice to know that there are going to be PlayStation based HTC phones!


So, if you are interested in developing for PlayStation Mobile, head over here for a list of tutorials to get you started!

News , ,

4. June 2012


This tutorial we are going to look at SpriteList and show how it can result in a massive increase in performance.  Along the way, we are going to create two custom Scene classes, one that performs poorly, and one the does not.  Along the way we are going to demonstrate dynamically generating a UI and how UI scenes and GameEngine2D scenes can co-exist.


A lot of the following code we have covered in previous tutorials, so I am not going to go into a great deal of detail.



First lets take a look at our AppMain.cs


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 Sce.Pss.HighLevel.UI; namespace SpriteList { public class AppMain { static private bool quit = false; public static void Main(string[] args) { Director.Initialize(); Director.Instance.RunWithScene(new Sce.Pss.HighLevel.GameEngine2D.Scene(),true); UISystem.Initialize(Director.Instance.GL.Context); Sce.Pss.HighLevel.UI.Panel dialog = new Panel(); dialog.Width = Director.Instance.GL.Context.GetViewport().Width; dialog.Height = Director.Instance.GL.Context.GetViewport().Height; Button buttonUI1 = new Button(); buttonUI1.Name = "buttonGoSlow"; buttonUI1.Text = "Slow version"; buttonUI1.Width = 300; buttonUI1.Height = 50; buttonUI1.Alpha = 0.8f; buttonUI1.TouchEventReceived += (sender, e) => { Director.Instance.ReplaceScene(new SlowVersion()); }; Button buttonUI2 = new Button(); buttonUI2.Name = "buttonGoFase"; buttonUI2.Text = "Fast version"; buttonUI2.Width = 300; buttonUI2.Height = 50; buttonUI2.SetPosition(0,55); buttonUI2.Alpha = 0.8f; buttonUI2.TouchEventReceived += (sender, e) => { Director.Instance.ReplaceScene(new FastVersion()); }; Button buttonUI3 = new Button(); buttonUI3.Name = "buttonExit"; buttonUI3.Text = "Exit App"; buttonUI3.Width = 300; buttonUI3.Height = 50; buttonUI3.SetPosition(0,110); buttonUI3.Alpha = 0.8f; buttonUI3.TouchEventReceived += (sender, e) => { quit = true; }; dialog.AddChildLast(buttonUI1); dialog.AddChildLast(buttonUI2); dialog.AddChildLast(buttonUI3); Sce.Pss.HighLevel.UI.Scene scene = new Sce.Pss.HighLevel.UI.Scene(); scene.RootWidget.AddChildLast(dialog); UISystem.SetScene(scene); while(!quit) { Director.Instance.Update(); Director.Instance.GL.Context.Clear(); Director.Instance.Render(); UISystem.Update(Touch.GetData(0)); UISystem.Render(); Director.Instance.GL.Context.SwapBuffers(); Director.Instance.PostSwap(); } } } }


We set up our Director object and tell it to run with an empty scene.  We then set up our UISystem in a similar manner.  Then we create a Panel object named dialog by hand.  This process is basically the same as what UI Composer generates for us, just all created in code.  We then add 3 buttons to our panel.  For each button we add a TouchEventReceived handler in the form of a lamda function.


If they click the Slow Version button, we create a new SlowVersion scene object and set it as the active scene in the Director.  If we click the Fast Version button, we create a FastVersion scene object and make it the active scene.  We will cover creating these two classes in just a moment.  Finally for the Exit App button, we toggle the quit bool to true, causing the event loop to exit.


Now that we have created our 3 buttons, we add them to our dialog Panel.  We then create an empty Scene ( UI scene, not GameEngine2D! ), add our dialog to it and set it as the active scene.  This will render our buttons visible.


Now we handle our event loop.  Everything here is pretty much identical to in previous tutorials, the only key difference is that we call our UISystem.Update() and Render() within the game loop.  It is important that UISystem.Render is called after Director.Instance.Render, or the Director will render over top of it!  This loop will now continue processing until the quit bool is set by pressing the Exit App button.


Now lets take a look at SlowVersion.cs… the bad way of doing things!



using System; using Sce.Pss.Core.Graphics; using Sce.Pss.HighLevel.GameEngine2D; using Sce.Pss.HighLevel.GameEngine2D.Base; namespace SpriteList { public class SlowVersion : Scene { private TextureInfo _textureInfo; private Texture2D _texture2D; private System.Collections.Generic.List<SpriteUV> _sprites; public SlowVersion () { this.Camera.SetViewFromViewport(); _texture2D = new Texture2D("/Application/Jet.png",false); _textureInfo = new TextureInfo(_texture2D); var w = Director.Instance.GL.Context.GetViewport().Width; var h = Director.Instance.GL.Context.GetViewport().Height; System.Random rand = new System.Random(); _sprites = new System.Collections.Generic.List<SpriteUV>(); for(int i = 0; i < 1000; i++) { SpriteUV sprite = new SpriteUV(_textureInfo); sprite.Position = new Sce.Pss.Core.Vector2(rand.Next(0,w) - w/2 ,rand.Next(0,h) -h/2); sprite.Quad.S = new Sce.Pss.Core.Vector2(_texture2D.Width,_texture2D.Height); sprite.Rotate(rand.Next (0,360)); sprite.Schedule( (dt) => { sprite.Position = new Sce.Pss.Core.Vector2(rand.Next(0,w)-w/2 + _texture2D.Width/2,rand.Next(0,h)-h/2); }); _sprites.Add(sprite); } foreach(var sprite in _sprites) { this.AddChild(sprite); } FPS fps = new FPS(); fps.Position = new Sce.Pss.Core.Vector2(0,0); this.AddChild(fps); } public override void Draw () { base.Draw (); } } }


Most everything here has also been covered in prior tutorials, but perhaps not in this form.  SlowVersion is inherited from Scene.  For member variables it contains a single Texture2D and it’s corresponding TextureInfo object.  It also contains a List of SpriteUV’s to be rendered every frame.  All of the sprites point to the same Texture, our Jet.png graphic:




Bonus points if you can identify the type of jet! Winking smile


In our constructor we go about the usual things, first we setup our camera, load our texture from disk and create our TextureInfo from the loaded texture.  Next we allocate our List and then create 1000 instances of our jet sprite, randomly rotated and positioned on screen.  We also register a lamda Schedule method that will be called every frame. During each update we simply randomly relocate the airplane sprite on screen.  Finally, we add the newly created sprite to our list.  Next we loop through all of our sprites and add them to our scene.


In the next bit we create an FPS object, a simple helper object for displaying the current frame rate on screen.  We will cover the code in a second.



Now let’s take a look at FastVersion.cs, which you will soon notice is basically just a copy and paste job!


using System; using Sce.Pss.Core.Graphics; using Sce.Pss.HighLevel.GameEngine2D; using Sce.Pss.HighLevel.GameEngine2D.Base; namespace SpriteList { public class FastVersion : Scene { private TextureInfo _textureInfo; private Texture2D _texture2D; private System.Collections.Generic.List<SpriteUV> _sprites; private Sce.Pss.HighLevel.GameEngine2D.SpriteList _spriteList; public FastVersion () { this.Camera.SetViewFromViewport(); _texture2D = new Texture2D("/Application/Jet.png",false); _textureInfo = new TextureInfo(_texture2D); var w = Director.Instance.GL.Context.GetViewport().Width; var h = Director.Instance.GL.Context.GetViewport().Height; System.Random rand = new System.Random(); _sprites = new System.Collections.Generic.List<SpriteUV>(); for(int i = 0; i < 1000; i++) { SpriteUV sprite = new SpriteUV(_textureInfo); sprite.Position = new Sce.Pss.Core.Vector2(rand.Next(0,w) - w/2 ,rand.Next(0,h) -h/2); sprite.Quad.S = new Sce.Pss.Core.Vector2(_texture2D.Width,_texture2D.Height); sprite.Rotate(rand.Next (0,360)); sprite.Schedule( (dt) => { sprite.Position = new Sce.Pss.Core.Vector2(rand.Next(0,w)-w/2,rand.Next(0,h)-h/2); }); _sprites.Add(sprite); } _spriteList = new Sce.Pss.HighLevel.GameEngine2D.SpriteList(_textureInfo); foreach(var sprite in _sprites) { _spriteList.AddChild(sprite); } FPS fps = new FPS(); fps.Position = new Sce.Pss.Core.Vector2(0,0); this.AddChild (_spriteList); this.AddChild(fps); } public override void Draw () { base.Draw (); } } }


You may notice two things… first, neither SlowVersion nor FastVersion do *ANY* cleanup and leak like sieves!  In non-demonstration code, be sure to clean up after yourself!

Second, they are virtually identical, but if you run them, FastVersion runs easily 4-5x faster… why is this?


That is the power of SpriteList, which performs a function very similar to SpriteBatch if you are familiar with XNA programming.  We only made two changes.



private Sce.Pss.HighLevel.GameEngine2D.SpriteList _spriteList;

We declared out spriteList member.



_spriteList = new Sce.Pss.HighLevel.GameEngine2D.SpriteList(_textureInfo); foreach(var sprite in _sprites) { _spriteList.AddChild(sprite); }


Then, instead of adding the sprites to the scene, we add them to our spriteList object.  That’s it!


There are limitations, all sprites must have a common TextureInfo, BlendMode and Color property to be added to a spriteList, so basically create one spriteList per TextureInfo if you have multiple sprites on screen and you will see a large performance boost.



Finally lets take a quick look at the FPS.cs widget.  This is just a crude hack to display FPS on screen by creating a small texture.


using System; using Sce.Pss.Core; using Sce.Pss.Core.Graphics; using Sce.Pss.Core.Imaging; using Sce.Pss.HighLevel.GameEngine2D; using Sce.Pss.HighLevel.GameEngine2D.Base; namespace SpriteList { public class FPS : SpriteUV { TextureInfo _ti; public FPS () { Texture2D texture = new Texture2D(150,1000,false, PixelFormat.Rgba); _ti = new TextureInfo(texture); this.TextureInfo = _ti; this.Quad.S = new Sce.Pss.Core.Vector2(150,100); Scheduler.Instance.ScheduleUpdateForTarget(this,1,false); } public override void Update (float dt) { _ti.Dispose(); Image img = new Image(ImageMode.Rgba, new ImageSize(150,100), new ImageColor(255,255,255,0)); img.DrawText("FPS:" + (1/dt).ToString(), new ImageColor(255,255,255,255), new Font(FontAlias.System,32,FontStyle.Bold), new ImagePosition(0,0)); Texture2D texture = new Texture2D(150,100,false, PixelFormat.Rgba); texture.SetPixels(0,img.ToBuffer(),PixelFormat.Rgba); img.Dispose(); _ti = new TextureInfo(texture); this.TextureInfo = _ti; base.Update (dt); } } }


All we are doing here is creating our own SpriteUV derived object, FPS, but instead of loading the texture from file, we generate an image dynamically, just like we did way back in Hello World.  We then schedule ourselves to update every frame.  In the update we create an image and print the the current frames per second ( the fraction of a second our current time delta takes) and update our texture to the newly created image.



Here is our code in action.  Unfortunately the nature of the output resulted in a horrifically large animated gif, so I had to put this one up on YouTube:


Running our SpriteList demo


You can download all of the project code here.

Programming , , ,

Month List

Popular Comments

Adventures in Appcelerator part two
Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

20. March 2012



As you might have noticed from my previous post I am currently evaluating Appcelerator and I have to say, the early frustrations are far too common.  In the future I may do a full review, if I don’t give up on it completely.  For now though, let me share a few of the issues I’ve run into, beyond the one described in the previous post.



Failed to find Javac.

I got an error the first time I tried to compile my code, stating that it failed to find javac. So I opened a command prompt, CD to %JAVA_HOME% and there it is.  WTF?  Some Googling later and I discover it doesn’t support file paths with spaces!  Seriously?  What, is this 1994?  Moved Java to c:\jdk and problem went away.  Seriously, when was the last time you ran into an app that didn’t support spaces?



Blackberry Support

A big part of why I chose Appcelerator in the first place is support for iOS, Android AND Blackberry, as I have all three tablets in my house.  I go to make a Mobile application in Appcelerator and Blackberry is grayed out.  I click through to a “Get SDK” link, download 500mb of Blackberry stuff, restart Appcelerator Studio and… Blackberry is still grayed out.  Turns out this is a “pro only” feature…  and that’s only discovered by reading a forum post, their own documentation says nothing of the sort!  Disappointing, not only that it’s a premium feature, but because they didn’t indicate this anywhere, the UI suggests otherwise, causing me to waste a couple hours of my life.



Android device support

So, native blackberry support isnt a huge deal, now that you can bundle Android apps as Blackberry Playbook apps, so I continue on targeting just Android.  I configure and setup the Android SDK, create a demo app, launch it on by Transformer, all good so far.  So I set a breakpoint, hit debug and…….. the emulator launches.  If you’ve done any Android development, you know using this emulator is somewhere between an 8 and 9 out of 10 on the “Things that hurt” scale.  It is sloooooooooooooooow.  But get this, Appcelerator can’t debug on device, emulator only.   This.  Sucks.  Hard.





So, let’s just say, after two days I am extremely unimpressed, and I haven’t even got around to coding yet!



Anyone out there have prior experience with Appcelerator?  Am I just hitting all the bad stuff up front, or is this what I should expect as the norm?


blog comments powered by Disqus

Month List

Popular Comments