Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

21. czerwca 2017


Three.js, the popular open source 3D JavaScript framework, just released version r86.  If you want to learn more about Three.js, we have a two part series available here and here.  This release contains several changes and fixes, as well as adding 3ds support to the editor, documentation improvements, new examples and more.  The changes to the core from the release notes:


Source

GameDev News

19. czerwca 2017


Esoteric Software just released version 3.6 of their 2D boned based animation software Spine 3.6.  Spine enables you to animate 2D sprites in a manner very similar to that used in 3D packaged, then easily use those animations in various game engines with the provided runtimes.  The 3.6 release brings a number of new features, including:

  • in application preview with several runtime controls3.6-clipping
  • clipping (see image to right)
  • black tinting
  • mesh manipulation tools
  • weight painting tools
  • point attachments
  • improved file dialogs
  • AnimationState improvements
  • several runtime improvements


You can learn a lot more details about this release in the release blog post or read the change logs.  If you want to learn more about Spine, we did a hands-on review available here and embedded below in video form.

GameDev News

19. czerwca 2017


CopperCube is a 3D game engine that aims at being simple, all in one and easy to use, with minimal to zero coding required.  They just released version 5.7 which brings a few new major features such as dynamic level loading, realtime shadows and more.

Complete details of the release are available here and summarized below.

  • Realtime Shadows Support
  • Big game support and dynamic level loading
  • Simplified uploading games to Android Play Store
  • Floating point render targets

As well as smaller fixes including:

  • The default Android update mode is now 'every frame' instead of 'when scene changed', resulting in a more smooth gameplay. Also, this will reduce the 'stuttering' which some people noticed on faster Android devices.
  • The editor now uses some bigger default window sizes when run on bigger screens
  • Windows .exe Apps no longer store their variables in the "CopperCubeApp" folder in the registry, but in a folder named after the application name.
  • The engine now uses less memory when run on Windows / Mac OS
  • WebGL: Replaced local files warning with updated information (the "allow-file-access-from-files" flag doesn't work anymore with Chrome)
  • Fixed a bug causing dynamic point lights not to rendered correcty sometimes when there was a directional light active as well
  • Improved polish translation
  • Fixed a problem when using the "Restart scene" action which caused memory to leak.
  • Resetting a behavior now using the "Reset" action causes the FPS camera and keyboard controlled camera also to reset their keyboard states


You can learn more about CopperCube here.

GameDev News

18. czerwca 2017


Unity released a new patch for the Unity 5.6 branch, 5.6.1p4.  This patch has several improvements and fixes, details from the patch release notes:


Improvements
  • Android: Enabled NEON in Umbra.
  • UI: CanvasRenderer::OnTransformChanged will not be called when object is inactive. (815861)
  • Video: Optimized video decoding directly into RenderTexture if it is the same size as the video stream
  • Video: Skip-ahead functionality improvements.
Changes
  • GI: Added support for LOD baking in Progressive Lightmapper. Light Probes are not necessary anymore when baking LODs using Progressive Lightmapper.
  • GI: Support for double sided materials in Progressive Lightmapper. Added a new material setting that causes lighting to interact with backfaces. When enabled, both sides of the geometry get accounted for when calculating Global Illumination. Backfaces do not count as invalid when seen from other objects. Backface rendering is not controlled by this setting nor will backfaces be represented in the lightmaps. Backfaces bounce light using the same emission and albedo as frontfaces.
Fixes
  • (916119) - Android: Fixed a regression where Banner Ads are invisible, but still clickable.
  • (905867) - Android: Fixed an out of memory crash when using a static splash screen.
  • (910194) - Animation: Fixed an issue where using an override controller multiple times would not animate correctly.
  • (917343) - IL2CPP: Fixed an issue which caused IL2CPP to fail to convert assemblies if two non-existing methods with the same declaring type were referenced from any assemblies.
  • (907449) - Particles: Correctly initialize default curves, when creating new Particle Systems.
  • (907277) - Particles: Fixed an occasional crash when emitting from a skinned mesh renderer shape.
  • (none) - Particles: Fixed incorrect values for emission burst min and max when upgrading from an older Unity version.
  • (912158) - Physics 2D: Fixed an issue where ContactFilter2D collision normal limits failed.
  • (917323) - Physics 2D: Fixed an issue with Raycast not always detecting a CapsuleCollider2D or a BoxCollider2D.
  • (909020) - Video: Fixed issues regarding video looping/end detection.
  • (904924) - Video: Fixed failing VP8 transcode on Windows due to unsupported audio codec.
  • (898171) - Video: Fixed an intermittent failure to load video tracks on iOS.
  • (906044) - Video: Fixed invalid video stride evaluation.
  • (900524) - Video: Added support for transcoding to tiny VP8 resolutions.
  • (904578) - WebGL: Fixed AudioSource.time return value.
  • (903767) - WebGL: Fixed IE InvalidStateError load-time error.
  • (901252) - WebGL: Fixed Profiler connection.
  • (903092) - WebGL: Fixed Template Custom tags not being replaced at build time.
  • (892185) - WebGL: Fixed WebAssembly build failure with Full exceptions on Windows.
  • (897782) - WebGL: Fixed WebAssembly missing setTempRet function.
  • (891835) - WebGL: Fixed WebAssembly missing setThrow function.
  • (891431) - WebGL: Fixed WebAssembly runtime error: integer overflow/unrepresentable.
  • (905625) - WebGL: Fixed custom cursor support.
  • (898210) - WebGL: Released WebCam after use so other tabs can use it.
  • (871541) - Windows Store: Fixed a crash which happened when retrieving WheelHit.Collider after having previously set it to null on .NET scripting backend.
  • (909977) - Windows Store: Fixed a potential stack overflow when building a project with a large custom cursor.
  • (914797) - Windows Store: Fixed exceptions thrown in OnGUI callback not being logged on .NET scripting backend.
  • (912074) - Windows Store: Fixed System.Numerics.dll not being referenced by scripts when using IL2CPP scripting backend.
  • (909703) - Windows Store: Fixed UNetWeaver crashing when using .NET 4.6 API Compatibility level with IL2CPP scripting backend when deriving from .NET 4.6 specific types.
  • (902234) - Windows Store: Fixed WorldAnchorStore.GetAsync crashing the player.

GameDev News

14. czerwca 2017


This is a brand new series being launched on YouTube and GameFromScratch and is somewhat different in scope.  The aim is to essentially make the same game several times in different game engines.  We are creating a simple bowling game in various different 3D game engines.  In fact, we are creating this bowling game which we completed earlier using the PlayCanvas game engine.


For each game engine in the series we will implement basically the exact same game, along with a step by step text version, plus a video of the process.  This should be useful for a number of reasons.  First it enables you to directly compare the workflow between different game engines.  Second, it shows... perhaps not best practices, but how to get started creating a full featured, if extremely limited, 3D game with physics, scenes, model importing an more.


At this point in time I have begun implementing it in a number of different engines, including:

    • PlayCanvas
    • Atomic Game Engine
    • Godot 2.x
    • Unity
    • Unreal Engine

Depending on the popularity of the series I am willing to implement the game in other engines as well with a few caveats.  The engines need to support all the required features ( level editor, 3d model importing, physics, etc ) required to make the game.  So while I could implement such a title in a code focused API such as Ogre or LibGDX, it’s completely outside of the scope of what I am trying to accomplish here.  I also need to have access to the game engine, either through public domain, free trial, etc.  This currently rules out some engines such as Leadwerks and Shiva unfortunately. 


Beyond the engines listed above, I’d love to hear what other engines you would like to see covered? 


GameDev News

Month List

Popular Comments

PlayStation Mobile SDK Tutorial 2: Hello World2, Hello Harder!
Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon


26. April 2012

 

In this tutorial we are going to manually manage the game loop manually.  Additionally we are going to look at the various ways of handling input from the gamepad.  This tutorial builds on the code we developed in the previous tutorial.  As you may recall, we created a “Hello World” sprite and centered it to the camera.  This time, we are going to give the user the ability to control the sprite’s position and size using the gamepad.

 

 

Let’s get straight to the code:

 

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.Core.Imaging; namespace HelloWorld { public class AppMain { public static void Main (string[] args) { Director.Initialize(); Scene scene = new Scene(); scene.Camera.SetViewFromViewport(); var width = Director.Instance.GL.Context.GetViewport().Width; var height = Director.Instance.GL.Context.GetViewport().Height; Image img = new Image(ImageMode.Rgba,new ImageSize(width,height),new ImageColor(255,0,0,0)); img.DrawText("Hello World", new ImageColor(255,0,0,255), new Font(FontAlias.System,170,FontStyle.Regular), new ImagePosition(0,150)); Texture2D texture = new Texture2D(width,height,false,PixelFormat.Rgba); texture.SetPixels(0,img.ToBuffer()); img.Dispose(); TextureInfo ti = new TextureInfo(); ti.Texture = texture; SpriteUV sprite = new SpriteUV(); sprite.TextureInfo = ti; sprite.Quad.S = ti.TextureSizef; sprite.CenterSprite(); sprite.Position = scene.Camera.CalcBounds().Center; scene.AddChild(sprite); Director.Instance.RunWithScene(scene,true); bool gameOver = false; while(!gameOver) { Sce.Pss.HighLevel.GameEngine2D.Director.Instance.Update(); if(Input2.GamePad.GetData(0).Left.Release) { sprite.Rotate(Sce.Pss.HighLevel.GameEngine2D.Base.Math.Deg2Rad(90)); } if(Input2.GamePad0.Right.Release) { sprite.Rotate(Sce.Pss.HighLevel.GameEngine2D.Base.Math.Deg2Rad(-90)); } if((Sce.Pss.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Up) == GamePadButtons.Up) { sprite.Quad.S = new Vector2(sprite.Quad.S.X += 10.0f,sprite.Quad.S.Y += 10.0f); sprite.CenterSprite(); } if((Sce.Pss.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Down) == GamePadButtons.Down) { sprite.Quad.S = new Vector2(sprite.Quad.S.X -= 10.0f,sprite.Quad.S.Y -= 10.0f); sprite.CenterSprite(); } if(Input2.GamePad0.Circle.Press == true) gameOver = true; Sce.Pss.HighLevel.GameEngine2D.Director.Instance.Render(); Sce.Pss.HighLevel.GameEngine2D.Director.Instance.GL.Context.SwapBuffers(); Sce.Pss.HighLevel.GameEngine2D.Director.Instance.PostSwap(); } Director.Terminate(); } } }

 

 

 

The top portion of the code is completely unchanged, our new additions start at the line:

Director.Instance.RunWithScene(scene,true);

 

The key addition here is the second parameter “true”.  This bool is telling the Director singleton that we are going to handle the game loop ourselves, this means we need to call 4 methods manually ( described in a moment ).  Next up we create a bool gameOver, which is going to control when we exit our game loop.  Obviously we don’t want to exit right away, so we default it to false.  Speaking of game loops, that’s what the while line does, loops over and over until gameOver is set to true.

 

Now in each iteration of our loop, there are four methods we have to call, Update(), Render(), GL.Context.SwapBuffer() and PostSwap().  Update() tells the director we have moved on to the next frame, Render() draws the frame, SwapBuffers displays what Render() drew on the backbuffer to the screen (makes it visible) and finally PostSwap() tells the director we’ve finished swapping buffers and it must be called after SwapBuffers().  Those four combined represent a complete game loop, all the rest of the code handles input from the game pad.

 

Just to make something perfectly clear here, I am using 3 different ways to check for input, *you won’t do this in your code*.  I am just doing it to illustrate all of your different options in one example.  You should just pick one ( probably Input2 ) and use only it.  Lets look at them one at a time.

 

if(Input2.GamePad.GetData(0).Left.Release) { sprite.Rotate(Sce.Pss.HighLevel.GameEngine2D.Base.Math.Deg2Rad(90)); }

 

 

This method is the most likely way you will deal with Input.  Input2 is a wrapper around the Input object to make things a bit simpler.  GetData takes a parameter telling it which control ( controller 1, controller 2, etc ) you want to poll, returning a GamePadData object, representing the state the controller is in.  We are then checking if the “Left” button has been released.  In the case Left is released, we then rotate our sprite 90 degrees.  Rotate takes an angle value in radians, so we use the Math.Deg2Rad() helper function to convert from degrees to radians.  Of course you could have passed the radian value in instead of converting, 1.5709633 is 90 degrees in radians, it’s just a bit harder to look at.

 

if(Input2.GamePad0.Right.Release) { sprite.Rotate(Sce.Pss.HighLevel.GameEngine2D.Base.Math.Deg2Rad(-90)); }

 

 

This if statement is almost identical to the last one, but instead of using GetData(0), we use a handy alias (GamePad0) that represents exactly the same thing.  The only other difference is, in this case we are checking to see if the “Right” button has been released, and we are rotating by a negative value ( the other way ) if it is.

 

 

if((Sce.Pss.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Up) == GamePadButtons.Up) { sprite.Quad.S = new Vector2(sprite.Quad.S.X += 10.0f,sprite.Quad.S.Y += 10.0f); sprite.CenterSprite(); } if((Sce.Pss.Core.Input.GamePad.GetData(0).Buttons & GamePadButtons.Down) == GamePadButtons.Down) { sprite.Quad.S = new Vector2(sprite.Quad.S.X -= 10.0f,sprite.Quad.S.Y -= 10.0f); sprite.CenterSprite(); }

 

 

This time we are using Input directly, using Input instead of Input2.  As you can see, the results are a bit more “raw”.  In this case we have to use bit masking to determine if a given button is pressed and there is no Released option.  In this case we are checking for the “Up” and “Down” buttons.  In the event that the user is pressing Up or Down, we are modifying the Scale of the quad our hello texture is pasted on.  Remember initially Quad.S is equal to the size of the screen in pixels.  If we press Up, we scale the image up 10 pixels in size, if we press down, we shrink it by 10 pixels in size.

 

 

Finally, we check ( using the Input2 method ), if the user has pressed the Circle button, in which case we set gameOver to true, causing our loop to exit and our program to end.

 

 

One thing to notice at this point is how we scaled the sprite.  Unlike rotate, we didn’t call a method, instead we modified the Quad.S(cale) property.  The actual transformation matrix of a node ( which SpriteUV is derived from ) is actually determined combining the Position, Scale, Skew and Rotation+Angle+RotationNormalize properties.  Therefore modifying any of these properties will translate the node accordingly.

 

 

Now run our game, if we press left or right, we rotate 90 degrees, while pressing up or down scales the images.  Finally press Circle to exit.

 

 

helloworld2

 

 

One last thing I suppose needs covering… how exactly do you press Left, Right, or Circle on the simulator?

Left directional key
Cursor key: ←

Up directional key
Cursor key: ↑

Right directional key
Cursor key: →

Down directional key
Cursor key: ↓

Square button
Alphabet: A

Triangle button
Alphabet: W

Circle button
Alphabet: D

Cross button
Alphabet: S

SELECT button
Alphabet: Z

START button
Alphabet: X

L button
Alphabet: Q

R button
Alphabet: E

 

 

Sadly, you cannot currently emulate the analog sticks using the simulator.  Obviously you can on the Vita device.

 

EDIT: Oops, forgot to include the project source code, which you can download here.

Programming , , ,

blog comments powered by Disqus

Month List

Popular Comments