haxball / haxball-issues

115 stars 43 forks source link

Ranking On Map #536

Open meisterrr opened 6 years ago

meisterrr commented 6 years ago

In another room i saw connection in ranking with map, best 3 players nicknames were displayed above the map, how it is possible?

VukBakic commented 6 years ago

magic

dixtel commented 6 years ago

The God put hand on this map.

meisterrr commented 6 years ago

Haha not funny, its normal question, so only normal helping answers please

dixtel commented 6 years ago

This is my room, i make a special list of letters. Every letter include lines witch make this character allowing to render on haxball map. Example:

{"char": "B", "vertexes" : [ { "x" : 0, "y" : 19, "trait" : "string"}, { "x" : 0, "y" : 0, "trait" : "string"}, { "x" : 15, "y" : 0, "trait" : "string"}, { "x" : 15, "y" : 7, "trait" : "string"}, { "x" : 12, "y" : 10, "trait" : "string"}, { "x" : 15, "y" : 13, "trait" : "string"}, { "x" : 15, "y" : 19, "trait" : "string"}, { "x" : 0, "y" : 10, "trait" : "string"} ], "segments": [ { "v0" : 0, "v1" : 1, "trait" : "string", "color" : "aaaaaa" }, { "v0" : 1, "v1" : 2, "trait" : "string", "color" : "aaaaaa" }, { "v0" : 2, "v1" : 3, "trait" : "string", "color" : "aaaaaa" }, { "v0" : 3, "v1" : 4, "trait" : "string", "color" : "aaaaaa" }, { "v0" : 4, "v1" : 5, "trait" : "string", "color" : "aaaaaa" }, { "v0" : 5, "v1" : 6, "trait" : "string", "color" : "aaaaaa" }, { "v0" : 6, "v1" : 0, "trait" : "string", "color" : "aaaaaa" }, { "v0" : 7, "v1" : 4, "trait" : "string", "color" : "aaaaaa" } ], "size" : 15 }

With this i can add every sentence on haxball map. (Not many sentences because haxball have limit of lines)

meisterrr commented 6 years ago

but how is it connected with ranking? is that your room? https://www.haxball.com/play?c=knkH5BSCSHI

meisterrr commented 6 years ago

?

meisterrr commented 6 years ago

help please :+1:

dixtel commented 6 years ago

Just convert map to JSON and push these letters, Then you can convert this json to string and reload map.

VukBakic commented 6 years ago

@dixtel how do you move letters? Don't you have to change X and Y for every vertex and also V0 and V1 for every segment ? You can't just push it in object right?

dixtel commented 6 years ago

Yes I move x,y for every vertex.

VukBakic commented 6 years ago

@dixtel Would you share code?

I made a characters array with object containing constructor which I push into map but it's a lot of work. I belive You came to much better solutions xd

var characters=[ {character: "A", size: 10.5, CharMap: function(trait,width,start,X,Y){ this.vertexes=[ { "x" : X+0, "y" : Y+20, "trait":trait} , { "x" : X+0, "y" : Y+0, "trait":trait}, { "x" : X+width, "y" : Y+0, "trait":trait}, { "x" : X+width, "y" : Y+20, "trait":trait}, { "x" : X+0, "y" : Y+10, "trait":trait}, { "x" : X+width, "y" : Y+10, "trait":trait} ]; this.segments=[ { "v0" : start+0, "v1" : start+1, "trait":trait}, { "v0" : start+1, "v1" : start+2, "trait":trait}, { "v0" : start+2, "v1" : start+3, "trait":trait}, { "v0" : start+4, "v1" : start+5, "trait":trait} ]; } },

VukBakic commented 6 years ago

never mind (https://www.haxball.com/play?c=JFYsJS3DoDI)

thenorthstar commented 3 years ago

@dixtel Would you share code?

I made a characters array with object containing constructor which I push into map but it's a lot of work. I belive You came to much better solutions xd

var characters=[ {character: "A", size: 10.5, CharMap: function(trait,width,start,X,Y){ this.vertexes=[ { "x" : X+0, "y" : Y+20, "trait":trait} , { "x" : X+0, "y" : Y+0, "trait":trait}, { "x" : X+width, "y" : Y+0, "trait":trait}, { "x" : X+width, "y" : Y+20, "trait":trait}, { "x" : X+0, "y" : Y+10, "trait":trait}, { "x" : X+width, "y" : Y+10, "trait":trait} ]; this.segments=[ { "v0" : start+0, "v1" : start+1, "trait":trait}, { "v0" : start+1, "v1" : start+2, "trait":trait}, { "v0" : start+2, "v1" : start+3, "trait":trait}, { "v0" : start+4, "v1" : start+5, "trait":trait} ]; } },

@Wolf72 How about multiple letters in the characters array? Should I create separate functions for each the letters? Also this code will give syntax error due to lack of a ].

@dixtel Could you give some details? For example, on what purpose the variable size is used? And how do I put letters related to each other, after converting players' name into arrays? For example I have a nickname Stradi and want to make bot to push my name as a sequence of letters (S T R A D I) on map but none of codes above help me how to perform this. So with this code I can push only one letter onto the map and can't push no second one. Is that it?

dixtel commented 3 years ago

@thenorthstar If you want I can send you all code on pv.

thenorthstar commented 3 years ago

@thenorthstar If you want I can send you all code on pv.

Really? I'd very pleased if you send. I was dealing on it about 1 years and trying to show the finish times of yellow maps (and their makers) on the pitch and couldn't reach a point after the code shown here. I just had made a thing by using joints (you can look at #1179), which shows the current score on the pitch by using a horrible block of if's and else's but it's not enough for me.

So, here is my discord address: Stradi ♠#1654.

thenorthstar commented 3 years ago

@dixtel

dixtel commented 3 years ago

I cant add you, you send me valid nickname My discord: yebac_peace#8304

Btw: Jesteś z polski?

thenorthstar commented 3 years ago

I cant add you, you send me valid nickname My discord: yebac_peace#8304

Btw: Jesteś z polski?

@dixtel Jestem z Turcji ale trochę wiem Polski. OK. Wyślę ci zaproszenie do znajomych.