olistic / warriorjs

🏰 An exciting game of programming and Artificial Intelligence
https://warriorjs.com
MIT License
9.43k stars 490 forks source link

New UI #155

Closed olistic closed 1 year ago

olistic commented 6 years ago

The proposal is to use blessed for a revamped UI. This will probably allow lots of improvements, but the main motivation for the change would be a better play log:

untitled

Requirements

Not for now

Feedback?

jeroenrinzema commented 6 years ago

I have experience with blessed. If you want can I start working on this.

olistic commented 6 years ago

@jeroenrinzema Sure, that'd be awesome! I updated the description so you can have a better idea. Let me know if you still want to do it and I'll mark this as claimed. Thanks!

jeroenrinzema commented 6 years ago

I'll get started with it! Just for clarification do you want to use the current UI layout in epic mode?

jeroenrinzema commented 6 years ago

I have build this so far in a small prototyping env. What do you think?

screen shot 2018-05-25 at 15 52 23

olistic commented 6 years ago

@jeroenrinzema That's beautiful!

I wonder if it would visually separate the elements better if we print a separator row (printSeparator() function) at the end of the fixed section:

~~~~~~~~~~ level 1 ~~~~~~~~~~
♥ 20
♦ 0
╔══════╗
║@    >║
╚══════╝
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~   <-- New separator row
<LOG STARTS HERE>

That way it doesn't seem that the floor map belongs to the first lines in the log if their turn header happens to be hidden, like in your example. What do you think?

jeroenrinzema commented 6 years ago

Looks good! I will implement it.

olistic commented 6 years ago

@jeroenrinzema

Just for clarification do you want to use the current UI layout in epic mode?

No, also the new one. Currently, epic mode prints one level after the other:

screen shot 2018-05-25 at 10 46 25

^ Finishing level 8 and starting level 9 right after it.

Now, with blessed you will create a screen that will fill the entire terminal, right? So when one level ends and the next level starts, where do you print the new level? You could:

a. Abandon the current blessed screen, leaving the contents printed in the terminal and creating a new screen for the new level, which would then result in an output similar to what we currently have (I would prefer this option, but I don't know if it's possible). b. Clear the current blessed elements (level header, status, floor map and log) and re-use them to print the new level. This is what I meant when I said "In epic mode, between level and level, the old play is cleared and the new level takes its place" in the description. c. Other options?

jeroenrinzema commented 6 years ago

@olistic I was thinking about option A this should automatically work since I am constructing the level layout in the Game.js@playLevel(levelNumber) method

olistic commented 6 years ago

@jeroenrinzema Perfect!!!

jeroenrinzema commented 6 years ago

I got a beta version of the new UI that is ready to be tested. I still need to write documentation and tests and clean up the code here and there.

olistic commented 6 years ago

@jeroenrinzema Feel free to open a PR at this point! Just put in the description that is a work in progress