Comments (9)
Hello @RichardJohnn,
Over a telnet
connection (as well as ssh
connections most of time) the server cannot find out the capabilities of the client terminal.
You got two options: either you continue using the default terminal
instance, but you run your command with COLORTERM=truecolor
(e.g. COLORTERM=truecolor ./dnd
), or you pass the correct option to .createTerminal()
.
BTW the (default) terminal
instance is created using .createTerminal()
with parameters found by .guessTerminal()
. You can pass to the appId
option the codename of your terminal. E.g.:
var term = require( 'terminal-kit' ).createTerminal( {
appId: 'xterm-truecolor' ,
// ...
} ) ;
Correct appId can be found inside the lib/termconfig/
directory (all files basename without extension).
If you manage to build a great game, tell me!
I have a similar side-project, a sort of multiplayer version of Dungeon Crawl Stone Soup. But the project is stalled...
from terminal-kit.
hmhm! I did try passing 'gnome-256colors' as the appId and support.trueColor
was true, but things stopped rendering when using ScreenBufferHD. I will keep digging in then, just wanted to make sure it was expected to work out AOK.
Is the code for your game available to take a look at? :)
from terminal-kit.
@RichardJohnn Over telnet and inside the terminal-kit directory, try running COLORTERM=truecolor ./sample/screenbuffer-hd-test.js
, and tell me if it works. It should display three moving boxes with blending effects.
The code of my game is not available yet, I was refactoring it the last time I coded on it. Not sure if I will ever have the time to finish it...
from terminal-kit.
hm not so sure about running a telnet server so i ran an ssh server instead. I tried what you mentioned and that works.
what I have going on might be a little different I think?
const tkit = require('terminal-kit');
require('net').createServer(function(client) {
var buffer, term;
term = tkit.createTerminal({
stdin: client,
stdout: client
});
term.clear();
term.moveTo(1, 1, "ICU");
buffer = tkit.ScreenBufferHD.create({
dst: term
});
buffer.put({
x: 2,
y: 2
}, "Hello");
buffer.draw();
}).listen(2323);
if i telnet localhost 2323
i only see the "ICU", not "Hello". would you expect that to work out?
thank you for your time! i know how it feels having so little of it :|
from terminal-kit.
hmhm drawImage doesn't work out either.
taking a peek in wireshark, nothing is sent over the wire.
i will take a gander at the code later on 👍
good times!
from terminal-kit.
@RichardJohnn Haha, found it... My bad, 15min to remember that a net.socket
is not a TTY stream ^^
Not sure how to achieve that through a socket, many info are lost.
Few things:
- manually set
term.width
andterm.height
createTerminal( {stdin: client, stdout: client, generic: 'xterm-truecolor', appId: 'xterm-truecolor'} )
- terminal resizing will not be detected
- during my test, it appears that ScreenBufferHD are not working through socket, I don't know why. There is probably a bug somewhere I should investigate... So use standard ScreenBuffer
If you want a full server+telnet approach, you should find a way to open a Node TTY stream (using PTY and SSH?).
But the best approach is to code a true client, and move all terminal-kit stuff there.
from terminal-kit.
Interesting. Looks like I need to read up TTY, PTY and SSH more.
I was thinking I'd make a true client at some point, to support audio or even 3d graphics, but also thought it would be neat to support a simple telnet connection
thank you once again
from terminal-kit.
@RichardJohnn I don't know what I was doing wrong yesterday, since it works perfectly today:
const tkit = require('terminal-kit');
require('net').createServer( client => {
var term = tkit.createTerminal({
stdin: client,
stdout: client,
// Add generic, and appId if it is known (generic *MUST* be xterm-truecolor, appId is the real
// terminal ID)
generic: 'xterm-truecolor',
appId: 'xterm-truecolor'
});
term.clear();
term.moveTo(1, 1, "ICU\n");
// Manually set term width and height
term.width = 80 ;
term.height = 25 ;
var buffer = tkit.ScreenBufferHD.create({
dst: term ,
// define width and height, or it will cover the whole terminal
width: 5 ,
height: 1 ,
x: 2 ,
y: 6
});
buffer.put({
// Don't forget to add colors, or it would write using the default color (which is unknown over telnet)
attr: { r: 86 , g: 48 , b: 12 , bgR: 112 , bgG: 200 , bgB: 50 }
}, "Hello");
buffer.draw();
term.styleReset() ;
term( '\n' ) ;
}).listen(2323);
Like I said earlier, there is no way to guess the terminal width and height over telnet, and it's not possible to detect screen resizing.
You have to stick with a common size, or ask the user.
from terminal-kit.
Oh wow! that's great news.. looks like i was missing a lot of info.
I suppose having the user (me;) tweak their environment isn't so bad!
from terminal-kit.
Related Issues (20)
- terminalkit.TextBox is not a constructor HOT 3
- document: InlineInputField only widthPercent breaks input
- Redraw window every "frame" HOT 1
- Word/Line wrap ERROR when x,y,width or height of TextBox are non integers
- Unable to draw the correct image in vscode dark-mode terminal!
- Can't run after packed with pkg HOT 3
- Cannot input after using term.inputField() HOT 4
- Issue: Terminal stuck in while-loop when initating another terminal with stdin/stdout
- Form control event and validation
- form render issue - hide/show control
- Erase Everything - How?
- Possible EventEmitter memory leak
- Multiple Documents in Same Terminal Screen
- support for fonts
- term.table does not work in Azure pipeline HOT 6
- term.table does not work in Azure pipeline HOT 1
- Unable to bundle code with dependencies HOT 5
- inputField Inline support? HOT 1
- Documentation request: cannot chain .inputField
- Unable to add left padding to singleLineMenu?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from terminal-kit.