• Welcome to Smashboards, the world's largest Super Smash Brothers community! Over 250,000 Smash Bros. fans from around the world have come to discuss these great games in over 19 million posts!

    You are currently viewing our boards as a visitor. Click here to sign up right now and start on your path in the Smash community!

Data Decisive Games Introduction Thread (make sure to check the new forum rules as well!)

Shun Goku Satsu Rake

Oriwa Rake. Kaizo ko ni oriwa naru
Joined
May 8, 2012
Messages
3,897
Yeah I know C#.
Nabe prolly knows more / could help than I do since I am self taught in C#, and last used it between Jan - Apr.
 

Overswarm

is laughing at you
Joined
May 4, 2005
Messages
21,181
Pop quiz, do you understand this:

Code:
using UnityEngine;
using System.Collections;
 
[RequireComponent(typeof(PlayerPhysics))]
public class PlayerController : MonoBehaviour {
   
 
    //Player Handling
    public float gravity = 20;
    public float walkSpeed = 10.0f;
    public float runSpeed = 20.0f;
    public float acceleration = 30.0f;
    public float jumpHeight = 12.0f;
    public float jumpAirTime = 0f;
    public float jumpMaxAirTime = 0.2f;
   
    public float timeOffGround = 0f;
    private float currentSpeed;
    private float targetSpeed;
    private Vector2 amountToMove;
   
    //jumping stuff
    private bool hasJumped = false;
    private bool falling = false;
   
    //sloppy double jump stuff
    private bool djump = true; //This must be set to true or false to enable double jump; set to true on item pickup or the like for ingame toggle.
    public bool djumpused = true; //checks whether or not the jump has been used; set to true to any spawn off the ground
                                  //will not result in the ability to double jump
       
    private PlayerPhysics playerPhysics;
   
    void Start ()
    {
    playerPhysics = GetComponent<PlayerPhysics>();
    }
   
    void Update ()
    {       
        // Reset acceleration upon collision
        if (playerPhysics.movementStopped)
        {
            targetSpeed = 0;
            currentSpeed = 0;
        }
       
       
        //JUMPING and the like starts here
       
        if (playerPhysics.grounded)
        {
            amountToMove.y = 0;
            timeOffGround = 0;
            djumpused = false;
            hasJumped = false;
            falling = false;
           
            //Jump
            if (Input.GetKeyDown(KeyCode.Space)) // If jump is pressed
            {
                jumpAirTime = jumpMaxAirTime; //Start jump
                jumpAirTime -= Time.deltaTime; //Timer decreases
               
            }
       
                   
        if (amountToMove.y == 0 && Input.GetKeyDown (KeyCode.Space) && jumpAirTime > 0) //If you are jumping
        {
            amountToMove.y = jumpHeight; //jumping force!
            //jumpAirTime -= Time.deltaTime; //Timer decreases... useless?
           
        }
       
            else //when you are not jumping, just falling
                {
                   
                    jumpAirTime = 0;
                   
                }
                       
        }
       
        if (Input.GetKeyUp(KeyCode.Space) && hasJumped == false && falling == true) //Jump is released
            {
                jumpAirTime = 0;
                amountToMove.y = 0-gravity * Time.deltaTime;  //this part stop momentum, but also causes gravity to stop...
                hasJumped = true;
            }
               
       
        if (Input.GetKeyDown (KeyCode.Space) && djumpused == false && !playerPhysics.grounded)
            {
                amountToMove.y = jumpHeight;
                djumpused = true;
               
            }
       
        else //gravity takes over at this point
        {
           
            falling = true;
        }
   
       
        //JUMPING END
       
        if (Input.GetKeyDown (KeyCode.J))
        {
            GameObject Bullet = (GameObject)Instantiate(Resources.Load("Bullet"));
           
        }
       
        //Input and Running
        float speed = (Input.GetButton ("Run"))?runSpeed:walkSpeed;
    targetSpeed = Input.GetAxisRaw("Horizontal") * speed;
    currentSpeed = IncrementTowards(currentSpeed, targetSpeed,acceleration);
   
   
       
        amountToMove.x = currentSpeed;
        amountToMove.y -= gravity * Time.deltaTime;  //this makes you go down! :D
        playerPhysics.Move(amountToMove*Time.deltaTime);
       
    }
           
    // Increase n towards target by speed
    private float IncrementTowards(float n, float target, float a)
    {
        if (n == target)
        {
            return n;
        }
        else
        {
            float dir = Mathf.Sign (target - n); //must n be increased or decreainsed to get closer to target
            n += a * Time.deltaTime * dir;
            return (dir == Mathf.Sign (target-n))? n: target; //if n has increased over target then return target, otherwise return n. The ? n: is a shorthand if statement.
           
   
        }
    }
 
}
 

Overswarm

is laughing at you
Joined
May 4, 2005
Messages
21,181
If you did:

https://dl.dropboxusercontent.com/u/20676635/alpha1/alpha1.html

There are many problems with it still but I'm slowly developing a 2D engine of sorts. Space is jump, WASD for movement. There are a few other keys that aren't meant to be used yet but do semi-broken things as placeholders.

That's an alpha stage to practice mobility and make sure it works as intended. Orange is the spot you're supposed to get to, Red is the spot you shouldn't be able to get to but can due to how the raycasts are coded (hint!); with some experimenting you should be able to get to the red place.

I'm having trouble getting variable height jumping to work (there's a slight hover due to how I hacked it together so far).
 

Overswarm

is laughing at you
Joined
May 4, 2005
Messages
21,181
I'm trying to set up an engine of sorts using Unity, preparing for Unity 4.3. The 4.3 update will have some 2D functionality that will be pretty awesome. My ultimate goal will be to make a megaman style platformer, very bare-bones at first at least and move on from there.
 

Shun Goku Satsu Rake

Oriwa Rake. Kaizo ko ni oriwa naru
Joined
May 8, 2012
Messages
3,897
I'm having trouble getting variable height jumping to work (there's a slight hover due to how I hacked it together so far).
You want them to be able to jump / double jump while falling yeah ?

Also, did notice slight hover on mashing spacebar, not problematic.
 

Overswarm

is laughing at you
Joined
May 4, 2005
Messages
21,181
Due to this:
Code:
if (Input.GetKeyUp(KeyCode.Space) && hasJumped == false && falling == true) //Jump is released
            {
                jumpAirTime = 0;
                amountToMove.y = 0-gravity * Time.deltaTime;  //this part stop momentum, but also causes gravity to stop...
                hasJumped = true;
            }
The amountToMove.y = 0-gravity means that you're changing your momentum when you let go of the spacebar. I just need to figure out a way to cleanly make this not occur when you are falling, but I can't do that without being able to set falling (as in already reached your apex) as a variable, so I dunno.
 

#HBC | Nabe

Beneath it all, he had H-cups all along
Joined
Oct 21, 2010
Messages
3,932
Location
Can't breathe, but the view is equal to the taste
I'm about to go to bed, haven't looked at the code yet, my eyes disagree with that idea in principle. But if you reach the apex of a jump, the character's velocity in the vertical should be 0, in physics, yeah? So there's the indication of falling (0 velocity should also occur when the character is on a surface, so remember to check for that as well) which just needs to be translated into however your codebase interprets that.

there go my eyes nightnight
p.s. ain't social
 

Shun Goku Satsu Rake

Oriwa Rake. Kaizo ko ni oriwa naru
Joined
May 8, 2012
Messages
3,897
For OS:

What you could do is:

if the person has pressed the spacebar, they've instantiated your jump and hence change of momentum, so you call/ go to the jumping logic.

if the person hasn't pressed the spacebar, you could check their position relative to where they just were, if they've moved downwards at all , they've entered the criteria of "declining". Once the person has entered their decline, you check if at any point they click the space bar, if they do you jump out into your "jumping logic". Otherwise, you set a variable, lets say declineRate. declineRate will represent the amount of space they decline over x seconds(their falling rate of momentum in a sense) until they hit the next patch of terrain under/beside them/above them, or until they haven't moved upward/ to a equal position as they were previously in for x seconds (maybe something like 1 s). Would set your jumpHeight to 0, and your amount to move would be amountToMove.y = declineRate * Time.deltaTime; // your falling force if they have moved downward.

And declineRate can essentially just be some fixed float value you assign essentially.

That way, you don't need to worry about setting your falling variable until they've falling off your environment, or fallen for a amount of time greater than what they should have, or they've used both jumps.

Once they've used both jumps, you would just use the declineRate formula again to put them in a state of decline, if they aren't in the same position as they just were in terms of height, unless they gone higher. Same goes for if they've fallen over and extended period or chose not jump the second time.

leave your falling variable for when they've entered a free fall / death fall ?

Maybe in retrospect you could have a "Jumping" function (which has your jump released logic), and a "Falling" function, that way you could just call the falling function and return some significant variable to avoid needless clutter.

Probably could call the "Falling " function, with the player's current position, and inside the function you re-check that position, if it's changed downward, you go into your decline logic, if they've pressed the spacebar, you call your "Jumping Function" with their new position(this way if they don't jump again, it'll recall your falling function logic), once they've completed their two jumps, if they start to move downwards again, they've missed their higher / regular target and you go into the decline logic until they stop declining or "die" / fall off. Otherwise they aren't falling and you don't care and can move along.

Rinse repeat.

Dunno if that makes any sense, so feel free to ignore me, but logically this seems workable to me.



And then ninja.

Splash velocity in there too.
 

BSL

B-B-B-BLAMM!!!
Joined
Feb 28, 2010
Messages
6,453
Location
Baton Rouge
NNID
bsl883
3DS FC
3308-4560-2744
Was going to make suggestions but I don't feel like reading rakes and I don't want to repeat. I know nothing of the language I was just going to help with logic.
 

Overswarm

is laughing at you
Joined
May 4, 2005
Messages
21,181
declineRate will represent the amount of space they decline over x seconds(their falling rate of momentum in a sense) until they hit the next patch of terrain under/beside them/above them, or until they haven't moved upward/ to a equal position as they were previously in for x seconds (maybe something like 1 s). Would set your jumpHeight to 0, and your amount to move would be amountToMove.y = declineRate * Time.deltaTime; // your falling force if they have moved downward.


Yeah, I just don't know how to accurately really check current velocity on the y axis without making it too hackey. I could figure it out by typing a bunch of **** into the code but it'd be ugly and I'm taking this slow.

Maybe in retrospect you could have a "Jumping" function (which has your jump released logic), and a "Falling" function, that way you could just call the falling function and return some significant variable to avoid needless clutter.


That is my current attempt, I just don't know how to properly identify the "Falling" function. I guess velocity == 0 && grounded == false, I'll have to tinker.


But seriously, if either of you guys want to make a video game send me a PM and I'll send you a GDD with the concept package. I'm going to be putting together a team in the coming months and funding the entire process myself then splitting any future profits amongst the team. I unfortunately only have $10k budgeted to spend on the project over a 2-3 year period so I can't even begin to afford to hire a fulltime team.
 

ranmaru

Smash Legend
Joined
Feb 10, 2008
Messages
13,297
Switch FC
SW-0654 7794 0698
os if you teach me how I'll help :D

I think I can only minor in computer science but MIGHT try double majoring in it
 

Shun Goku Satsu Rake

Oriwa Rake. Kaizo ko ni oriwa naru
Joined
May 8, 2012
Messages
3,897
Yeah, I just don't know how to accurately really check current velocity on the y axis without making it too hackey. I could figure it out by typing a bunch of **** into the code but it'd be ugly and I'm taking this slow.



That is my current attempt, I just don't know how to properly identify the "Falling" function. I guess velocity == 0 && grounded == false, I'll have to tinker.


But seriously, if either of you guys want to make a video game send me a PM and I'll send you a GDD with the concept package. I'm going to be putting together a team in the coming months and funding the entire process myself then splitting any future profits amongst the team. I unfortunately only have $10k budgeted to spend on the project over a 2-3 year period so I can't even begin to afford to hire a fulltime team.

Quoting this for me to remember to address later after I get through this Asymmetric Algorithm nonsense.

Quick hitter on falling function :

velocity == 0 && grounded == false && jumpAirTime == 0 && hasJumped == true // the jumpairtime being 0 should mean they've reached the maximum possible amount of distance over the time without reaching a higher equivalent plane ?

^ That should cover you if the person has jumped while falling already. I think.

I'll try to figureout what it'd be if they haven't jumped during their fall yet / get that more sound logically.

would probably be something like: velocity == 0 && grounded == false && jumpAirTime == 0 && hasJumped == false
OR
velocity == 0 && grounded == false && jumpAirTime > 0 && hasJumped == false



Not quite sure jump air time would work with it yet because I'm not devoting my brain to it atm.
 

Overswarm

is laughing at you
Joined
May 4, 2005
Messages
21,181
I fixed the jumping hover thing; I set it to check for !grounded and vertical velocity <5. This allowed for both variable jump height and no hover.

I've also implemented shooting with a 3 bullet pool.

:D
 

Wots All This Then?

Smash Lord
Joined
Oct 7, 2012
Messages
1,898
Location
Psycho Mountain Island
Sign-ups for Fire Emblem: Awakening mafia are go!​
Quick pitch: set-up is pretty unconventional, has elements of BIM in addition to several other things. It's a closed set-up, but the game isn't really going to be about traditional power roles as much as it will be about the mechanics, and the mechanics will be made known to everyone before the game begins (in fact, I may edit this post to include as brief of a summary as I can give in the near future).​
With all of that said, the game isn't going to be super complex a'la anything Nabe does Koopa vs. Kefka nor super reliant on story flavor a'la Golden Sun mafia. It's basically just a BIM game with some (hopefully fun and interesting) twists.​
for swiss
 

ranmaru

Smash Legend
Joined
Feb 10, 2008
Messages
13,297
Switch FC
SW-0654 7794 0698
Does someone want to hydra for a game? I don't care which one

Maybe, depends on the timing and if my previous invitations are not filled (the "hey lets hydra") I kinda try to give those others a chance before just going.

But interested in how our hydra turns out.

Now that I think of it, my activity can help you play the game slowly, and getting more of a different view than me, as sometimes you take a while to catch up and your early reads are like WAT THIS ALREADY HAPPENED but you shape up later game.
 

Circus

Rhymes with Jerkus
BRoomer
Joined
Jul 9, 2007
Messages
5,164
Our in-bot seems to be on the fritz, but by my count, Awakening is half full. Playerlist looks like this so far:

1. Kary
2. Raziek
3. Red Ryu
4. dabuz
5. Ryker
6. Potassium
7.
8.
9.
10.
11.
12.

Grab your spots while they're lukewarm! It's our Summer Liquidation Sale; everything MUST GO!
 
Top Bottom