Dealing with Unity Forces for Statics Game Concept

AddForce – Unity Official Tutorials

Youtube – AddForce – Unity Official Tutorials

The bare basics of scripting forces in Unity with rigidBody’s. The AddForce can take two inputs: a vector for direction and magnitude, and what type of force it is.

ForceModes
  • Acceleration – Continuous change; not affected by mass
  • Force – (Default) Continuous change; affected by mass
  • Impulse – Instant change; affected by mass
  • VelocityChange – Instant change; not affected by mass
AddTorque – Unity Official Tutorials

Youtube – AddTorque – Unity Official Tutorials

The bare basics of scripting torques in Unity with rigidBody’s. The AddTorque can take two inputs: a vector axis to apply torque around, and what type of torque it is. This is very similar to AddForce. Important to remember, Unity uses “LEFT HAND RULE” for rotation.

ForceModes
  • Acceleration – Continuous change; not affected by mass
  • Force – (Default) Continuous change; affected by mass
  • Impulse – Instant change; affected by mass
  • VelocityChange – Instant change; not affected by mass
Game Ideation
Engineering Teaching & Research Equipment – Armfield

EF-1.1 – Statics – Forces experiment kit
Youtube – EF series video Statics Forces 1 1 3

The links are similar videos, the first is just directly to the site of those that made the kit, and the second is a Youtube link. This kit provides hand on experience for understanding a lot of topics based around static equilibrium. Topics such as 2D shape center of masses, force vectors, and much more can be covered with this tool.

Game Idea – Engineering Statics Game

Following the general idea of the kit shown above, the game environment is populated with nodes that apply controllable forces to a central ring object. These forces can be altered to change the position of the ring. The environment will spawn collectibles that the player must direct the ring towards in order to collect them. To move the ring, they will need to intelligently alter the forces applied by the nodes.

Quick sketch of concept
Concept visualization of force body diagram to show how game can function.

High Score and Saving Data in Unity: Lessons Learned

I wanted my score and high score text objects to contain text other than solely the score value (in this case it was a simple “Score: ” and “High Score: “). This did lead to a couple issues throughout the debugging process where I realized I didn’t add the extra text when changing/resetting score values, so the extra text would be missing and just the number would be shown. For larger projects, it may be safer and more consistent to make a separate small method for setting a score and/or high score that will add that extra text every time when called (removes a copy/paste step of doing similar actions throughout the scoring script.) And again following a main point from the Board to Bits video, set your key names as string variables within the code so they are easier to consistently call throughout your program.

Saving Data in Unity: PlayerPrefs

Saving Data in Unity: PlayerPrefs – Youtube Link

Youtube tutorial by Board to Bits Games going over the basics of PlayerPrefs in Unity. This shows limitations of PlayerPrefs as something that is mostly useful for storing smaller amounts of data for the player on their system. This also showed a good practice to follow when using key value pairs: set your key as a string variable so that you can call that key variable name every time you need it instead of hoping you type it in exactly correctly every time.

How to Make a High Score in Unity

How to make a HIGH SCORE in Unity by Brackeys

How to make a HIGH SCORE in Unity – Youtube Link

This youtube tutorial from Brackeys shows the bare bones way of getting a high score system started for a game in Unity. It uses the built in PlayerPrefs function to save data to the user’s system.

PlayerPrefs.SetInt and PlayerPrefs.GetInt were used. Playerprefs.SetInt lets you set a key value (which is basically a name for this value when you want to find it) and the actual value to set to this key at the time. Playerprefs.GetInt will return the value stored at the key value given to it, or if nothing is stored within that key location, it will return the default value, which is the second variable value you set when using PlayerPrefs.GetInt.

Generating Levels for Physics-based Puzzle Games with Estimation of Distribution Algorithms

Title: Generating Levels for Physics-based Puzzle Games with Estimation of Distribution Algorithms

Resource: Academic Paper

Authors:Lucas Ferreira, Claudio Toledo

Link to Paper on Researchgate.net

“This paper presents an estimation of distribution algorithm (EDA) to generate levels for physics-based puzzle games with the Angry Birds mechanics” from the abstract.

This can serve as a foundation for generating meaningful and interesting content for physics-based games

Experimenting with Unity: Player Movement – Rotation

Player controlled by rotation about a point

Vimeo – Video of Rotational Movement

I was experimenting with controlling a player agent solely through rotational forces. The first style I looked at was not a force in the physical sense as it just operates on moving the player at a constant rotation speed. This is dictated by the placement of a rotation pivot which the player can place to indirectly move the player agent.

To add an extra amount of control, the player can also press a key in order to reverse the direction of the rotation (switch between clockwise and counterclockwise). This combination of features led to some interesting movement patterns. One of the first things that jumps out is the fact that the movement being dictated by a constant rotation speed still leads to varying velocities by the player agent as this will vary drastically with the radius between the pivot point and the player object. Large pivot distances can lead to dramatic speeds, but will lead to the player covering a larger area.

Notes to remember:

I was having an issue where the rotation was not perfectly making a circle in the game view. It turns out the scripts were correct, but the camera needed to be set to orthographic so the camera was just viewing it at an angle. Remember to check both the editor view and game view closely to help determine camera-based issues.

Using cursor inputs in Unity is a bit awkward. It has been done plenty of times so the basic scripting is available on Unity’s main site, but the process of creating a plane, raycasting, and converting between screen and world space is a lot to keep track of. This might also be something to look into if mouse inputs are acting strange.

Predictive Physics Simulation in Game Mechanics by Hamalainen et al.

Resource – Research Paper
Title: Predictive Physics Simulation in Game Mechanics
Authors: Perttu Hämäläinen, Xiaoxiao Ma, Jari Takatalo, Julian Togelius

This paper explores using innovations with software and increasing technology and how to apply them to games as a game mechanic. This specifically targeted the increased ability of computers to process physics simulations as a predictive measure for the player to interact with. In the simplest explanation it can break down fast paced physics-based actions into a turn by turn type game or simulation.

Game Feel by Steve Swink

Thesis Resource – Book
Title: Game Feel: A Game Designer’s Guide to Virtual Sensation
Author: Steve Swink

This was a resource suggestion from Tony Rowe that breaks down games and how they are played into their most basic elements. The chapters specifically targeted at individual games show promising parameterization of player controllers that could be effectively applied to my future research.

GDC 2018 Talk – Math for Programmers by Squirrel Eiserloh

There are 6 talks about techniques and implementations of procedural content generation in games. The order is as follows:

  1. The Power of Procedural Recipes – Procedural Recipes
  2. Semi-Procedural Content Pipelines – Semi-Procedural Methods
  3. Staged Parametric Map Generation – Staged Parametric Generation
  4. Digging with Perlin Worms – Perlin Worms (for rivers/roads/caves)
  5. Discrete Constructs in Endless Worlds – Infinite Worlds
  6. Juicing World Generation with Metadata Feedback – Juicing PCG with Metadata