• Ever wanted an RSS feed of all your favorite gaming news sites? Go check out our new Gaming Headlines feed! Read more about it here.
  • We have made minor adjustments to how the search bar works on ResetEra. You can read about the changes here.
Status
Not open for further replies.

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
Anyone know any good resources for how to deal with parallax stuff in unity? That mixed with 2D sidescrolling endless runner platform generation. I've watched some videos, just wondering if anyone has any stuff they personally found very helpful.

I had a complex system of layers and partial renders but eventually said "fuck it" and replaced it with a homegrown solution as hacky and duct-taped as literally moving the parallax layers in the same direction of the camera at different speeds (to make them "move slower"). Further away = faster, with the furthest ones moving at nearly the same speed of the camera (and thus appearing to barely move). Each layer is a script that registers itself on another script on the camera, then whenever the camera moves, it lets the parallax layers know how much so that they can update their positions.

The old system was not very flexible and forced me to use Unity layers on it, which are very limited (32, as opposed to the potentially infinite sorting layers). The new solution is far more flexible and lets me add any number of layers at any scrolling speed I want, with no side effects (in case you thought of doing something like this and were wondering if it would affect anything or look bad).

In the case of an endless runner, I'm guessing it would be a matter of moving the leftmost tile to the right end when the player reaches it, and viceversa. Since you're already updating the parallax layers every time the camera moves, this should be relatively easy to do.

Let me know if you want the scripts. :)
 

M-66

Member
Oct 27, 2017
68
Question for characters artists/animators/riggers and also whoever wants to answer:

Here is a method we used a while back.

- The body is divided into zones. In our case it was head, body, arms, pants/legs.
- The rules are, the red edgeloops must be exactly coincident. You can do whatever you want in between but the borders (the red edge loops must match up to all other parts exactly).
- Note that there is still a ring of polygons that extends one row past the red "connection loops". These are marked with a flagged shader that our tool uses to exclude them from the model but uses them to calculate normals. This means that there are no seams between bodyparts because the normals match exactly. Note that the weighting for the edge polygons must be identical as well so they don't tear apart.
- When modeling replacement parts, any polygons that are covered are removed. It makes zero sense to keep "naked" hidden polygons around for a part because they will (a) hurt perf, (b) cause geo crashthrough when deforming, (c) cause zfighting when far away and (d) inevitably end up as part of an unplanned nudemod. Note that you still have the bare model to start with in you 3d program so you are free to go as bulky or as skimpy as you like for each part.

Note that for each new part you model, the skin and clothing are part of the same mesh.

This is just one way of doing it, but for us it was simple, easy to implement and easy to model and had no visible seams or other artifacts.

Edit:
Another reason for removing geo is that a lot of clothing, for both men and women is designed to somewhat shape and control the body. Shirts and belts compress. Pants and bras support. If clothing geo is modeled to flow around a base model without affecting it, the character will look unappealingly puffy.
 
Last edited:

Hampig

Member
Oct 25, 2017
1,704
I had a complex system of layers and partial renders but eventually said "fuck it" and replaced it with a homegrown solution as hacky and duct-taped as literally moving the parallax layers in the same direction of the camera at different speeds (to make them "move slower"). Further away = faster, with the furthest ones moving at nearly the same speed of the camera (and thus appearing to barely move). Each layer is a script that registers itself on another script on the camera, then whenever the camera moves, it lets the parallax layers know how much so that they can update their positions.

The old system was not very flexible and forced me to use Unity layers on it, which are very limited (32, as opposed to the potentially infinite sorting layers). The new solution is far more flexible and lets me add any number of layers at any scrolling speed I want, with no side effects (in case you thought of doing something like this and were wondering if it would affect anything or look bad).

In the case of an endless runner, I'm guessing it would be a matter of moving the leftmost tile to the right end when the player reaches it, and viceversa. Since you're already updating the parallax layers every time the camera moves, this should be relatively easy to do.

Let me know if you want the scripts. :)
Wouldn't be game dev if it wasn't hacky and duct-taped together! I think I get what you're saying so I'l give it a shot on my own. Curious though, is there an end to the unity scene? Can I ever run out of bounds or cause issue if I keep going one direction?
 

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
Wouldn't be game dev if it wasn't hacky and duct-taped together! I think I get what you're saying so I'l give it a shot on my own. Curious though, is there an end to the unity scene? Can I ever run out of bounds or cause issue if I keep going one direction?

Not that I know of, but I don't have an infinite runner. The coordinates are floats, which can hold in the order of billions, but I don't know if Unity is fine with going that high (not that it wouldn't take years of continuous play, probably. :D).

Worst case scenario, you can move literally everything back after some point, which should be instantaneous, but it's quite likely you won't ever need to do that.

My parallax class:

Code:
public class Parallax : SafeBehaviour {

    [Tooltip ("Ratio of the scrolling speed of this layer compared to the camera.")]
    public float parallaxRatio = 1f;

    CameraManager _camera;
    Vector2 _basePosition;
    Vector2 _baseCameraPosition;
   
    override
    protected void Initialize () {
        base.Initialize ();
        _camera = Managers.Camera;
        _camera.EnsureInitialized ();
        _baseCameraPosition = _camera.transform.position;
    }

    private void Start () {
        _basePosition = transform.position;
        _camera.RegisterParallax (this);
    }

    public void UpdateParallax () {
        Vector2 displacement = (Vector2) _camera.transform.position - _baseCameraPosition;
        SetPosition (_basePosition - (displacement * (parallaxRatio -1f)));       
    }
}

Notes:
- For added precision, I calculate the parallax layer's offset from its original position and the camera's original position (rather than just moving according to the latest camera movement, which over time may accumulate errors).
- SafeBehaviour is my custom base class that inherits from MonoBehaviour. Initialize is called only once (typically from Awake).
- _camera is a script on the camera which, for the purposes of this, holds a list of all parallax layers and sends them an UpdateParallax whenever it's moved.
 

Lady Bow

Member
Nov 30, 2017
11,303
Protip: [Header("Insert Text Here")] in Unity is amazing for organization.

Before my inspector was a giant mess of floats and bools but now it's so much easier to look at.

djt66WF.png


Code for reference:

[SerializeField]
public State ForceStateChange, CurrentState;

[Header("Movement")]
[Space(10)]
public float turnSpeed;
public float jumpForce;
public float jumpForwardForce;
public float lowJumpMultiplier;
public float GlideBoostForce;
public float hurtImpulseForce;

[Header("Gravity Properties")]
[Space(10)]
public float gravityScale;
public float fallMultiplier;
public float testgravityScale;

[Header("Speed")]
[Space(10)]
public float vel;
public float propulsionSpeed;
public float MaxSpeed;
public float speedGainMultiplier;
public float speedShift1;
public float speedShift2;
[Space(20)]
public bool SpeedGear1 = true;
public bool SpeedGear2;
public bool SpeedGear3;
public bool SpeedGearBoost;

[Header("Etc")]
 

Hampig

Member
Oct 25, 2017
1,704
Not that I know of, but I don't have an infinite runner. The coordinates are floats, which can hold in the order of billions, but I don't know if Unity is fine with going that high (not that it wouldn't take years of continuous play, probably. :D).

Worst case scenario, you can move literally everything back after some point, which should be instantaneous, but it's quite likely you won't ever need to do that.

My parallax class:
Awesome, thank you! I know what I'm working on this weekend.

Protip: [Header("Insert Text Here")] in Unity is amazing for organization.
That looks so nice, I need to start using this.
 

DaveB

Banned
Oct 25, 2017
4,513
New Hampshire, USA
I don't know if there's any other devs here whose primary workstation is a Mac, but I ran into a really funky bug with SDL and OpenGL on OSX Mojave yesterday. The window wouldn't update unless I pressed a key or moved my mouse cursor.

I actually got in touch with someone on Twitter who works on SDL, but their suggestions (pull the latest code and recompile) didn't fix the problem. It turned out to be that I needed to call SDL_SetWindowSize every frame before starting rendering. Odd, but effective!

Right now I'm in building blocks mode, writing the various utility classes and functions for my engine. This will be the third or fourth time in about three years, but hey, practice makes perfect. Maybe I'll actually get something going this time! :)
 

vestan

#REFANTAZIO SWEEP
Member
Dec 28, 2017
24,640
Haven't posted in a bit but I'm getting closer to release! I've kinda just been slacking off playing Dota but I hope to get the art done by early August and release by the end of it! For now, I've been focusing on reworking art that I did in Dec 2018 as my art skills have improved considerably since then and I wouldn't be happy if I did nothing about 'em.

qtGc3jN.png


ElGiBA9.png
 

Benz On Dubz

Member
Oct 27, 2017
763
Massachusetts
Working out some simple attack anims for Sheep. He'll also have a special ability that needs to be charged up to use:



I've hacked together a simple state machine for his controls. Once I have all the movements worked out, I'll need to build a proper controller to switch between the various states.
 

Radnom

Member
Oct 25, 2017
1,020
I did a 48h gamejam solo and made "Wapple Quest", a game that's meant to evoke a terrible lost proto-PS1 game :D I bought a couple of the PlayStation classic consoles and during the presentation part of the jam I hooked up the USB controllers for an authentic feel. It got second place which I'm pretty happy with!



It started off with the idea of being a lost PS1 game, but I missed the first night of the jam so I couldn't team up with someone who actually had 3D art skills, so I had to pivot the project a bit to still being PS1-ish, but as I wasn't able to make it a 'good' one I instead added a narrative about being a Bubsy 3D-like colossal failure that was buried for nearly 30 years and then restored by the romhacking scene. I tried chucking a bunch of hidden Wapples in the game and give it a sense of exploration that evokes Bob-Bomb Battlefield a little bit, but 100 times uglier and jankier.

It's got local multiplayer modes where it's a race to find a target number of Wapples first.
 

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
I did a 48h gamejam solo and made "Wapple Quest", a game that's meant to evoke a terrible lost proto-PS1 game :D I bought a couple of the PlayStation classic consoles and during the presentation part of the jam I hooked up the USB controllers for an authentic feel. It got second place which I'm pretty happy with!



It started off with the idea of being a lost PS1 game, but I missed the first night of the jam so I couldn't team up with someone who actually had 3D art skills, so I had to pivot the project a bit to still being PS1-ish, but as I wasn't able to make it a 'good' one I instead added a narrative about being a Bubsy 3D-like colossal failure that was buried for nearly 30 years and then restored by the romhacking scene. I tried chucking a bunch of hidden Wapples in the game and give it a sense of exploration that evokes Bob-Bomb Battlefield a little bit, but 100 times uglier and jankier.

It's got local multiplayer modes where it's a race to find a target number of Wapples first.


That's actually super impressive! People capable of making any kind of game in just 48h, let alone a 3D one with actual levels and a multiplayer mode, will never cease to be amazing to me. :O
 

Alic

Member
Oct 25, 2017
59
I did a 48h gamejam solo and made "Wapple Quest", a game that's meant to evoke a terrible lost proto-PS1 game :D I bought a couple of the PlayStation classic consoles and during the presentation part of the jam I hooked up the USB controllers for an authentic feel. It got second place which I'm pretty happy with!



It started off with the idea of being a lost PS1 game, but I missed the first night of the jam so I couldn't team up with someone who actually had 3D art skills, so I had to pivot the project a bit to still being PS1-ish, but as I wasn't able to make it a 'good' one I instead added a narrative about being a Bubsy 3D-like colossal failure that was buried for nearly 30 years and then restored by the romhacking scene. I tried chucking a bunch of hidden Wapples in the game and give it a sense of exploration that evokes Bob-Bomb Battlefield a little bit, but 100 times uglier and jankier.

It's got local multiplayer modes where it's a race to find a target number of Wapples first.


Love that intro :) Congrats on getting second place!
 

Landford

Attempted to circumvent ban with alt account
Banned
Oct 25, 2017
4,678
Anyone here that learned pixel art, how...hard is it? I am prototyping some stuff in GMS2, a farming rpg, but I'm using only free art so far. It will have to get to a point where I'll have to make the pixel art myself and I am dreading it :(
 

Hampig

Member
Oct 25, 2017
1,704
Anyone here that learned pixel art, how...hard is it? I am prototyping some stuff in GMS2, a farming rpg, but I'm using only free art so far. It will have to get to a point where I'll have to make the pixel art myself and I am dreading it :(
It's just like any art, it takes time. There are a lot of great resources out there to help you learn. But know, if you want to make something that looks good, pixelart isn't a shortcut. It takes time and effort.
 

Sean Noonan

Lead Level Designer at Splash Damage
Verified
Oct 26, 2017
384
UK


Probably work on some more Goomba animations next. Won't have time to make a Koopa though :(
 

Radnom

Member
Oct 25, 2017
1,020
Anyone here that learned pixel art, how...hard is it? I am prototyping some stuff in GMS2, a farming rpg, but I'm using only free art so far. It will have to get to a point where I'll have to make the pixel art myself and I am dreading it :(
A good tip is to start small... really small! If you can, try and stick to small sprites (maybe 16x16?) and a low-colour palette (16 or 32 colours) to start with. That'll help keep things consistent. As a beginner you're probably not going to make a game that looks like a SNES game right off the bat, but you might be able to manage a NES game, and that's all good :) Animation gets exponentially more difficult (and time consuming) with bigger sprites. It'll still take practice to make really lovely pixel art but at this point consistency is way more important!
 

Bne

Member
Jan 12, 2018
17
Anyone here that learned pixel art, how...hard is it? I am prototyping some stuff in GMS2, a farming rpg, but I'm using only free art so far. It will have to get to a point where I'll have to make the pixel art myself and I am dreading it :(
Really good advice in the posts above. Allow me to add that good tutorials may save you some time, I recommend this series by MortMort on youtube :
https://www.youtube.com/playlist?list=PLR3Ra9cf8aV06i2jKmgKvcYVHI86-4K_b
 

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
Anyone here that learned pixel art, how...hard is it? I am prototyping some stuff in GMS2, a farming rpg, but I'm using only free art so far. It will have to get to a point where I'll have to make the pixel art myself and I am dreading it :(

The "lowest resolution you can" tip above is gold, it will help you hide your earlier inexperience. Do you know how to draw, like, normally? It's not a requirement but it obviously helps.

Here's a tutorial I particularly love (by Derek Yu of all people!) and frequently come back to:
 

DaveB

Banned
Oct 25, 2017
4,513
New Hampshire, USA
I asked this in the Discord, but figured I would echo it here...

Does anyone here have access to the Nintendo Switch SDK? Is there support for OpenGL and FreeType?

I'm building a codebase that I am hoping to keep as multi-platform friendly as possible.
 
OP
OP
Popstar

Popstar

Member
Oct 25, 2017
878
I asked this in the Discord, but figured I would echo it here...

Does anyone here have access to the Nintendo Switch SDK? Is there support for OpenGL and FreeType?

I'm building a codebase that I am hoping to keep as multi-platform friendly as possible.
I don't have access to the SDK but I've worked with a lot of consoles. FreeType should be fine, it's just a library and the Switch comes with a recent version of LLVM/Clang.
I haven't heard of any OpenGL support for the Switch. (or any console for that matter, other than the really terrible OpenGL ES 1.x on PS3 that no one used)
The Switch does support Vulkan however. So that's probably your best bet right now for a cross-platform rendering API.
 

Landford

Attempted to circumvent ban with alt account
Banned
Oct 25, 2017
4,678
It's just like any art, it takes time. There are a lot of great resources out there to help you learn. But know, if you want to make something that looks good, pixelart isn't a shortcut. It takes time and effort.
A good tip is to start small... really small! If you can, try and stick to small sprites (maybe 16x16?) and a low-colour palette (16 or 32 colours) to start with. That'll help keep things consistent. As a beginner you're probably not going to make a game that looks like a SNES game right off the bat, but you might be able to manage a NES game, and that's all good :) Animation gets exponentially more difficult (and time consuming) with bigger sprites. It'll still take practice to make really lovely pixel art but at this point consistency is way more important!
Really good advice in the posts above. Allow me to add that good tutorials may save you some time, I recommend this series by MortMort on youtube :
https://www.youtube.com/playlist?list=PLR3Ra9cf8aV06i2jKmgKvcYVHI86-4K_b
The "lowest resolution you can" tip above is gold, it will help you hide your earlier inexperience. Do you know how to draw, like, normally? It's not a requirement but it obviously helps.

Here's a tutorial I particularly love (by Derek Yu of all people!) and frequently come back to:

Sorry for taking so long to answer, but wow, thanks a lot for the tips guys. I think the "start really small" is really the best approach to this. Gonna look into all these resources, thanks a lot!
 
May 23, 2019
509
cyberspace
I'm a Unity3D C# beginner, some of You might remember me ;)
I want to create a timer countdown
I found out that to create a timer countdown I need a float timer and Time.deltaTime

Example:

public Text timerTXT;
float time 20.0f;

void Update()
{
DisplayTime();
}

void DisplayTime()
{
time -= Time.deltaTime;
timeTXT.text = "Timer : " + time.toString("F");
}
/////////////////////////////////////////////////////////////////////////////////////
Sorry for this mess :)
Now I wonder if this is the only way to code a timer countdown :/
 
Last edited:

Mike Armbrust

Member
Oct 25, 2017
528
I'm a Unity3D C# beginner, some of You might remember me ;)
I want to create a timer countdown
I found out that to create a timer countdown I need a float timer and Time.deltaTime

Example:

public Text timerTXT;
float time 20.0f;

void Update()
{
DisplayTime();
}

void DisplayTime()
{
time -= Time.deltaTime;
timeTXT.text = "Timer : " + time.toString("F");
}
/////////////////////////////////////////////////////////////////////////////////////
Sorry for this mess :)
Now I wonder if this is the only way to code a timer countdown :/
There are lots of ways to do a timer.

A potentially better way would be to set a specific time for when the timer ends, and then use the current time to figure out the time remaining.


void SetTimer(){
endTime=Time.time+20;
}
void DisplayTime()
{
timeTXT.text = "Timer : " + (endTime- Time.time).toString("F");
}
 
May 23, 2019
509
cyberspace
There are lots of ways to do a timer.

A potentially better way would be to set a specific time for when the timer ends, and then use the current time to figure out the time remaining.


void SetTimer(){
endTime=Time.time+20;
}
void DisplayTime()
{
timeTXT.text = "Timer : " + (endTime- Time.time).toString("F");
}
I will definitively try this one, thanks.

EDIT: This timer increase instead of decreasing lol
 
Last edited:

Mike Armbrust

Member
Oct 25, 2017
528
I will definitively try this one, thanks.

EDIT: This timer increase instead of decreasing lol
It should decrease up till the end time and then become negative, exactly like your original code.

"
void SetTimer(){
endTime=Time.time+20;
}
"

This part sets the end time as 20 seconds from the current moment. It needs to be called once to set the timer.

Here is an example of how it could look in total:

public Text timerTXT;
float endTime;

void Start()
{
SetTimer(20);
}

void Update()
{
DisplayTime();
}

void SetTimer(float timerDuration){
endTime=Time.time+timerDuration;
}

void DisplayTime()
{
timeTXT.text = "Timer : " + (endTime- Time.time).toString("F");
}
 

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
You can also use coroutines, and it's actually much more efficient because a) you're not calling code every frame, and especially b) you're not formatting a string every frame (generating garbage). At its simplest:

C#:
void Start () {
    StartCoroutine (ClockCoroutine ());
}

IEnumerator ClockCoroutine () {
    WaitForSeconds wait = new WaitForSeconds (1f); // Update every second, or use the granularity you want here.
    while (true) {
        timer.text = Time.time.toString (); // Format this however you want, and substract initial time if desired.
        yield return wait;
    }
}

Coroutines are automatically stopped when their object containing them is disabled; this includes destruction or end of scene. They are NOT resumed nor restarted when the object is re-enabled; this can trip you up at first.
 

Devo1989

Member
Nov 9, 2017
40
Playing around with an idea I thought I'd share. Started when I decided to make a clone of Kuru Kuru Kururin (the GBA classic) and figured it would be cool if the bird could jump out his ship. The idea of the game currently is to be a sort of puzzle exploration game trying to navigate the world with your awkwardly shaped ship. You're able to rotate the ship around and jump out to hit switches etc etc.

(tile set and human character art currently grabbed from an awesome free tile set on itch.io and )

3_short.gif

tapping on the rotate button a bunch puts you into a spin.

1.gif

Puzzles would be based around using different heads that are attached to either end of your ship. Gaining more as you explore. Gif above shows switching out your regular head for a grabber tool.

2_short.gif

The ship can also be used to ease platforming like this little wall jump move above.

Playing around with different heads and see what kind of puzzles I can make from it, not too sure where any of this is going but it's a fun time.

Been following this thread for forever and you guys post the most inspiring stuff so I figured I'd join in.
 

chironex

Member
Oct 27, 2017
504
We just got word yesterday that our game This Starry Void has been accepted to show at Pax Melbourne in October. This is super-exciting as so far the only times it's been out in public has been at very small "dev meetup" style events. Any how since it's all going public I'm going to try to post in here from time to time - we are a team of just two, using Monogame, and it's very easy just to get lost in the daily grind of code.

The quick pitch is that This Starry Void is a sci-fi dungeon crawler in the vein of genre classics like Dungeon Master as well as drawing on modern takes, eg. Legends of Grimrock. The player takes control of a single character, a remote-operated drone used for Search and Rescue missions in deep space, and explores a series of vessels in distress which leads ultimately to the discovery of a terrible mystery hidden in our solar system. Focusing on a single character has let us bring in influences from Action RPGs for a smoother flow and faster pace than is usual for this genre.

FI7ZM0k.gif


Ku59PF5.gif


4Hdsa6g.gif
 

chironex

Member
Oct 27, 2017
504
That looks fantastic!

How does the turn order work (if any)? Movement seems to follow that set pace but the actions in that last gif are going a mile a minute.

Thanks, I'm glad you like it! It started out as a true turn-based game of rounds lasting half a second (the same amount of time it takes to move one tile), with turn order determined by an actor's speed attribute. We ended up unlocking that so that now speed defines how many seconds must pass before a creature gets to take an action. Eg. The big guy in the last gif acts less often than the other creatures. Further constraints on acting are cool-down timers, animation speeds and stamina recharge time, so heavy hitting attacks - even performed by an enemy - can mean a longer wait before acting again, and/or between uses of those attacks. The player is a bit special in that you can act whenever you like, within the above-mentioned constraints, so as not to impede the flow of the game. The old half second rounds do still tick away in the background, proc'ing stamina recharge, status effects and so on.
 

Camille_

Member
Oct 26, 2017
224
Angoulême, France
Playing around with an idea I thought I'd share. Started when I decided to make a clone of Kuru Kuru Kururin (the GBA classic) and figured it would be cool if the bird could jump out his ship. The idea of the game currently is to be a sort of puzzle exploration game trying to navigate the world with your awkwardly shaped ship. You're able to rotate the ship around and jump out to hit switches etc etc.

(tile set and human character art currently grabbed from an awesome free tile set on itch.io and )

3_short.gif

tapping on the rotate button a bunch puts you into a spin.

1.gif

Puzzles would be based around using different heads that are attached to either end of your ship. Gaining more as you explore. Gif above shows switching out your regular head for a grabber tool.

2_short.gif

The ship can also be used to ease platforming like this little wall jump move above.

Playing around with different heads and see what kind of puzzles I can make from it, not too sure where any of this is going but it's a fun time.

Been following this thread for forever and you guys post the most inspiring stuff so I figured I'd join in.

As a KuruKuru Kururin lover, I really like the direction you're taking their concepts and I'm looking forward to seeing where this goes!
 

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
Playing around with an idea I thought I'd share. Started when I decided to make a clone of Kuru Kuru Kururin (the GBA classic) and figured it would be cool if the bird could jump out his ship. The idea of the game currently is to be a sort of puzzle exploration game trying to navigate the world with your awkwardly shaped ship. You're able to rotate the ship around and jump out to hit switches etc etc.

(tile set and human character art currently grabbed from an awesome free tile set on itch.io and )

3_short.gif

tapping on the rotate button a bunch puts you into a spin.

1.gif

Puzzles would be based around using different heads that are attached to either end of your ship. Gaining more as you explore. Gif above shows switching out your regular head for a grabber tool.

2_short.gif

The ship can also be used to ease platforming like this little wall jump move above.

Playing around with different heads and see what kind of puzzles I can make from it, not too sure where any of this is going but it's a fun time.

Been following this thread for forever and you guys post the most inspiring stuff so I figured I'd join in.

This looks really cool, really neat idea for a game with a ton of possibilities. Congratulations. :)
 

Dancrane212

Member
Oct 25, 2017
13,962
Thanks, I'm glad you like it! It started out as a true turn-based game of rounds lasting half a second (the same amount of time it takes to move one tile), with turn order determined by an actor's speed attribute. We ended up unlocking that so that now speed defines how many seconds must pass before a creature gets to take an action. Eg. The big guy in the last gif acts less often than the other creatures. Further constraints on acting are cool-down timers, animation speeds and stamina recharge time, so heavy hitting attacks - even performed by an enemy - can mean a longer wait before acting again, and/or between uses of those attacks. The player is a bit special in that you can act whenever you like, within the above-mentioned constraints, so as not to impede the flow of the game. The old half second rounds do still tick away in the background, proc'ing stamina recharge, status effects and so on.

Sounds like a good spin on traditional combat!
 

dannymate

Member
Oct 26, 2017
648
I feel like I'm going to be overshadowed a bit here considering how amazing the stuff all looks above but I feel like writing about stuff so here goes.

I'd recently been working with my dialogue system in INK and noticed that my AI had two minds one for navigating and one for talking. For example they would leave an area before they'd finished talking and continue to talk. To fix this I remembered something I'd learned which was that I could use Scriptable Objects in Unity as a state machine instead of the standard enums. They call it PluggableAI in the videos.

So each State in this PluggableAI is made up of two things: Actions and Transitions. An action is something the ai does such as jumping or walking and you can combine multiple to create fairly complex behaviours. A transition is composed of a decision which is a SO with a condition to check and depending on that check it will navigate itself to a new state (or remain in its state).

I added a couple of things on top of that Initialisers which are called once on transition to the new state and Blockers which can stop any transition from occuring. I also created SubStates for each State to keep things clean so I wouldn't have to create a new State for every "Move_To_X". I was also inspired by the inpsector cusomisation above to make it easy to use and reorganisable and this is what it all looks like:
eom13uw.png

And here's how it all looks in-game (Please forgive all the developer art and writing. I promise I'm professional.):


w24bjSi.gif
 

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
I feel like I'm going to be overshadowed a bit here considering how amazing the stuff all looks above but I feel like writing about stuff so here goes.

I'd recently been working with my dialogue system in INK and noticed that my AI had two minds one for navigating and one for talking. For example they would leave an area before they'd finished talking and continue to talk. To fix this I remembered something I'd learned which was that I could use Scriptable Objects in Unity as a state machine instead of the standard enums. They call it PluggableAI in the videos.

So each State in this PluggableAI is made up of two things: Actions and Transitions. An action is something the ai does such as jumping or walking and you can combine multiple to create fairly complex behaviours. A transition is composed of a decision which is a SO with a condition to check and depending on that check it will navigate itself to a new state (or remain in its state).

I added a couple of things on top of that Initialisers which are called once on transition to the new state and Blockers which can stop any transition from occuring. I also created SubStates for each State to keep things clean so I wouldn't have to create a new State for every "Move_To_X". I was also inspired by the inpsector cusomisation above to make it easy to use and reorganisable and this is what it all looks like:
eom13uw.png

And here's how it all looks in-game (Please forgive all the developer art and writing. I promise I'm professional.):


w24bjSi.gif

Thank you for this, it's very interesting, and frankly I should have gone with this rather than cooking up my own AI solution, which is a very bad habit I have. It ended up pretty similar, with objects holding the particular actions an enemy can take, like attacks, or sequences of other actions.

I didn't even know about the ScriptableObject class, which means I have a ton of prefabs that aren't ever instantiated (not just about AI, but pretty much everywhere) and are only used to store information in conveniently pluggable ways. I'll make a mental note to replace them with ScriptableObjects to clean it up a bit.
 

dannymate

Member
Oct 26, 2017
648
Thank you for this, it's very interesting, and frankly I should have gone with this rather than cooking up my own AI solution, which is a very bad habit I have. It ended up pretty similar, with objects holding the particular actions an enemy can take, like attacks, or sequences of other actions.

I didn't even know about the ScriptableObject class, which means I have a ton of prefabs that aren't ever instantiated (not just about AI, but pretty much everywhere) and are only used to store information in conveniently pluggable ways. I'll make a mental note to replace them with ScriptableObjects to clean it up a bit.

If you're just finding out about SO then this video is a neccessary watch. He even touches on the PluggableAI stuff.
 

Son of Liberty

Production
Verified
Nov 5, 2017
1,261
California
Hello all!
I'm sorry if this is the wrong place to ask, but I'm looking for a bit of guidance.
Within a year I'll be graduating from a local university with a Bachelors in Business Administration, my goal is to become a Producer in the gaming industry.
So for the past year I've been looking at job positions from some of my favorite studios to see what they are looking for in an Associate Producer or similar positions.
Right now, I'm learning programs such as Jira and SCRUM, but is there anything else I should be trying to do in order to make myself more valuable?

Any advice is appreciated!
 
May 23, 2019
509
cyberspace
You can also use coroutines, and it's actually much more efficient because a) you're not calling code every frame, and especially b) you're not formatting a string every frame (generating garbage). At its simplest:

C#:
void Start () {
    StartCoroutine (ClockCoroutine ());
}

IEnumerator ClockCoroutine () {
    WaitForSeconds wait = new WaitForSeconds (1f); // Update every second, or use the granularity you want here.
    while (true) {
        timer.text = Time.time.toString (); // Format this however you want, and substract initial time if desired.
        yield return wait;
    }
}

Coroutines are automatically stopped when their object containing them is disabled; this includes destruction or end of scene. They are NOT resumed nor restarted when the object is re-enabled; this can trip you up at first.

Can I use for loop for countdown timer?
the countdown timer I'm trying to archive is similiar to Super Mario (the classics one).
 
Last edited:

Weltall Zero

Game Developer
Banned
Oct 26, 2017
19,343
Madrid
Can I use for loop for countdown timer?
the countdown timer I'm trying to archive is similiar to Super Mario (the classics one) where If the countdown reaches 0 the player dies and the continues decrease by 1 everytime the player dies when the countdown reaches 0.

Indeed you can, a lot of my use cases for coroutines use 'for' loops.

There's a lot of neat tricks with coroutines:
- While in a coroutine, you can call another coroutine and wait for it to end with "yield return SubCoroutine ();"; alternatively, you can start a coroutine to run in paralel with StartCoroutine like above.
- You can wait for the end of the current frame with "yield return new WaitForEndOfFrame ();" (which means you can update every frame, like Update ()).
- You can wait for non-scaled time with "yield return new WaitForSecondsRealtime (seconds);", (e.g. when the game is paused).
- You can store a coroutine execution in a Coroutine variable, and end it early if needed with StopCoroutine.
- You can also end all coroutines in an object with StopAllCoroutines.
- And of course, coroutines can have parameters like any other function (this is very useful e.g. to specify a time the coroutine should run for, etc.).

When using coroutines it's important to keep in mind that the object calling the coroutine isn't necessarily the object actually holding the coroutine: you can do this by simply calling the StartCoroutine method of the object you want to actually hold the coroutine (i.e. subObject.StartCoroutine (Coroutine ());", rather than just StartCoroutine (Coroutine ());". This is important if either of them can possibly become inactive or even deleted before the coroutine ends, so plan accordingly.
 
May 23, 2019
509
cyberspace
Indeed you can, a lot of my use cases for coroutines use 'for' loops.

There's a lot of neat tricks with coroutines:
- While in a coroutine, you can call another coroutine and wait for it to end with "yield return SubCoroutine ();"; alternatively, you can start a coroutine to run in paralel with StartCoroutine like above.
- You can wait for the end of the current frame with "yield return new WaitForEndOfFrame ();" (which means you can update every frame, like Update ()).
- You can wait for non-scaled time with "yield return new WaitForSecondsRealtime (seconds);", (e.g. when the game is paused).
- You can store a coroutine execution in a Coroutine variable, and end it early if needed with StopCoroutine.
- You can also end all coroutines in an object with StopAllCoroutines.
- And of course, coroutines can have parameters like any other function (this is very useful e.g. to specify a time the coroutine should run for, etc.).

When using coroutines it's important to keep in mind that the object calling the coroutine isn't necessarily the object actually holding the coroutine: you can do this by simply calling the StartCoroutine method of the object you want to actually hold the coroutine (i.e. subObject.StartCoroutine (Coroutine ());", rather than just StartCoroutine (Coroutine ());". This is important if either of them can possibly become inactive or even deleted before the coroutine ends, so plan accordingly.
So, I can use for loops for almost everything? because currently my game doesn't use any kind of loops because I have no idea where to use loops.
 
May 23, 2019
509
cyberspace
Uh, I think I misunderstood you. What exactly do you mean by "using for loops for almost everything"? Can you give me an example?
For example I want to use for loops for my health bar, or for something like managing if a condition has been met to progress to the next stage (if player collected amount of objects then open door).
Honestly I have no idea where to use loops in fact my project doesn't use loops :(
I know what loops are, but I have no idea where to use it.
Hope this is clear :)
 
Status
Not open for further replies.