Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

 
Advanced search

1354668 Posts in 62632 Topics- by 54382 Members - Latest Member: Sirhaian

January 22, 2019, 08:12:52 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsBogey Green Golf
Pages: [1]
Print
Author Topic: Bogey Green Golf  (Read 3620 times)
goshdarngames
Level 0
*



View Profile
« on: August 11, 2015, 03:33:58 AM »

Bogey Green Golf is (will be) a simple 3D mini-golf game for one player or multiplayer hot seat.

The game is being developed using Unity3D and will be published for WebGL on GameJolt, Kongregate and possibly other game hubs.

This is my first time to attempt a 3D game though I have made a few 2D games in the past.

About This Devlog:

This is my first time creating a devlog for a project.  I will update it with each significant piece of work I do.

As this is my first time creating a 3D game I'm sure to learn lots as I go so I will try and share anything I learn here.

Developer Info:

More information can be found here:

Website - Twitter - Tumblr - reddit
« Last Edit: August 11, 2015, 03:52:24 AM by goshdarngames » Logged
goshdarngames
Level 0
*



View Profile
« Reply #1 on: August 11, 2015, 03:51:28 AM »

Getting The Ball Rolling:

The first task I set myself was to create a 3D golf ball complete with dimples.

The first method I thought of was to create an image with circles arranged in a hexagonal grid and apply that as a texture to a sphere.

I created this texture using Context Free Art:



I used the following tutorial to create a UV map for the sphere and applied the texture:  





It explained things well but unfortunately the technique did not produce good results.



Due to the way rectangular textures are applied to spherical objects the texture gets stretched towards the ‘equator’ and shrinks at the poles.  To get around this and apply a rectangular texture to a sphere I would have to stretch the dots in the texture to account for the stretching of the sphere.

This sounds complicated.  In addition, the texture looks rather flat - I’m not sure if it’s possible to create convincing dimples using just a texture.

I decided instead to look for an alternative way to create a 3D golf ball.  After searching YouTube I found a 40 second long video in Greek that looked promising.  Thankfully his key-strokes appear on screen…





Following along with this video I was able to re-create his results, which creates the dimples using the mesh rather than a texture.

This tutorial produced a better golf ball than many other ones I viewed because it uses an Icosphere (sphere made from equilateral triangles) rather than a UV sphere (sphere made from rectangles).  Golf balls created from UV spheres tended to have noticeable ‘corners’ in the dimple layout.



Using the Greek Golf Ball method I was able to make a nice looking golf ball and import it to Unity no problem:



Watch It Roll Here: gfycat.com/ArtisticDeadAustraliankestrel

A potential drawback of this method I can foresee is that the mesh I have created for the ball has a lot of polygons.

I am intending to release this game as a WebGL game so performance may be an issue.  If I find that the game is running poorly on my low-end test machine then I will see about implementing a LOD where the ball is replaced by a lower object model when it is in the distance.
Logged
woodsmoke
Level 3
***


View Profile
« Reply #2 on: August 11, 2015, 06:14:03 AM »

Wow, that looks excellent!
Logged

goshdarngames
Level 0
*



View Profile
« Reply #3 on: August 11, 2015, 06:48:14 AM »

Wow, that looks excellent!

Thanks!  I don't have much experience with Blender but hopefully I can achieve a nice clean look for the game.
Logged
goshdarngames
Level 0
*



View Profile
« Reply #4 on: August 13, 2015, 09:46:13 AM »

Note:  This post can be viewed on my tumblr with code inline!  http://goshdarngames.tumblr.com/post/126517339735/architecture  (Not a shameless plug - it just has prettier code!)

System Architecture!

For this project I have decided to try and contain all the Game Objects for the main game in one scene in Unity.

In the first game I made using Unity (Jet The Pack) I put each level in a different scene.  The major drawback of this method is that if I had decided to add an object to all levels I would have to update every scene individually.  It’s always a pain to make a major design change halfway through development but it would have been pretty horrible having to click ‘open scene’ 40 times.

In the second game I made in Unity (Spacebomb) I had a separate scene for the Main Menu, Gameplay and Game Over screens.  The main disadvantage that I encountered was that if there was a Coroutine that ran while the scene changed it could cause a null-pointer exception.  This lead to a difficult to reproduce bug where the scene changed while the player was respawning it would make the player completely invincible on their second go.  I didn’t catch this in my testing because I tended to only play through the game once - it was only when a friend was playing that it occurred and I had to watch them smugly play the game with infinite health.

For Bogey Green Golf I have decided that I will store all the game objects in one Unity Scene and manage the state of the game with the State Patten, described here:

http://gameprogrammingpatterns.com/state.html

The state machine and state that I created for the project can be found in this gist:

https://gist.github.com/goshdarngames/a150b34995de00726206

State.cs specifies an interface that objects must implement if they are to be used as States.  This interface provides methods to set up, update and tear down the state.

The State Machine class allows any object to have one or more state machines as properties and provides public methods to change the state.  Most objects will only need one state machine but it’s possible to have more.

The first object that will make use of the Finite State Machine is the Game Manager.  This object is responsible for controlling the logic of the game.  It uses a Finite State Machine to control the logic and holds a reference to a ‘Game Data’ object that can be used to share data between different parts of the system.  I am storing all the game data in a dedicated class so that it will be easier to implement saving and loading later - just store all the data in this class.

https://gist.github.com/goshdarngames/617aceea1eb0d9fa5e77

The ‘Single Player Gameplay State’ is an object that implements the ‘State’ interface defined earlier.  It does nothing at the moment but the logic that controls the single player mode will go here.

https://gist.github.com/goshdarngames/11327d21f9129d12dd62

As well as implementing the ‘State’ interface the Single Player Gameplay State inherits from an abstract class called ‘Game State’.

This Game State is a common base type for all the states that are part of the Game Manager.  Having this common inheritance means that it is possible to define data and methods that all the Game Manager states will have access to.  At the moment the Game State provides only a constructor which grants access to the ‘Game Data’ defined earlier.


https://gist.github.com/goshdarngames/0a71e615d8c3da75c9ba

Although this is all a load of code that does nothing it is an important step towards defining the system architecture of the game.  Hopefully these classes will provide a good structure to organize the code.
Logged
goshdarngames
Level 0
*



View Profile
« Reply #5 on: August 17, 2015, 08:10:49 AM »

Music Makes The World

I am hoping to compose my own music for Bogey Green.  I am a novice when it comes to music production so I’ll share what I’ve learned.

Software

The tool I make most use of is a free tracker called openMPT:

http://openmpt.org/



A tracker allows you to create instruments from audio samples and then create patterns that tell the system what notes you want to play.

There is a good overview of how to use OpenMPT with a focus on creating Chip Tunes here:





OpenMPT also allows for VST plug-ins (virtual synthesizers) so there is a huge variety of instruments available.

Here is a forum thread that discusses VST plug-ins:

http://forum.openmpt.org/index.php?topic=332.0

A few google searches should find you plenty of free VSTs to use.

Theory

I think a good way to learn music theory is to learn an instrument.  I learned the harmonica myself with a focus on blues improvisation.  There are tons of resources available online to learn how to play and you’ll pick up theory as it’s relevant to what you’re trying to play.

A good way to make passable music is to pick a chord progression suitable for the genre of music you’re trying to make.  A chord progression is a pattern of chords that is repeated throughout a song that gives the song its structure.  A vast number of successful songs are based on a relatively low number of popular chord progressions.

Here’s a site with good information on chord progressions:

http://www.angelfire.com/fl4/moneychords/lesson.html

The first thing I did was write a bass line.  I followed the principle in this video about writing bass-lines and was able to create something I was happy with:





Next thing I did was create a drum section.  I don’t really have any resources on that - it’s just pure perseverance!

I can say I used the TR-808 VST plug-in from this website:

http://sagamusix.de/en/samples/

The final piece of the puzzle is writing a melody.  This can be extremely daunting if you have no idea what you’re doing (like me).

I found a great explanation of the process that gave me a good starting point:

https://youtu.be/rl-V2IsUprQ

The Result

After a few evenings spent tinkering I managed to put together two measures of the the song I was working on.

This track is intended to give a lazy farm-like feel and it’ll be the background music for one of my courses.  It’s only in its infancy at the moment but I’m happy with where it’s going so far!

Take a listen here:

https://soundcloud.com/user-451293910/bogey-green-farm
Logged
Canucklehead
Level 0
**



View Profile WWW
« Reply #6 on: August 17, 2015, 08:41:33 AM »





Watch It Roll Here: gfycat.com/ArtisticDeadAustraliankestrel

A potential drawback of this method I can foresee is that the mesh I have created for the ball has a lot of polygons.


You could always unwrap and normal map that super high poly golf ball just onto a sphere, that is, if you're not already doing that (I didn't see normal maps mentioned so) It will react the same to light as well (if you bake it correctly)
Logged

goshdarngames
Level 0
*



View Profile
« Reply #7 on: August 17, 2015, 08:49:34 AM »





Watch It Roll Here: gfycat.com/ArtisticDeadAustraliankestrel

A potential drawback of this method I can foresee is that the mesh I have created for the ball has a lot of polygons.


You could always unwrap and normal map that super high poly golf ball just onto a sphere, that is, if you're not already doing that (I didn't see normal maps mentioned so) It will react the same to light as well (if you bake it correctly)

That idea makes sense.  I'm completely new to 3D modelling so I didn't see a way around it.

I'll see if I can figure out how to do this in the future and make a post if so!
Logged
Canucklehead
Level 0
**



View Profile WWW
« Reply #8 on: August 17, 2015, 09:02:42 AM »





This should get you started in the right direction.
*Disclaimer, not a blender user so can't tell for sure*
Logged

goshdarngames
Level 0
*



View Profile
« Reply #9 on: August 17, 2015, 09:25:52 AM »





This should get you started in the right direction.
*Disclaimer, not a blender user so can't tell for sure*

Thanks for the link!  Looks like a great way to lower polygon-counts in objects.
Logged
goshdarngames
Level 0
*



View Profile
« Reply #10 on: January 05, 2016, 01:20:02 PM »

In a previous post I went through the process of creating a golf ball with dimples in Blender.  The ball that I produced looked really good but there is a chance it could affect the performance of the game as it had a lot of polygons.

Here’s a picture of the ball.  Note that the dimples are created using the model’s mesh - there are a lot of triangles.  10,236 triangles to be precise.  I’m no expert when it comes to performance but 10K triangles sounds like a lot for a single model.



A user of TIG Forums called Canucklehead informed me that it is possible to bake the depressions in the surface of the golf ball into a Normal Map.  It is faster for a 3D renderer to use a normal map for lighting than to process the extra geometry.  There is some discussion of the matter in this reddit thread.

I followed this tutorial to generate a normal map for my golf ball:

http://www.katsbits.com/tutorials/blender/bake-normal-maps.php

This is the normal map I created.  Note that I used smooth shading on the low-poly model in order to remove its lines from the finished normal map:



In order to apply the normal map in Unity I exported it as a PNG separate from the model of the golf ball and set it as the normal map in the model’s material.

Note: If your normal map is messed up when you try and apply it check that Create from Grayscale is unchecked in the texture.



Here’s a picture of the finished gold ball using the normal map.  The triangle count has been reduced to 960.



Bonus GIF:



I’m experimenting with the idea of using explosives instead of traditional golf clubs…
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic