videogames development

CSharp – Switch Statement

CSharp – Switch Statement

The switch statement is like a set of if statements. It’s a list of possibilities, with an action for each possibility, and an optional default action, in case nothing else evaluates to true.

switch case


using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main()
        {
            int caseSwitch = 1;
            switch (caseSwitch)
            {
                case 1:
                    Console.WriteLine("Case 1");
                    break;
                case 2:
                    Console.WriteLine("Case 2");
                    break;
                // if case 1 and case 2 are false:
                default:
                    Console.WriteLine("Default case");
                    break;
            }
        } // End Main()
    }
}

switch case – while

How to create a loop:

...
case 4:
    while (true)
        Console.WriteLine("Endless looping. . . .");
...
By |CSharp, Video Games Development|Commenti disabilitati su CSharp – Switch Statement

Unreal Engine – Class Blueprint

Unreal Engine – Class Blueprint

A Class Blueprint is a Blueprint that can be reused many times in your world.
If you will have more than one or two instances (e.g., a TV set that can be shot or turned on/off), then it probably makes sense to create a Class Blueprint. Inside a Class Blueprint you can store Meshes, Lights and connects their behaviours with visual Scripts.

Create a Class Blueprint

1. Content Browser> click un ‘New’> Blueprint> Choose a Parent Class example: Actor

When your Blueprint is first created, or when you make changes to it in the Blueprint Editor, an asterisk will be added to the Blueprint’s icon in the Content Browser. This indicates that the Blueprint is not saved.

2. Content Browser> ‘Save’ button -> TO SAVE YOUR ASSET

3. Editor> MAIN TOP MENU> File> Save, to save the corrent level -> TO SAVE YOUR LEVEL (level.umap)

OR

1. MAIN TOP TOOL BAR> Blueprints> New Class Blueprint> Choose a Parent Class example: Actor> Give it a name and a folder (usually Blueprints/yourBlueprint)

When your Blueprint is first created, or when you make changes to it in the Blueprint Editor, an asterisk will be added to the Blueprint’s icon in the Content Browser. This indicates that the Blueprint is not saved.

2. Blueprint window> ‘Save’ -> TO SAVE YOUR ASSET

3. Editor> MAIN TOP MENU> File> Save, to save the corrent level -> TO SAVE YOUR LEVEL (level.umap)

Search a Class Blueprint

The best way it is put all your Blueprints inside a Blueprints folder (Content Browser/Game/Blueprints).
To find a Blueprint inside another location go to Content Browser> Game (the top folder)> ON THE RIGHT: Filters and/or Search

Edit a Class Blueprint

1. Content Browser> double click over yourBlueprint, the Class Blueprint Editor will appear.

Defaults mode
Setup of default parameters:
– Rendering
– Replication
– Input
– Actor
– Tags

Components mode
Use the roolout menu ‘Add Components’ to add components as:
– Audio
– Skeletal Mesh
– Static Mesh

– Paper Flipbook
– Paper Sprite
– Paper Tile Map Render

etc…

OR

DRAG AND DROP assets from Content Browser to Components List

Navigate inside the View using Autodesk Maya-style controls:
– LMB to move foward/backward
– ALT + LMB to move up/dowm/left/right
– PRESS MOUSE WHELL to move up/down
– ROTATE MOUSE WHELL to dolly in/out

– RMB to look around
– RMB + WASD to move

– F to frame an object
– Select a Component + ALT + LMB to tumble around selected object
– Select a Component + ALT + RMB to dolly in/out selected object

Component List> RMB> Cut, Copy, Paste, Duplicate, Rename, Add Event (OnComponentHit, OnComponentBeginOverlap etc…)

Graph mode
Here we create all nodes and connects between blocks.

Navigate the window with:
– RMB to drag the view
– ROTATE MOUSE WHELL to zoom in/out
– LMB single click to select single block
– LMB single click + SHIFT to add block to selection
– LMB + DRAG to select multiple blocks

Put your Blueprint assets in scene

Content Browser> DRAG AND DROP items into Editor Viewport

NOTICE: you are not be able to adjust Components of Blueprint inside Editor Viewport, but only inside Class Blueprint Editor

Compile a Class Blueprint

1. Change something in your Blueprint

2. Class Blueprint Editor> TOP LEFT> ‘Compile’ button -> the Editor Window will be updated.

By |Unreal Engine, Video Games Development|Commenti disabilitati su Unreal Engine – Class Blueprint

C++ – Do While Statement

C++ – Do While Statement

Working sample:


// custom countdown using while
#include <iostream>
using namespace std;

int main ()
{
  int n = 10;

  while (n>0) {
    cout << n << ", ";
    --n;
  }

  cout << "liftoff!\n";
}

The result:

10, 9, 8, 7, 6, 5, 4, 3, 2, 1, liftoff!


// echo machine
#include <iostream>
#include <string>
using namespace std;

int main ()
{
  string str;
  do {
    cout << "Enter text: ";
    getline (cin,str);
    cout << "You entered: " << str << '\n';
  } while (str != "goodbye");
}

The result:

Enter text: hello
You entered: hello
Enter text: who’s there?
You entered: who’s there?
Enter text: goodbye
You entered: goodbye
Process returned 0

By |C++, Video Games Development|Commenti disabilitati su C++ – Do While Statement

Unreal Game Engine – Create New Project an New Levels

Unreal Game Engine – Create New Project an New Levels

Create

1. File> New Project
2. New Project Window> Blank
3. Check ‘Include starter content’
4. Name: yournameProject
5. on the right click over the button to expand window and choose a Folder
6. click ‘Create Project’ button

Setup

The project will be opened, after that:

1. MAIN TOP MENU> Edit> Editor Preferences>
– General Appearance> User Interface> check ‘Use Small Tool Bar Icons’
– Loading & Saving > uncheck Autosave

2. MAIN TOP MENU> Edit> Project Settings>
– Game> Supported Platforms
– Engine> Input
– Platforms> iOS / Windows

Viewports

Setup Viewport

1. Window> Viewports> Viewport2
2. DRAG AND DROP the viewport label under TOP Toolbar to create a new stable window in the workarea

Levels

A videogame project can be divided in different levels: Level1, Level2, Level3 etc…

To create new levels: MAIN TOP MENU> File> New Level
To save levels: MAIN TOP MENU> File> Save or Save As… -> Unreal will create the file ‘Level1.umap’ (Unreal Map)

By |Unreal Engine, Video Games Development|Commenti disabilitati su Unreal Game Engine – Create New Project an New Levels

Unreal Engine – Editor Overview

Unreal Engine – Editor Overview

Place New Objects

Window> Modes> Place> Geometry> DRAG AND DROP the game object thumb over the 3D Viewport

OR

Window> Content Browser> DRAG AND DROP the game object thumb over the 3D Viewport

Move/Scale/Rotate/Setup Objects

LMB select the object and use the top right small icons to select transformations tools, after that use the handles on screen

OR

1. Window> Scene Outliner> click over the object list to select
2. Window> Details> setup

Static Mesh Editor

RMB over a mesh> (home icon)Edityourmesh

Parenting objects

RIGHT COLUMN> Scene Outliner> DRAG AND DROP an object over another object, the dragged object will be the child of the second one.

Material Editor

RIGHT COLUMN> Details> Materials> DOUBLE CLICK over material preview

Move Camera View

LMB: rotate camera right left and move forward / backward

MMB: move left / right / up / down

Mouse Whell: zoom in / out

RMB: look at right / left / up / down

RMB + WASD: look and move like a FPS

ALT + LMB: orbit around the selected object

By |Unreal Engine, Video Games Development|Commenti disabilitati su Unreal Engine – Editor Overview