Author Topic: Fighter UI  (Read 4422 times)

         I'm in the middle of making a Fighter for blockland and so far its making good progress, the only thing i'd like to add to make it feel more nifty is if I could have a UI designed for the game to display both of the players that are currently fighting's health. If it were to be hosted it'll only allow up to 8 people to play, so those who are not playing will only spectate, but the two users who are representing player 1 and player 2 will be the ones to select the location/arena and the characters they wanna pick (basically I put together a class like system yet they're actually characters with abilities) the events pretty much handle everything however this script would just be like a final touch to it. I've talked to some people in the BCC discord and some said its possible so but I'm not really experienced with this kind of coding. I can't really confirm myself if it is indeed possible but if so this would really be helpful if someone could take the time to make this for me.

          
I figure it is possible since ZAPT's hud shows more then one users health on the same team.
                                                                             
         
« Last Edit: April 28, 2018, 11:41:32 AM by Gautier00 »

I know this is kinda off topic but making a fighter in blockland is a pretty bad idea. Blockland's netcode can't handle much properly in realtime and since fighting games require such perfect response between client and server it won't end up working good in any way possible unless done over a LAN or single player. Most fighting games that handle online play use a special kind of rollback / predictive input manager that will try to assume each client's next input which will make it so even if someone's lagging their input will be received in time, and if the input predicted is incorrect it will simply rollback to the previous state and apply the new input.

You may think like 'maybe only players with good ping should play' but even 50-60 ms is enough of a delay to mess up input. And, if you ping suddenly jumps, combo moves will definitely forget up entirely as well as each client's interpretation of it


Not only that but you should usually refrain from designing UI and instead opt for center or bottom print text to display information. If you design a UI you have to redistribute it to every client on the server and that becomes pretty painful to manage, especially when updating code

You could essentially do the same thing as a health bar with something like this

|||||||||||||| 60 ||||||||||||||
           --0           ---

its readable for all clients on their machine, it doesn't mess up when you rescale your screen, and its all handled in the server.cs so updating it is incredibly easy and clients have almost no bearing on the process
« Last Edit: April 28, 2018, 02:34:02 PM by thegoodperry »

I know this is kinda off topic but making a fighter in blockland is a pretty bad idea. Blockland's netcode can't handle much properly in realtime and since fighting games require such perfect response between client and server it won't end up working good in any way possible unless done over a LAN or single player. Most fighting games that handle online play use a special kind of rollback / predictive input manager that will try to assume each client's next input which will make it so even if someone's lagging their input will be received in time, and if the input predicted is incorrect it will simply rollback to the previous state and apply the new input.

You may think like 'maybe only players with good ping should play' but even 50-60 ms is enough of a delay to mess up input. And, if you ping suddenly jumps, combo moves will definitely forget up entirely as well as each client's interpretation of it


Not only that but you should usually refrain from designing UI and instead opt for center or bottom print text to display information. If you design a UI you have to redistribute it to every client on the server and that becomes pretty painful to manage, especially when updating code

You could essentially do the same thing as a health bar with something like this

|||||||||||||| 60 ||||||||||||||
           --0           ---

its readable for all clients on their machine, it doesn't mess up when you rescale your screen, and its all handled in the server.cs so updating it is incredibly easy and clients have almost no bearing on the process
This isn't the first time I've done something like this, I've never had any issue at all. Not sure where you got the idea that this being made in blockland would require so much to properly handle. I've done many gamemodes that use the same system im putting together here, not once has anybody had any issues. Nor have I experienced anything, like I said the game is handled entirely with events. The only thing I'd like to add that is cosmetic here is the hud itself. Also just to clarify there isn't any combos or anything like that in this, its just a simple weapon I got called action_melee that is set for the melee attacks, the only thing that makes each character unique is their abilities.
There is nothing to advanced here, everything that is seen when playing is simple stuff that anybody can do on there own server. There's no advanced system, there's an energy mechanic for the abilities which just uses the normal energy system built into blockland, all the abilities are handled with VCE this is nothing new, and everything else just goes through with onactive events to prepare the game which is ran in Slayer. I also ain't adding rounds to the game because honestly I think that would require scripting to do, I again don't really have that kind of experience outside of blocklands events which is what I heavily depend on when making a gamemode. It feels like a fighter but I guess you can say plays out like a deathmatch with just melee only weapons and some abilities, however it plays like a 2D oldschool fighter like street fighter since that's how I put the maps together and how I've added a camera to spectate the players as they fight from a side scrolling perspective.

Also regarding your point about using bottom text for the HUD info I wouldn't mind doing that, I would just need to know how you'd set it up like that.
« Last Edit: April 28, 2018, 02:44:00 PM by Gautier00 »

This isn't the first time I've done something like this, I've never had any issue at all. Not sure where you got the idea that this being made in blockland would require so much to properly handle. I've done many gamemodes that use the same system im putting together here, not once has anybody has any issues. Nor have I experienced anything, like I said the game is handled entirely with events. The only thing I'd like to add that is cosmetic here is the hud itself. Also just to clarify there isn't any combos or anything like that in this, its just a simple weapon I got called action_melee that is set for the melee attacks, the only thing that makes each character unique is their abilities.
ok its your choice in the end. you should still shoot for playability above all else, as long as you have that there's no issue

Also regarding your point about using bottom text for the HUD info I wouldn't mind doing that, I would just need to know how you'd set it up like that.
say you have two player references: player1 and player2

Code: [Select]
function convertPlayerHealthToHealthBar(player)
     dividedHealth = roundUp(player.maxhealth/10)            //dividing it into 10 bars so its easy to fit
     currHealth = roundUp(player.health/10)                       //current player health out of 10
     lostHealth = dividedHealth-currHealth                          //player health thats been lost out of 10
     barString1 = "<color:FF0000>"                                   //part of health bar that shows amount of health
     barString2 = "<color:888888>"                                  //part of health bar that shows lost health
     for (i until currHealth, i++)
           barString1 += "| "
     for (j until lostHealth, j++)
           barString2 += "| "

     return barString1 @ barString2                                  //combines the two bars
end function

the above is pseudo code on in general how it should work. this will display the health bar |||||||||||||| like this. if the player has half health it would be ||||||||||||||||

The above function you want to run on the first player in the fight and the second player of the fight. you need a reference to them somewhere. So maybe if they begin a match, create an object that contains a reference to the two players in the match

Then for each of the players in that match object, bottomPrintClient(player.client,'',convertPlayerHealthToBar(player1) SPC $matchtimeleft SPC convertPlayerHealthToBar(player1));

or something like that

Making a UI at all would require scripting anyways. I didn't actually realize this was the suggestions and request board i thought it was mod discussion lol MB

anyways ill leave that stuff above for anyone who wants to make this

Making a UI at all would require scripting anyways.
Why do you think I requested someone to do it? lol

Why do you think I requested someone to do it? lol
I didn't realize this was suggestions and requests. Anyways if you have someone make it for you, you'll need to communicate what events exactly you're using, because some of the script will need to communicate with the events