Subscribe to GameFromScratch on YouTube Support GameFromScratch on Patreon

19. September 2017


Perhaps the biggest complaint about Blender is the user experience and this argument has some merit.  Once you learn Blender it starts to become somewhat zen to use, but getting there is a painful process.  3+ key hotkeys are rampant to do some of the most common tasks and a few of the design decisions, such as right click selection are just simply bad.  Granted many of these options can be configured away but that again requires a fairly advanced amount of understanding and by that point many new users have already been turned off.


You would think, being an open source project and all, someone would have forked it and made a more accessible version by now?  Well… someone has!  Meet BForArtists (as in Be For Artists), a Blender fork focused on making the user interface more intuitive.  How did they do that? 


Well first is an over all face lift.  Better contrasted theme really does make it easier to distinguish different features and functions.

image

You no doubt also noticed the prevelence of icons throughout the interface:

image


This cuts down on the amount of scrolling and is useful for people who learn by exploring.  They have also configured toolbars for common tasks:

image


And perhaps nicest of all, have camera pre-set controls available as icons instead of just hotkeys:

image


On the topic of hotkeys, they have also reconfigured most of them.  One nice option available is the ability to display the most common hotkeys in the background of the window:

image


Other new options are the ability to lock and outright hide the 3D cursor… a point of confusion for many new users.  You also have extended control over wireframe display, very useful for modellers.

image


Menus have also been greatly streamline:

image


While default layouts for common tasks have been added:

image


They even have their own manual!  What’s impressive is, at least so far, they’ve kept up with each new release of Blender.  There are of course downsides to learning via BForArtists, a great deal of the tutorials for Blender wont work without translation.  Additionally once mastered, Blenders default user interface can be great.  In my opinion though, BForArtists is a vastly superior experience for new developers and one I recommend to those put off by Blenders user experience in the past.


BForArtists is free and open source available for download here and in source form here.


Art , ,

18. September 2017

In this section of our Bowling with Game Engines series, we will be implementing our bowling game using the open source Godot engine. The idea is straight forward, implement the same simple 3D game across a number of game engines. One warning right up front, this engine uses Godot 2.x on the eve of Godot 3.0 being released. Godot 3.0 will receive rather large changes to the 3D portions of Godot. We will go step by step through the process of creating our game, both in text as well as a video version available. All of the assets used in this tutorial are available on Patreon as part of the bowling game kit, along with project files and this document in PDF form. Don’t worry, these aren’t needed to follow along.  There is a video version of this entire process available here or embedded below.

First fire up Godot and create a new project. Once Godot is loaded, click New Project, then pick a location to create the project in. The project directory will be the project’s name.

clip_image002

Now double click your newly created project to load it.

clip_image004

Let’s start things off by creating our Title screen. Before we go too far ahead, lets create an empty node to parent our scene then save it. In the Scene panel, click the Plus Icon

clip_image006

Select Node from the following dialog:

clip_image008

Select the Scene menu, then Save Scene as:

clip_image010

Name it TitleScene.tscn and click Save. Ok now the we have a Scene to work with, time to get to work. Let’s import the title scene image. You can use any supported texture format, but if you are working from the Patreon files, the document you want is Titlescreen.png. Select the Import Menu, then Texture

clip_image012

In the following dialog, be sure to select 2D Texture, locate the texture you want to import, then click the Import button. The defaults for Texture options and format are fine. Please note, for 2D steps you can actually skip this step and directly copy the texture into your project folder using Explorer/Finder.

clip_image014

Now that we have our title screen texture, it’s time to go ahead and use it. In the Scene panel, select the node we created earlier, then click the + Icon. This time we want to add a node of type TextureFrame. You can filter the options available in the node list to quickly find the node you want to create.

clip_image016

Now that we’ve created a TextureFrame node, in the Inspector, locate the Texture property, drop down the menu and select Load. Select our newly loaded texture.

clip_image018

Now turn the Expand property on:

clip_image020

And resize the Texture to the full size of your viewport:

clip_image022

Woot, most of the way there… now we want to add some looping title music that palys when the game starts. We need to import a song to use. In this case I’m using a simple WAV file that we are going to loop. The process is just like with Textures, select Import->Audio Sample

clip_image024

In the resulting dialog, locate the WAV file you want to import, in options select Loop then finally select Import.

clip_image026

Ok, now that we have a sound effect to play, let’s play it. In the Scene panel, select TextureFrame then click the + Icon. This time the node type we want is a sample player. Your scene should look like this now:

clip_image028

Hmmm, that error Icon can’t be a good thing, can it? No worries, we just need to define the sample to play. This is going to take a couple step sthough, first we need to add a Sample Library, then add our sample to it. Don’t worry, it’s not that difficult. With the SamplePlayer selected, in the Inspector drop down the Samples option and select New SampleLibrary.

clip_image030

Now select samples again and this time choose Edit.

clip_image032

This brings up a new editing window:

clip_image034

Click the folder icon, select your imported sample in the resulting dialog. It should then look like:

clip_image036

Now in the Inspector we should be able to select our newly loaded sample in the Play menu:

clip_image038

This whoever has one EXTREMELY annoying side effect… the sample will play over and over in the editor while you have this scene open. Yeah, it gets annoying fast. Time to do our first scripting instead! Let’s add some code that plays our sound when the scene is loaded… a sure way to keep sane! This means we need to add a script to node in our scene… don’t worry, its pretty easy.

We are going to create and attach a script to the TextureFrame node, the parent of our SamplePlayer. Right click the Texture Frame in the Scene panel, then select Attach Script.

clip_image040

In the resulting dialog click the .. next to Path and name your file TitleScreen.gd, then click Create.

clip_image042

This will bring up the script editor like so:

clip_image044

Now we want to change the code like so:

func _ready():
set_process_input(true)
get_node("SamplePlayer").play("BowlingOhYeah")


Now it’s time to check out all of our hard work. Now click the Play icon:

clip_image046

Since this is the first time we’ve run it, we need to tell Godot which Scene is the entry point for our application.

clip_image048

Click the Select button. Then select TitleScreen.tscn in the resulting dialog. Now your application should run!

clip_image050

Now of course we have to get to the guts of our actual game. Next we create our next scene where the majority of the game is going to occur. First make sure to save your existing scene if you haven’t already. Then click Scene->New Scene.

clip_image052

Every scene must have at least one node. So in our newly created scene, again click the + Icon in the Scene Panel and select Node. Now save the scene as GameScene.tscn.

Perfect, now we have somewhere to go from our title screen... Next, we need to have some kind of action or trigger to switch between scenes. We are going to handle the scene change whenever the user presses any key or clicks any mouse button. This involves appending a bit of code to our script. Simply add the following function at the bottom of TitleScene.gd:

func _input(event):
  if(event.type == InputEvent.KEY || event.type == InputEvent.MOUSE_BUTTON):
  get_tree().change_scene("GameScene.tscn")

Excellent! We are now done with the Title scene… Time to move onto the main event!

If it isn’t already loaded, load up GameScene.tscn. Simply double click it in the asset view:

clip_image054

Multiple scenes can be open at once and you cant toggle between them using tabs across the top of the screen. You can also switch between scripting, 2D and 3D modes. We are working in 3D in this scene, so make sure that’s selected.

clip_image056

Now we are going to assemble all of the various assets we need to create our game. We have a Bowling Pin, Bowling Lane and in this example a Bowling Ball. You may note this differs from other “Bowling With” tutorials, in that in other tutorials we procedurally generate the bowling ball. In Godot 2.x there are no editor assessable geometric primitives so we instead import the bowling ball as a 3D model. There is however a plugin available for Godot that enables you to create meshes like spheres, cubes and planes that I document the use of in this video ( https://www.youtube.com/watch?v=Ca2FcVb2lBk ).


Click here for next part in the series.


The Video

Programming , ,

18. September 2017

Click here for the previous tutorial section.

Now it’s time to create our bowling lane. If you are a Patreon, the resources we are using are located in the GFS Dropbox in the GameKits\Bowling folder. Godot works a bit different from other game engines in that complex models are imported as scenes. Simply select Import->Scene

clip_image002

At a minimum select the DAE (COLLADA) file location, then the location within your project to import into, then finally click import.

clip_image004

One thing that is very important to realize here is this process will import the entire scene from the model file. This includes lights, cameras, etc… so be sure when you export to DAE, you only export the items you want imported. Of course, you’ve got the option of deleting unneeded items in Godot if needed.

It is possible that the import process doesn’t always bring in the textures, so we will cover doing this part manually. If your model imported fully textured, you can skip ahead and ignore this section. First import that texture object into your scene. The bowling lane has two textures, a diffuse (color) and normal (depth) map. Select Import->Texture.

clip_image006

Then select the texture, where to import it and finally hit the import button.

clip_image008

Repeat this process for each texture file you need to import. Now we need to define a material on our BowlingLane node. Select the BowlingLane, locate MeshInstance->Material->0, click the drop down and select New FixedMaterial.

clip_image010

This will create a new material. Drop it down again and this time select Edit.

clip_image012

Now locate Diffuse, drop down the pull down and select Load.

clip_image014

Select your newly imported Diffuse texture. Now repeat the process for Normal

clip_image016

You can control the strength of the normal map using the Normal Depth setting:

clip_image018

Your Bowling Lane should now look a lot more like a bowling lane than before!

clip_image020

Now we need to add some Physics nodes to our lane. In the Scene graph, select the BowlingLane mesh instance, right click and select Add Child Node.

clip_image022

Select StaticBody.

clip_image024

This will make our lane part of the physics simulation, but as the name suggests, it wont be affected by it. So basically, a static body can be hit, but nothing will happen to it. Finally, we need to define the geometry of physics object. Right click your newly created StaticBody, select Add Child Node Again and this time select CollisionShape.

clip_image026

With the newly created CollisionShape selected, locate Shape, drop down and select New BoxShape.

clip_image028

Now select the Shape drop down again and select Edit

clip_image030

Now modify the Extents until it tightly wraps the underlying shape.

clip_image032

We are now done with the lane. Save the scene file and close it.

Creating the Bowling Pin

Now we repeat the exact same process, except this time with our bowling pin. The process is actually identical, except instead of creating a StaticBody, we create a PhysicsBody. However, in this case the RigidBody needs to be the parent of the Pin. Don’t worry, its pretty simple. Be sure to make the RigidBody node a child of the Root “BowlingPin” node, then drag the Pin node onto the newly created RigidBody. So we can identify the node in code later, also rename it from RigidBody to PinRigidBody. The end result should look like:

clip_image034

In the properties of our RigidBody, we also want to set Can Sleep off and Contact Monitor on, like so:

clip_image036

Creating our Bowling Alley

Now it’s time to put it all together. Go back to GameScene in the editor and we need to create some instances of our lane and pins. Simply locate the lane in the assets view, right click and select Instance.

clip_image038

Now repeat the process for the bowling pin. Your scene should now look something like:

clip_image040

Next reposition the bowling pin and so it’s above the lane and down a bit. Now it’s the moment of truth… are you a 5 pin or 10 pin fan? Either way, duplicate the first pin. Locate it in the Scene panel, right click and select duplicate ( or select and hit Ctrl + D ).

clip_image042

Then move the pin into position and repeat the process. If you want, now is your chance to create 7 pin bowling! Personally, I went with 5, and it looks like this:

clip_image044

5 pin for life! We are certainly getting there! It’s at least starting to feel like a bowling game. It would be a good time to check out our work, but press play and you’ll notice a problem… nothing shows up! That’s because we need to create a camera! With the root node selected, create a new node and select Camera:

clip_image046

Now position the camera in your scene using the transform manipulator. With a camera node selected, you can hit the Preview button at any time to, well, preview the camera.

clip_image048

Now when we press play…

clip_image050

Hmm, a bit dark in here isn’t it? Well that makes sense, we have no lights in our scene. We have two options here… we can add some lights or we can add ambient lighting. Getting the later right is probably a bit easier, so lets take that approach. With the camera selected, located the Environment setting, drop it down and select New Environment

clip_image052

Now drop it down again, this time selecting Edit. Now turn Ambient lighting on and select a color close to white.

clip_image054

One thing you might find is that the results are really blurry and undesirable. There are two ways to address this… first, select the texture, locate the flags propert and turn off MipMap and Filtering:

clip_image056

Finally, in the mesh of an imported scene, you can turn off baked lighting:

clip_image058

Both of these steps are completely optional. At this point our game should look like:

clip_image060

And our scene should look like:

clip_image062

Now all we need is a ball!  Click here for the next tutorial section.

Programming , ,

18. September 2017

Click here for the previous section in this tutorial.

Time for the exact same process as pin and lane, except this time rename the RigidBody to BowlingBallRigidBody. The major differences are we used a SphereShape for our collision shape.

clip_image002

Plus, in physics, in addition to setting Sleep off, and Contact Listener on, we increase the Mass to 3. The value doesn’t really matter, this just means our bowling ball is 3x heavier than the pins.

clip_image004

Just for now lets get things rolling (ugh… the puns) and give our ball some initial velocity, so when we play our game, things happen. We will override this in a bit when we implement user control. Simply set the velocity to -15 or so on the Z axis:

clip_image006

Now when you play the game, if you’ve done everything correctly, the ball should roll down the lane and hit the pins.

clip_image008

Almost there! Now let’s add some audio that happens when the ball hits a pin. It’s the exact same process as back when we created our title screen, so I’m not going to go over it again. Just be sure to add the SamplePlayer to the bowling ball like so:

clip_image010

Then go in and create a sample library and add our bowling ball sound effect, in my case Hit.wav.

Now it’s time to do a bit of coding. The BowlingBall is going to be the heart of our game, so let’s add the script to it. Using the same process as back in the title screen, select the BowlingBall root node and attach a new script. Now select the child BowlingBallRigidBody node, switch to the Node tab, select body_enter and hit the Connect button at the bottom right hand corner.

clip_image012

Another window will pop up asking you which node to connect to. Select our BowlingBall node then click Connect.

clip_image014

This will open up the script editor and create a new function for us. Inside the function enter the following code:

func _on_BowlingBall_body_enter( body ):
	var name = body.get_name()
	if name == "PinBody":
		self.get_node("SamplePlayer").play("Hit")

Now when you play the scene, when the bowling ball hits the pins, audio should play!

Handling User Input

** Before you continue… go back to the bowling ball and remove the Linear velocity we added earlier! We are going to handle that manually from this point on! **

Next we need to give the user some control over the bowling ball. First off, we need to create an Input map. We are going to use left and right arrows for moving the ball, well… left and right. Additionally, the space bar will be used to throw the ball.

Go to the Scene -> Project Settings Menu, then switch to the Input Map tab. Now we are going to add an entry. Simply enter LEFT in the text box, then click Add:

clip_image016

Click the + Icon, then select Key

clip_image018

When prompted, press the Left arrow key

clip_image020

Now repeat this process for Right and Space. You can of course map multiple keys to a single ID, so if you wanted LEFT to also trigger when the A key is pressed, or on Left mouse click, you can. Now lets wire our script up to handle input. Simply add or replace the following in your BowlingBall script:

func _ready():
	set_process_input(true)

func _input(event):
	if(event.is_action_released("LEFT")):
		self.get_node("BowlingBallRigidBody").apply_impulse(Vector3(0,0,0),Vector3(-1,0,0))

	if(event.is_action_released("RIGHT")):
		self.get_node("BowlingBallRigidBody").apply_impulse(Vector3(0,0,0),Vector3(1,0,0))
		
	if(event.is_action_released("SPACE")):
		self.get_node("BowlingBallRigidBody").apply_impulse(Vector3(0,0,0),Vector3(0,0,-35))

Great, we can now control our ball, have collisions with pins and audio plays. We are 99% of the way toward a finished game… only one catch… you can only play once… that’s a bit of an issue no? Let’s do a quick and direct reset by reloading the scene when the user presses the R key. Add RESET to the InputMap and append the following code to your _input() function:

	if(event.is_action_released("RESET")):
		get_tree().reload_current_scene()

And our final complete code should look like:

extends Spatial

func _ready():
	set_process_input(true)
	set_process(true)

func _input(event):
	if(event.is_action_released("LEFT")):
		self.get_node("BowlingBallRigidBody").apply_impulse(Vector3(0,0,0),Vector3(-1,0,0))

	if(event.is_action_released("RIGHT")):
		self.get_node("BowlingBallRigidBody").apply_impulse(Vector3(0,0,0),Vector3(1,0,0))
		
	if(event.is_action_released("SPACE")):
		self.get_node("BowlingBallRigidBody").apply_impulse(Vector3(0,0,0),Vector3(0,0,-35))

	if(event.is_action_released("RESET")):
		get_tree().reload_current_scene()

		
func _on_BowlingBallRigidBody_body_enter( body ):
	var name = body.get_name()
	if name == "PinRigidBody":
		self.get_node("SamplePlayer").play("Hit")


And all done, one complete if primitive bowling game!  Once again, here is the video version.

Programming , ,

15. September 2017


Some time back Microsoft launched the UWP, Universal Windows Platform, a target enabling you to create Windows store apps that could also be run on XBox One hardware.  There was however a big catch, limited resources.  From the UWP documentation:

  • The maximum memory available to an app running in the foreground is 1 GB.

    • The maximum memory available to an app running in the background is 128 MB.
    • Apps that exceed these memory requirements will encounter memory allocation failures. For more information about monitoring memory use, see the MemoryManager class reference.

  • Share of 2-4 CPU cores depending on the number of apps and games running on the system.

  • Share of 45% of the GPU depending on the number of apps and games running on the system.

  • UWP on Xbox One supports DirectX 11 Feature Level 10. DirectX 12 is not supported at this time.

  • All apps must target the x64 architecture in order to be developed or submitted to the store for Xbox.

So, basically you got access to half of an Xbox One…  Bummer.  Thankfully in the upcoming Fall Update, that is all about to change!  From the Microsoft blog:

Since the advent of consoles, developers have asked for ways to create games for one platform that you could run anywhere. With the release of the Expanded Resources feature in the Windows Fall Creators Update, we are taking the industry closer to that goal than it has ever been before. Now, developers will automatically have access to 6 exclusive cores, 5 GB of ram and full access to the GPU!

Awesome!  I have a video discussing this change available here.

GameDev News

Month List

Popular Comments