News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

Chat window renovation

Started by Ranran, May 04, 2024, 09:50:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ranran

Although Simutrans can play online, the chat window is left behind in the times.
IMO, as the font improved, it became more obvious to me. Then I could clearly imagine what the chat window should look like.
I coded a new chat window UI mockup with extended that happened to me. Testing shows that it's mostly working.
It's still a work in progress, but this should give you an idea of what I want to implement. It will tell you more than text information.


There is no difference between standard and extended chat features, and I think both should move forward equally.
I hope reviewing the chat system once the fonts have been improved.
I am posting a topic regarding this in the hope that your opinions, advice, and help will lead to a welcome update of simutrans.

introduction:
I noticed that nwc_chat_t has a destination for direct chat, but it is not used.
plainstring destination;        // Client to send message to (NULL for all)

I looked into this in hopes of improving the chat system with a little effort. It turns out that it was Timothy (Ashley) who left behind that code. That was 12 years ago, and it looks like he's already gone.
And I ended up on these threads. In conclusion, it remains unfinished.

Why Simutrans sucks
https://forum.simutrans.com/index.php/topic,8452.0.html

Chat and command window concept
https://forum.simutrans.com/index.php?topic=9379.0

[req] Seperate Chat and Messages windows
https://forum.simutrans.com/index.php/topic,16537.0.html

Those threads are old but had some interesting discussion.
And several years ago, I also posted about issues with the existing chat system and suggestions for improvement.
https://forum.simutrans.com/index.php/topic,19850.msg186841.html#msg186841


I would like to work on improving these.
The most important challenge, and the goal of this project, is to make sure we don't have to do the rediculous thing of using markers as a substitute for what we should be doing in chat.
Once freddy asked me to join discord for communication about Bridgewater-Brunel. I think he was just suggesting discord as an alternative because in-game chat is useless.

I came to the conclusion that it would be impossible to create my ideal chat system using what Ashley tried to implement.
In other words, I don't have enough members for message_t and I don't think it's a good idea to share it in a system message (such as that the station is crowded or that the convoy is stuck.).
For example, it doesn't have Earth time information, and tracking player color and player name changes is a pain.
Call logs require both sender and receiver data. What he tried to create was a whisper, similar to the logs of old MMOs. However, in modern times, our ideal is dialogue between individuals. Do not mix up call lines.


So in my opinion chat logs should be independent from system messages.
Quote from: benjad on December 29, 2016, 03:52:37 PMI would propose that chat is broken out into a new dialog box.
That opinion has been seen before.


My thoughts on an existing chat window:
Standard now supports Android (but extended not). Messages with one row are very difficult to read. Also, reading messages from bottom to top is bad design if there are line breaks. That's why modern chat UIs are typically read from top to bottom.

Quote from: benjad on December 29, 2016, 03:52:37 PMPossibly with future improvement of UTC timestamp of when a message was sent
Quote from: Ranran(retired) on May 12, 2020, 08:09:33 PMServer time is more convenient than in-game date. Both displays are more convenient.
I would like to know briefly "how many minutes and how many days ago did you write that message?"

... Anyway, let me list the changes I made to the new chat window that I thought needed improvement.


Planned specifications (already coded/implemented):
- Display the number of player currently online on the chat dialog
- Display local time separately from game time
- Show how long it has been since message was posted. (this will be updated automatically)
- Modern chat system layout,
(1) logs are old at the top and new at the bottom. In other words, it's the opposite of what it was before.
(2) Make your posts more clear (your own balloons appear from the right, and other people's balloons appear from the left). Your name won't appear on your posts.
(3) For consecutive posts, the display of the name will be omitted for the second and subsequent posts.
- Have multiple chat channels depending on the purpose. public/same company/direct message (to individual player)


- Intuitive operation of clicking on a balloon and copying it to the clipboard
- You can enter direct chat mode by clicking the arrow button to the left of the poster's name.

- Changed SYSCOL_TEXT to the basic text color of chat for readability. In the past, yellow and yellow-green companies were notorious for being difficult to read.
The player color is used as a background color mixed with white(dark gray for dark themes).
- Select whether to embed the current coordinates using the button to the left of the chat input. Coordinate jump is changed to coordinate button
- pakset recommends updating icons and menuconf.tab. Supports new icons and shortcut keys.
DIALOG_CHAT is added to number 36. Changed so that SPACE can be set in menuconf.
Another probably common candidate for the chat window startup key is enter, but should this also be configurable in menuconf?
Reference example:
dialog_tool[36]=30,SPACE(30 is the image number of the icon)
You can also access the chat window from an existing message window.

- Chat messages from pre-124.1 save data will be converted to the new chat format when reading the save and removed from the old message log.
(Since it is necessary to distinguish it from existing saves, the new save version is tentatively set to 124.1)
Old data does not have a record of Earth time, so Earth time and time elapsed since posting are not displayed.

- You can display help text by preparing helptext (chat.txt) for chat window.
- You can start a direct chat by selecting a player in the chat log using the combo box.


These network game system message will also be moved to the chat window.
It might be better to combine "Now X clients connected." into one line.
-----------------
TODO:
- When the name is changed, rewrite the name of the past messages
- Disable chat window functionality (shortcut keys and access buttons) in non-network mode
- Fix scrollbar. Since simutrans assumes that the list is ordered from the top, it also assumes that the chat will start from the top as well.
However, many modern chat systems have the latest posts below and are the exact opposite of the simutrans system.
So Simutrans will display the top one by default. That's the oldest statement. Therefore, I tried adjusting it using set_scrollbar_y, but it doesn't seem to work. Already bug reported.
- You can copy the dialogue by clicking on the balloon, but the ideal action is to press and hold for about 1 second instead of clicking. But I don't know if that can be achieved.
- Comment deletion function by administrator
- Ability to delete own posts.  However, a trace of "(deleted)" remains. (Can we link individuals correctly? Isn't it possible to deceive others?)
- Dealing with direct chat for non-existent clients
- Direct chat feature still doesn't work properly


Things to consider implementing:
- Make it easier to recognize notifications from administrators.
Quote from: benjad on December 29, 2016, 03:52:37 PMindicator of unread messages for players
- Is it possible to distinguish between unread and read? I have no idea how to implement it.
- We need to think a little more about the design when making the background transparent. The name may be difficult to read.
- It would be useful to have access to a list of who is currently online.
- It would be convenient if a notification such as an icon would be displayed when a direct chat occurs while the chant window is closed. For example, display a message icon on the toolbar. DONE
- It would also be a good idea to play a sound. It would be nice to have a sound specifically for message notifications. DONE

I'm having a hard time trying to avoid crashes due to focus issues when refreshing chats or switching tabs.

Is it possible to continue to correctly link clients to specific individuals? IP addresses change frequently. Multiple client names cannot exist at the same time, but what happens if you change env_t:nickname offline and reconnect?

It would be useful to be able to embed links to specific convoys, stations, or objects. But I have no idea how to implement it stably. Especially moving objects such as convoys. Low priority.

Existing aligned containers have incorrect sizes and positions for invisible components. It leaves the position of the scrollbar and the correct size of the scroll panel ambiguous during initialization. Therefore, layout errors may occur.

In older threads talk about command input like in old MMO chat systems, but I don't think that's a common idea anymore in modern time chat window.

When porting to standard, you need to port the NO_SPACING macro and display_filled_roundbox_clip.

I would appreciate it if you could help me. Thanks in advance.
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

prissi

#1
Individual chat is a problem on Android (in principle) as it would require Simutrans to verify that a player is over 12 (in Germany) or 13 (in Japan) years old (and other limits in other countries). We could ignore this of course, the chances of being discovered are slim.

As said, I like the appearance. The other points sound like they need more work on the codebase and message distribution system. But I think this is very worthwhile.

Quote- Is it possible to distinguish between unread and read? I have no idea how to implement it.
- We need to think a little more about the design when making the background transparent. The name may be difficult to read.
- It would be useful to have access to a list of who is currently online.
- It would be convenient if a notification such as an icon would be displayed when a direct chat occurs while the chant window is closed. For example, display a message icon on the toolbar.
- It would also be a good idea to play a sound. It would be nice to have a sound specifically for message notifications.

Read would require to have a feedback message. Because in principle, there is the ticker below (in default setting) so it should been read if in front of the screen ...
For a list of who is online, one would need a new server message. Seems possible. But there is of course the problem that nicks and companies are not the same.
Message icon is certainly doable. Like the server icon on in simwin.cc
Same, message sound is easy. As messages would arrive not in sync_step. one could schedule the sound on arrival.

QuoteI'm having a hard time trying to avoid crashes due to focus issues when refreshing chats or switching tabs.
The tabs should be independent so switching should not do anything just adding more or less chat elements. (gui_chatbubble_t containers.) I would update the content with each container individually like the convoi lists in ::draw. (Check the last message, and if different, fill the lists.) That should not lead crashes.

But without seeing the code, I cannot comment on details ;)

Ranran

#2
Quote from: Ranran(retired) on May 04, 2024, 09:50:02 AMThese network game system message will also be moved to the chat window.
It might be better to combine "Now X clients connected." into one line.
Since we can check the current number of players online in the chat window, I have changed this log to only be displayed on the ticker instead of being recorded in the chat log.
Also changed so that system messages are not saved in saves.


Quote from: prissi on May 04, 2024, 12:37:20 PMBut without seeing the code, I cannot comment on details ;)
https://github.com/Ranran-the-JuicyPork/simutrans-ex-fix/commit/6430ab41573e9df3b161a59d52ba3870b7d6befb
Here's the code I'm working on.
I've made some fixes since last night.


The basic operation is to create a copy of the existing message_t and display it in a new UI, so there shouldn't be any major problems.
I think porting the functionality is complete if just isolate the existing functionality.
I think most of the work is done as far as just separating out existing functionality.



Additional features will need to be implemented in the future. I think the most important feature is the direct chat function.

The chat window can currently be accessed offline. However, the chat function cannot be used.
I'm not sure if I should restrict access to the chat window when offline, since I can see the logs when disconnected from the server.


the extended-specific functions needed to draw the chat balloon can be incorporated with this patch.
https://github.com/Ranran-the-JuicyPork/simutrans/commit/4322910c36e0abde19a3e6e9797f8f1d4a98da8c.patch


Quote from: prissi on May 04, 2024, 12:37:20 PMThe other points sound like they need more work on the codebase and message distribution system. But I think this is very worthwhile.
The newly added features are a bit difficult, so I think it need confirmation and help.
Unfinished features are in the TODO of the first post.
In any case, there is no doubt that I will need a lot of help to complete this. Thanks in advance.

Direct chat, this may have privacy issues as it sends data to all clients and saves it.
However, you must also leave it to yourself that you sent it. Otherwise, it would be difficult to continue chatting between individuals.
And if the server doesn't hold it, you won't be able to chat with offline individuals.

Simutrans is basically based on the top of the scroll panel, but new chat windows are based on the bottom, so this needs to be addressed.

I have attached a sample of the menu button icon for access the chat window. This is not a notification, but a regular menu button.



I think it might be possible to add the ability to pin to the top by using message flag.
This is useful for leaving important messages by administrators.
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

jamespetts

This is looking good! I have not tested the code, and I comment based on the text and screenshots. The chat functionality is definitely worth updating as it is currently very difficult to use.

One or two small points: it might be helpful to give timestamps not just for the real time, but also the in-game time when a message was posted, as that might be helpful for players to contextualise chat. A nice shortcut key (e.g. the spacebar) is good for bringing up the chat window - but if we have that, we equally need an easy shortcut key for closing the chat window. We could use escape, but that would close all windows, and that may not be what a player wants to do, as a player might want to respond quickly to a message and then close the chat window without having to locate its close button with a mouse while carrying on with other tasks.

Finally, where a company has changed names, it would be helpful to display the company's old name next to the chat message where the message was sent when the company still had that old name. This is likely to be harder (and also less important) for client name changes.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

#4
@jamespetts
Retaining old company names seems hard and unneeded as after remaining all traces of those are gone.

@Ranran(retired)
What is the motivation for not having the chat window as a tab of the old message window?

Furthermore, also the old message window should (but this logic) add entries at the bottom. Maybe one should have an inverse option for the scrolled list (or an inverted scrolled list as derived type).

The add message tool is also used by scripts I think.

(And it would be easier to maintain cross compatibility of Extended would run once the directory sorting script reorganise-code-r10444.sh  ... )

jamespetts

Quote from: prissi on May 06, 2024, 06:59:30 AM@jamespetts
Retaining old company names seems hard and unneeded as after remaining all traces of those are gone.

The reason for this is that it is helpful for people to remember what former company names were so that (1) they can relate current companies to previous companies to make more sense of what is happening now; and (2) to increase the sense of immersion.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ranran

Quote from: prissi on May 06, 2024, 06:59:30 AMWhat is the motivation for not having the chat window as a tab of the old message window?
For ease of usability, I thought it would be good to be able to start chatting directly in the chat window using shortcut keys such as space and enter, which are common in MOs and MMOs.
(However, in the current implementation, the function to focus input does not work properly. Perhaps another component will take the focus.)

By having a dedicated window it also has a dedicated menu icon that opens the chat window.
I thought that by doing so, I could display the number of unread messages on that icon and notify you of the number of unread messages.
OTRP displays the current road overwriting mode as alphabetic letters on the icon, so I believe such an operation is possible.

Secondly, I thought the log would be in the opposite direction to the existing message log, so it would be better to have it separate due to confusion.

The optimal dialog size is probably different for each. Also, when playing on a large screen, there is an option to display the chat window in the bottom left and place the system message log in the top left.
Some MMOs allow player to separate tabs into separate windows, but simutrans's one does not have such a function.


Quote(And it would be easier to maintain cross compatibility of Extended would run once the directory sorting script reorganise-code-r10444.sh  ... )
I believe there are important things that need to be done before this can be done.
Extended might have stayed put if it weren't for some great patches like the original font improvements.

We need to fix the broken overtake function and make the broken multi-tile city building function the same code as standard, but they all involve commits before the folder structure change. and
Since there is no one who is familiar with these codes, the work will not proceed.

@James
An additional text field is required to record the company name when loging. The current spec records player_nr and retrieves the current player company name from there. This is also used for player colors.
If Standard doesn't require it and Extended does, I suppose it can be done by adding additional text recording area.


------
EDIT:
Extended may need to deal with this as companies may go bankrupt or be acquired and past player numbers no longer exist.
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

prissi

#7
By the way, about hindig the dedicated menu icon: Only show it if
networkmode || chat_messages number>0
That way, it will be even accessible after losing server connection.

Companies go bankrupt in standard too. But one could display (defunct company).

(On the reorganisation script, it was written in such a way that it kept the file history. (For git, one would have just to change "svn rename" to its git equivalent.) It could be run on each branch/fork too, keeping everything in sync. That is why it was made a script, so extended could follow. {sadly it did not then.})

EDIT:
what is SYSCOL_TEXT_TWEAK?

I could get it to compile after a lot of changes but testing with old servergames just displays rubbish; so I think I made some mistakes. I think the balloon function does not do what it should. It looks quite hackish anyway, I think it should rather come from gui_flowtext, so it have breaks automatically. At least I have a more or less similar starting point.

Ranran

#8
Quote from: prissi on May 07, 2024, 01:05:07 AMCompanies go bankrupt in standard too. But one could display (defunct company).
It is also necessary to consider that another company will be established in that slot after bankruptcy.
In Extended, there is a takeover of the company, so such situations are likely to occur.


Quote from: prissi on May 07, 2024, 01:05:07 AMwhat is SYSCOL_TEXT_TWEAK?
I had forgotten about SYSCOL_TEXT_WEAK.
Since simutrans doesn't have bold or small fonts, I set it as a theme parameter a few years ago to make the text less noticeable on the UI.
For example, SYSCOL_TEXT is set to black while SYSCOL_TEXT_WEAK is set to gray.
Ideally, I would like to use a slightly smaller font for the elapsed time label, but that is currently not possible, so I used that.
(Hajo seems to have plans to make the font size variable.)
It's true that SYSCOL_TEXT_WEAK is an extended-specific feature that doesn't exist in standard, and I knew that, but I overlooked it.

Quote from: prissi on May 07, 2024, 01:05:07 AMso I think I made some mistakes. I think the balloon function does not do what it should. It looks quite hackish anyway
In the first code, the chat balloon tale drawing class inherits gui_colorbox_t, but it turns out that there is a big difference between standard and extended.
I think this is the cause of the abnormality in the drawing of Balloon Tale. Therefore, balloon tale has been changed so that it does not inherit gui_colorbox_t. In the end, it was much simpler.
class gui_baloon_tale_t : public gui_component_t
{
PIXVAL color;

scr_coord_val width;

bool right_aligned;

public:
gui_baloon_tale_t(PIXVAL c, bool right_aligned_=false, scr_coord_val width_ = LINEASCENT*2/3)
{
color = c;
width = width_;
right_aligned = right_aligned_;
set_size(scr_size(width, width+1));
}

void draw(scr_coord offset) OVERRIDE;

scr_size get_min_size() const OVERRIDE
{
return scr_size(width, width+1);
}

scr_size get_max_size() const OVERRIDE { return get_min_size(); }
};

void gui_baloon_tale_t::draw(scr_coord offset)
{
offset += pos;
for (scr_coord_val x = 0; x < width; x++) {
if (right_aligned) {
display_vline_wh_clip_rgb(offset.x + x, offset.y + x, width-x+1, color, true);
}
else {
display_vline_wh_clip_rgb(offset.x + x, offset.y, x + 1, color, true);
}
}
if (right_aligned) {
display_fillbox_wh_clip_rgb(offset.x, offset.y+width, width, 1, display_blend_colors(color, SYSCOL_SHADOW, 75), true);
}
}


Quote from: prissi on May 07, 2024, 01:05:07 AMtesting with old servergames just displays rubbish
Conversion from older saves appears to be working but may require serious testing.


Quote from: prissi on May 07, 2024, 01:05:07 AMIt looks quite hackish anyway, I think it should rather come from gui_flowtext, so it have breaks automatically.
It looks like this in GUI debug mode.

Messages use flowtext and are automatically line-wrapped.
Chat balloons are displayed under an aligned container with flowtext and label.
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

prissi

Thanks, I think the different colorboxes were to blame together with the broken text, I saw only a single line.

Ranran

Oh, I noticed that "balloon" was misspelled. please fix it  :-[
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

jamespetts

Quote from: prissi on May 07, 2024, 01:05:07 AMBy the way, about hindig the dedicated menu icon: Only show it if
networkmode || chat_messages number>0
That way, it will be even accessible after losing server connection.
...
This is a very good idea.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Ranran

pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

Isaac Eiland-Hall

QuoteSYSCOL_TEXT_TWEAK

QuoteSYSCOL_TEXT_WEAK

QuoteSYSCOL_TEXT_WEK

It keeps getting shorter! If we keep discussing this, it will disappear entirely in a few more replies. ;-)

Yona-TYT

Quote from: Isaac Eiland-Hall on May 08, 2024, 01:18:40 AMIt keeps getting shorter! If we keep discussing this, it will disappear entirely in a few more replies. ;-)



wow, you see it all!.   ;D

prissi

#15
On each update there seems an entire recalculation of the whole list which will make long chats slow down the GUI a lot.

Also, the first update seems not to display all, despite this. One has to scroll down the entire list. Somehow the min height calculation seems not to work.

I wonder if it would not make more sense to have the title and the messages as separate items. One item the title of the play, then one or more text balloons?

Anyway, a somewhat working standard is here: https://github.com/prissi/simutrans/tree/chat-window

Ranran

#16
Quote from: prissi on May 08, 2024, 02:53:54 AMOn each update there seems an entire recalculation of the whole list which will make long chats slow down the GUI a lot.
This is caused by a mismatch in the existing specifications of the UI, and I'm having trouble resolving it.

First of all, the height of all messages is not constant. In other words, until now all labels were one line height, but the new one is not.
It need to be set the correct component size and scroll panel size.
But doing it correctly can be tricky.

(1) gui_aligned_container automatically distributes size and attempts to align, but invisible components are not considered.
"Invisible" means that the component's vertex(top-left) is outside the visible range of the scroll panel.
(2) gui_aligned_container will not detect that the size of its child components has changed unless it is updated by a defined trigger. (During initialization or the dialog is resized or resize(scr_size(0,0)) is called, etc.)
(3) gui_flowtext_t does not know the necessity of line breaks until the width is determined, so it does not know how many lines there will be when it is initialized. In other words, the minimum height is determined later. This leads to an initial parent container and unusual scroll panel height.
(4) This abnormal height places the comment in an invisible position. Since it is not visible as described above, size calculation and position adjustment processing are not performed. This also leads to abnormal initial sizing of the scroll panel.
(5) Based on the abnormal size, gui_aligned_container automatically tries to distribute and align the size, so some messages will be placed very far apart. As a result, it is outside the visible range of the scroll panel and will not be resized. It will either scroll the entire panel or keep it at an abnormal size until it becomes visible by giving several instructions to resize it.

Several attempts have been made to update the size and redraw to resolve this, but unfortunately the best solution has not yet been reached.
For example, even if you adjust the position of the scroll bar, the size of components that are not visible will not change, so the scroll panel will not be the correct size.
The ideal behavior would be to monitor the width and fix the size of the component unless it changes. And I think it's about calculating the size in the optimal order.
In other words, we must first decide on the best size for flowtext.
In any case, I think some kind of countermeasure is needed, such as modifying the current aligned container and flowtext specifications or fixing their sizes.

Anyway the scroll panel somehow has a high height to begin with and the messages are stretched vertically accordingly, only the messages that are visible are shrunk and messages that are out of range remain out of range, so the height of the scroll panel is not the correct value. That's what's currently happening and I'm looking for a solution.

Quote from: prissi on May 08, 2024, 02:53:54 AMI wonder if it would not make more sense to have the title and the messages as separate items. One item the title of the play, then one or more text balloons?
I may not understand your suggestion. Does the title mean the sender's name?
Modern chat tools generally do not display names repeatedly as long as the same poster posts consecutively.
There is a character limit for one comment. The same person may send additional messages at intervals.


EDIT:
When testing, you can simulate a conversation with multiple people by changing the nickname from the network dialog and opening the chat window again.
However, when the nickname is changed, the nickname recorded in the log should also be changed.
I have not succeeded in calling the process chat_message_t::rename_client() from a network tool.
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

prissi

The vehiclelist has also vehicles with different sizes as there could be detail texts and so on. Their size is also no know as it is a . This is not a problem as long as the size is known on initialisation. I mean, the chat balloon do not change size later until resized. Hence, the trigger should be only needed after fill_list(). After the initial filling, the width (and hence) the height of each object is known.
Also, I would only fill one of the lists (the one needed) and fill the tabs on tab changes. I will have a go too, but my feeling is that instead of all the container business, maybe the text balloon and date should be draw by "hand" without tables. Hence one would have different entries in the scrolly, Header, the for me hidden date, the text balloons.

prissi

Ok, I have finally a working chat window under all circumstances with a lot less nested box and nice scaling and found quite some errors within the resizing jungle. Please see here:
https://github.com/prissi/simutrans/tree/chat-window
As a bonus, the overview list does not need refill when changing the player ...

Ranran

Thank you for your work.

I tried to implement a feature that displays a notification of unread comments on the chat dialog icon.
The code can be found below.
https://github.com/Ranran-the-JuicyPork/simutrans-ex-fix/commit/bf12617fa564b882159fd3fd065c577852713602.patch



The count will be reset when you open the corresponding tab. It does not check whether unread comments are displayed correctly.
Players will be able to know the message as it will be displayed as a ticker, but since they will need to open a chat window to reply, it would be better to notify them just in case. I think it's better than nothing.

It may be noticeable if the font is large compared to the size of the icon, as shown in the image. However, they vary in size independently, making it difficult to balance them.
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

prissi

Very interesting addition, thank you.

Ranran

#21
I made some corrections and additions.
https://github.com/Ranran-the-JuicyPork/simutrans-ex-fix/commit/2e1e699e0da7dedc16c1c1175a8b89deb58a4946.patch

(1) can play a message notification sound.
Message notification sound must be provided by pakset.
Prepare message.wav and place it in the sound folder. Attached is a sample sound.
https://simutrans-germany.com/files/upload/message.zip

(2) Fixed the content displayed on the ticker when posting a message.
- My own posts do not flow to the ticker. (The same goes for notification sound.)
- Fixed an issue where the poster's name was missing.
- Distinguish notation for direct chat.
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

prissi

I think I messed up also the time display of old messages and the direction of the triangle at the messages. But I will add this to my branch too, thank you.

Ranran

#23
Thank you for your efforts in implementing this.
I haven't looked into the differences in detail yet, but I can see some anomalies.


- The height of a single comment is not accurate and will overlap.
(EDIT: seems like the height calculation is incorrect in the comment where the name is omitted.
 EIIT2: Messages with only one line without time indication converted from old logs are correct, messages with multiple lines are incorrect. )
- Local time display has been lost.
- The display position of the elapsed time since post has changed or is incorrect.
- Other people's balloon tails are oriented incorrectly, but you already know that.
- It seems that the "shadow" position of the right-facing balloon tale is 1px lower than the original position.
- The ability to copy messages also appears to have been lost.

But I'm still not sure if these are coming from differences in the standard and extended UI code, or from errors retrieving recent commits of my relevant standard.
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

Ranran

#24
Thank you for your help thus far.

I did a quick test and fix.
https://github.com/Ranran-the-JuicyPork/simutrans-ex-fix/commit/a8ad931c1b18c78bd6cc670126ce0808350cfc3f

Previously, there were three labels: "Game Time," "Player Local Time," and "Time Since Post," but "Player Local Time" has been removed.
Was this done on purpose?


The chat ballon's left_aligned condition is incorrect (my code was right_aligned instead of left_aligned).
The same player_nr does not mean the same speaker, and the direction of the arrow does not differ depending on the company.
Also, the tails are not limited to the left and right sides, but there are also situations where there is no tail. This is a system message. I think the condition for a tailless display for displaying system messages has been removed.
Your code can no longer display messages without tails. Since gui_chat_balloon_t does not hold a pointer to chat_node, the tail condition must be set and held at initialization in order to perform conditional branching correctly with draw.
In my branch it was fixed.


The reason why the drawing of the tail is off by 1px is because the width and height of the drawing code were changed and the orientation was changed.
The direction of the tail has changed. Is this intentional?
I intended it to be symmetrical with reference to other chat UI designs.
In other words, it used to be oriented top left or bottom right, but you changed it to top left and top right.


Labels representing the passage of time are updated as time passes. This means that the size will change.
This has been fixed because it no longer supports this properly.

By changing the scrolled list to be set directly on the tab
The combobox for selecting direct message recipients from chat history remains removed.


Scroll bar X is now displayed. I think it's best to maintain the optimal size without displaying this if possible.

Quote from: Ranran(retired) on May 13, 2024, 04:53:34 PM- The height of a single comment is not accurate and will overlap.
I think I was able to fix the height of gui_chat_balloon_t.
But the size of gui_scrolled_list_t does not change and has an incorrect value, which is affecting the scrollbar.
This is why so far I have avoided using scrolledlist when creating lists in the UI, and why my initial implementation also used scroll_panel.
Is it possible to fix this problem?


The red line at the bottom is the bottom of the scroll list. But the bottom has been broken and the comments are pouring out.
Previously, the messages were displayed overlapping each other, and I think this is the size at that time.



The size of the flow text is sometimes incorrect and the characters may run off or overlap with the next message.

An unnatural space may appear between the player name and the message directly below it.

Background colors based on player color for own and other people's messages had a difference in color intensity, but that seems to have been lost.

IMO, we need a little more padding on the left and right sides of the flowtext.

EDIT:

I changed the background color back. Those are same player color, but the intensity of the color differs depending on the orientation.

Try the red player color. I recommend that we do not make the colors too dark, as this will reduce readability.


Player 1 is originally a pale color, so it can't be helped that it's hard to distinguish it from gray.
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

prissi

Thank you and sorry, the tailless condition I did not understood because of no comment when I tried to port the things over. I may have guessed more things wrong.

Now I never seem my company messages going to the left if I load a server game in single player mode (as I do for testing the display). If I am player 5, the message from player 5 do no longer move to the right. Why? At least on the standard games I had players (many years ago) only few people ever changed their nickname. And if you change you nickname "your messages" are not long right sided. Maybe there should be at least an option to have the company message as their own.

Also what is a company chat. Usually, companies are protected by a password, and thus only a single player plays a company.

The sizes are still not perfect, working on it. I think also of bsize should be taken from the flowtext.

Ranran

Quote from: prissi on May 14, 2024, 01:17:07 PMNow I never seem my company messages going to the left if I load a server game in single player mode (as I do for testing the display). If I am player 5, the message from player 5 do no longer move to the right. Why?
Nicknames should not be NULL, but I think this is now possible. That is, it must be assigned a name such as client #1.
It may not have gone through existing processing.

Quote from: prissi on May 14, 2024, 01:17:07 PMAlso what is a company chat. Usually, companies are protected by a password, and thus only a single player plays a company.
As far as I know, there are often cases where multiple people play the same company. In other words, it is operated by sharing passwords. I think this is one of the ways to enjoy network games.

Player companies for online play can have a maximum of 15 people. One company may be used as a spectator company.
For long-running and non-closed servers like the bridge water brunel server, 14 player slots may not be enough.
When one person occupies one slot, abandoned companies that are no longer active with sufficient assets often prevent new players from joining.
As a result, there may be a shortage of player slots.

When multiple players cooperate to operate a company, high activity can be expected and healthy company management may be expected.
It can be a nice option, especially for busy players who can't log in often.
Sharing the work may reduce the burden on each player.

Also, as I mentioned previously, one of the goals of the chat system is to eliminate strange communication by markars.
Company chat displays complaints and offers directly to the company.
That is, think of it as sending a whisper to a company rather than an individual.
Only unlocked players can see the contents of company chats, but unlocked players can still "send" chats.
Please note that player must respond to the complaint directly via direct chat, not via company chat.
However, launching a direct chat with the press of a button is an easy task. That's what I was planning.
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

prissi

I see. Since I haven't run a network game in like ages, you are probably better at handling the finer points. I still think the scroller_list is somewhat fundamentally broken. It changes when the convoi height in the convoi_frame changes, but somehow not when the height changes of the comment. I think I need to address this on a fundamental level to have all the stupid resizing put to an end.

Ranran

Quote from: Ranran on May 04, 2024, 09:50:02 AM- Select whether to embed the current coordinates using the button to the left of the chat input. Coordinate jump is changed to coordinate button
I noticed that this feature has also disappeared.
In my implementation, when a comment had coordinates, a pos button was displayed just before the game time, and it was possible to jump to the coordinates.
This is a feature that was also present in the old message list, and its loss would be a step backwards.


https://github.com/Ranran-the-JuicyPork/simutrans-ex-fix/commit/c472d5a8a7c8bf7032605d82d6f1032e3d1e627c
I've tried restoring this, but somehow the buttons don't display correctly. However, the coordinates and size seem to be recognized correctly. why?
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

prissi

Probably it becomes easier to move the labels and buttons in an aligned container before doing even more repositioning exercises. Anyway, showing again the pos-button.

prissi

I have finally achieved a stable (and also much more performant) scrolled list that works even with dynamic sizes. As usual here: https://github.com/prissi/simutrans/tree/chat-window

Ranran

#31
thank you. The scroll list size is now correct.
However, I think there are still issues with the scroll list.

- The name display branch condition was lost, so it has been repaired.
- Fixed the company chat filter that was broken.

The pos button is just displayed and has no function. To restore the text copy function, we must be able to process actions correctly.
It didn't work for gui_container_t.
We may need to knead further with a scrolled list to get it right in this direction. After all, is the solution that gui_chat_balloon_t inherits from gui_aligned_container_t?
In that case we will need to redo the layout code. So I'm aware of the issue of overlapping elapsed time labels, but I'm leaving this as is because of that possibility.

There was a bug where pos was not sent correctly to other clients. See netwok_cmd_ingame.cc as it is now fixed.
This will allow you to check if the posbutton works.

Currently, I think the only significant difference between standard and extended in chat_frame.cc is the include line of simmenu.h.
Your branch has already lost multiple features as I pointed out, and I've also made some fixes today.
I recommend updating once before the next step to avoid layout conflicts and the hassle of resolving conflicts in the future.
What I updated was chat_frame.cc
and only this change regarding netwok_cmd_ingame.cc.


Another small problem is that this chat window's scrolling list should start at the bottom, which is very inconsistent with the existing scrolling list system.
Ideally, the most recent comments should be displayed the first time.
But this doesn't work.
The timing of the size calculation during initialization may not match well.
Another small issue is that it is difficult to specify the scrollbar at the bottom.
This is because the size of the knob is unknown, and the scroll bar position can only be specified at the top of the knob.
There was no point in putting in a value that exceeded the range of the scrollbar position.
Should we keep the same scroll position when a new comment is submitted?
Should we scroll down by the increased size?
This means that even if you scroll all the way to the bottom to read the latest comments, it will automatically scroll back a little as new comments are added.

EDIT:
During the restoration process, the symptoms of gitaction failure that I had previously overcome seem to have returned. I need to look into it.
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)

prissi

#32
There were still some redrawing issues with the scrolled list, which I have committed to the main repo at r11223.

About the scrolling, this is indeed on my today list. I think this is best a special flag on the scrolled list component. Like "sticky_end" compared to "sticky_top" (right now the default).

The current state of the chat system has gone in in r11225, but I will look at your changes tonight. Already thank you for your hard work on that.

EDIT: r11228 fixes copying and clipboard

Andarix

#33
If you want to test the new chat, I have my Simutrans server running with r11226. It may be necessary to install pak64.german again due to file differences.



What's strange is that when you open it, there are 2 input fields at the bottom of public_chat. If you switch to another tab and then back, an input field will disappear.

For personal_chat, I would put the message input line on a new line so that more of the entered text can be read.

When switching tabs, the width adjustments of the input line below are not carried out. This only happens when the window is resized.

inputline_no_scaled.png

I'm wondering how appending the coordinate (arrow in input line) is supposed to work.

Ranran

#34
https://github.com/Ranran-the-JuicyPork/simutrans/commit/ac500698efb836f26f75bc5d39cde8db5b50eb0f.patch
As already explained, I think that the only difference between extended and standard in the chat window code is "#include file" due to the difference in folders.
If the compiler cannot use localtime_s, it will not be possible to build, so some kind of countermeasure is required. Other than that, I think this works as standard.
As already explained, the prissi implementation has lost many functions and is not working properly. My version has some behavior fixes. It's also very different from the UI appearance. And there are still some features that have not been fixed.
I have already explained them, but I think it's easier to understand if you compare them.


Quote from: Andarix on May 22, 2024, 12:08:11 PMI'm wondering how appending the coordinate (arrow in input line) is supposed to work.
It's a button that fills the message with coordinates. This button displays help text when you hover over it.
Previously we were reading coordinates from messages, but players who don't know that feature won't use it. It would be difficult to imagine that for a new player who is not an elder guy. Inputting commands is a pain, especially when playing on a smartphone.
When I turned it on and sent a chat, a pos button appeared in the message that I could click to jump to the coordinates, but since the code change this functionality has been lost. The button is now visible but cannot be clicked.
It is a feature that exists in existing messages (although the steps to use it are different), so losing it would be a regression in functionality.
The ability to copy messages is also lost. I suspect it's the same reason why these stopped working, so I'd expect them to be repaired together in the future.
pak.256やpak.nipponのような複数タイル市内建築物があるpakセットはextendedではちゃんと遊べません。それどころかextendedの追い越し機能はバグまみれで修正が難しくなっており、都市機能および道路機能というゲーム土台部分を壊し、開発作業&コードメンテナンスの足かせになっている。それは最終的にプレイヤーの損失に他ならない。その原因は全て1人の日本人=ひめし@himeshi_hob(THleaderH)によるもの。再びフォーラムの先輩方のアドバイスをガン無視し、結局ほとんど修正されないままExtendedに実装されてしまった。彼は問題を認識しつつ5年以上放置して今なおOTRPの開発を続けている。あまりにも身勝手で無責任。日本の人達はそういう事実にちゃんと目を向けるべき (´・ω・`)