GikopoiApi, #0

#+TITLE: Gikomacs Manual
#+OPTIONS: \n:t
* Introduction
** Installation
Install the =websocket= library:
~M-x package-install RET websocket RET~
** Finding a server
* Guide to Gikopoi
This section is intended as a general guide to Gikopoipoi and should be useful regardless if you are using the Gikopoi2 web client or Gikomacs. A common area of interest might be the [[*Stream Guide][Stream Guide]].

** Area Guide
A typical Gikopoi server has several areas which in essence act as independent instances. 

** Room Guide

*** Map
#+ATTR_HTML: :width 542px :title Map of Sea City
[[./map.jpg]]

** User Guide
Believe it or not, Gikopoi is made up of +ir+​regular people just like you and me. 

*** Messages

*** Tripcodes
The diamond with the weird characters on some people's names (e.g. ◆hawaiiZtQ6) is a special feature to let others know +you're a faggot+ who you really are. The idea is to encrypt a secret phrase one way to provide identification without the added complexity of registered accounts.

Tripcodes are a feature mostly exclusive to textboards and imageboards, and for the most part (though often in subtly incompatible ways) follow the same algorithm, so they can be used across different sites. The algoritm originates from 2channel, and descriptions of it can be found in various places.

To use a tripcode, enter a name (or nothing) followed by a hash symbol and a secret of up to eight characters, e.g. ``Giko#password''. The server will treat the characters following the hash as input, and produce a new name with the result; the example for instance would become ``Giko◆ozOtJW9BFA''. Input longer than eight characters is cut off at the tail end.

Some people like them for vanity, and using one isn't generally frowned upon in Gikopoi. There are several tools available to crack and generate tripcodes, and I personally find the older ones to be easier to use. A few guides on how to use these programs can be found [[http://tripcode.50webs.com][here]], although keep in mind that Gikopoi and everywhere else uses the 10 character variant (8 characters were used for a short while on 2ch before being expanded to 10). Alternatively, you may prefer to use a more modern program.

Some famous tripcodes:
+ =Ep8pui8Vw2=
+ =5JrU4QOlH6=
+ =Basque9Dpk=

*** Characters

*** Passwords
Passwords were a feature from Bar Gikopoi for hiding away secret characters. It is too implemented by Gikopoi2, but by default goes unused: on the login screen, hitting =Control+Shift+9= will uncover a password input box above the area selection--on Gikopoi3 double-clicking the ``User name:'' label will do the same. On Gikomacs, the ~gikopoi~ command will prompt for a password if the variable ~gikopoi-prompt-password-p~ is not ~nil~.

** Stream Guide

* Using the Gikopoi2 Client
* Using the Gikopoi2 Server

* Using the Gikomacs Client
This section of the manual describes the use of the Gikomacs client. I assume you are familiar enough with Emacs to understand interactive commands and how to set and inspect variables. 

** Connecting
Issuing the command ~M-x gikopoi~ will prompt for a new Gikopoi session, and quit an already existing one upon completion, if it exists.

In order to connect, you need to enter a server, an area and a room. The list of available servers and their areas can be autocompleted by pressing =TAB= in the minibuffer, this information is stored in the variable ~gikopoi-servers~. Next, you will be prompted for a name and a character. If you don't wish to be unique, you can enter nothing and will be given the default anonymous name and giko character. You can enter tripcodes the same way you enter them in other sites, see [[*Tripcodes]].

To disconnect you can run the command ~gikopoi-quit~ by typing =Q=.

** Talking to other users
You can get a list of everyone in the room and their status by saying =#list=, or typing =L= (bound to ~gikopoi-list-users~). If someone is being annoying, moving your cursor to a name in the list and hitting =i= will ignore the user. You can do the same outside the list by typing =I=, at which point you will be prompted for a name. You won't see any new messages from who you ignore, though keep in mind that this effect is only client-side and what you say can still be seen by everyone; if you want to get away from people you should either bully them out or move to a different room.

Incoming messages are matched by the variable ~gikopoi-mention-regexp~, and if matched are highlighted by the variable ~gikopoi-mention-color~ if it is not ~nil~.

** Moving between rooms
To see a list of all the rooms in the area, you can say =#rula= or type =R= . If you know the ID of the room, you can also say =#rula= followed by its ID.

** Getting streams
At this point in time, getting or creating streams is not supported by Gikomacs.

** Commands Index
- gikopoi ::
- gikopoi-notif-mode ::
  This is a global minor mode that displays a counter of unread messages and mentions in the mode line, as well as an abbreviated list of users who've mentioned you, if any.
- gikopoi-list-rooms ::
- gikopoi-list-users ::
- gikopoi-rula ::
- gikopoi-ignore ::
- gikopoi-quit ::
- gikopoi-clear-mentions ::
- gikopoi-autoquote ::

- gikopoi-move-left ::
- gikopoi-move-right ::
- gikopoi-move-up ::
- gikopoi-move-down ::

- gikopoi-bubble-left ::
- gikopoi-bubble-right ::
- gikopoi-bubble-up ::
- gikopoi-bubble-down ::

* Using the Gikomacs Server

* Using the Gikomacs Editor
** Map Generator

* API
This section describes the API of Gikopoi2 from around versions 693 up to before 722, the former being the version which Gikopoi3 is based upon and Gikomacs is expected to be the most compatible with. Later versions have changed the API in ways which have yet to be rectified at this point in time.

** HTTP API
*** Login API
- POST: =/login=
  The server listens to HTTP POST requests at =/login=, expecting a JSON object with the attributes ~userName~, ~characterId~, ~areaId~, ~roomId~ and ~password~, with the latter being optional.

  The server should respond with another JSON object with the attributes ~userId~, ~privateUserId~ and ~appVersion~. You need to hang on to ~privateUserId~ in order to make a socket connection later.

*** Character API
- GET: =/characters/regular=
  Character data is served in one huge JSON object at =/characters/regular=, with the data for each frame being either a plaintext SVG or base64 encoded image, usually PNG, indicated by the ~isBase64~ attribute.

  This extremely stupid approach works fine for Gikopoi2, but can noticably bog down Emacs for a moment when it needs to process a JSON object that's several megabytes in size. Gikomacs accomodates this by keeping the file in a buffer and searching through it on demand, interning new symbols for the character IDs as needed so they don't need to be read twice.

- GET: =/characters/crisp=
  It's also served at =/characters/crisp=, but the only difference is that every SVG has an extra attribute that makes it look like shit when it's rendered, so there's no real reason to use or support it.

*** Room API
- GET: =/rooms/ROOM/*=
  The image resources for each room are placed under =/rooms/ROOM/=, where =ROOM= is the room ID. For instance, the =chair.svg= resource in the room =bar= would be accessed at =/rooms/bar/chair.svg=.

- GET: =/areas/AREA/rooms/ROOM=
  Rooms are also served as JSON objects at =/areas/AREA/rooms/ROOM=, where =AREA= is the area ID and =ROOM= is the room ID. You don't really need to read from it since the same data is sent in a ~server-update-current-room-state~ message once you join a room. For a description of the contents of the data see [[*Room Objects]].

*** Admin API
- GET: =/admin=
- POST: =/user-list=
- POST: =/banned-ip-list=
- POST: =/ban=
- POST: =/kick=
- POST: =/kick-ip=
- POST: =/ban-ip=

*** Misc. API
The following endpoints may not be of necessary interest, as interfacing with them is not required for the successful operation of the client.

- POST: =/client-log=
  The server exposes the path =/client-log= which can be HTTP POSTed in order to log information to the server. What you log into here is mostly irrelevant, so it's your choice to either use it to log useful information about what your client is doing or direct obscene messages to the admin.

- GET: =/version=
  The version number of the release the server is running on is available at =/version=, in case you need to know it before logging in.

- GET: =/players=
  Gikopoi3 has an endpoint at =/players= which shows which rooms are populated and who's streaming.

- GET: =/lang/*=
  Gikomacs serves language data as a JSON object at =/langs/xx=, where =xx= is an ISO 639 language mnemonic. The Gikopoi2 client normally gets this from a Javascript payload at =/scripts/lang/xx.js=; Gikomacs simply bundles the necessary data with the client.


** Socket API
Gikopoi2 uses the Socket.IO library for client-server messaging. Socket.IO is a fairly thin protocol on top of Websockets, and Gikomacs uses the Emacs ~websocket~ library to implement the necessary shim on top of it, but not much more. Additionally, the server tries to prevent the loss of messages between clients, the details of which are described in [[*Lossage Prevention]].

The Gikomacs client connects to the websocket server through the URL =ws://%s:%d/socket.io/?EIO=4&transport=websocket=, where =%s= is the domain and =%d= is the port, with the custom header value ~private-user-id~ being the ~privateUserId~ that was given on the successful login, see [[*Login API]].

*** Standard Client Messages
- user-room-list ::
  Asks the server to respond with a ~server-room-list~.

- user-change-room (targetRoomId targetDoorId) ::
  
- user-ping ::
  Notifies the server of your activity, used by the Gikopoi2 web client on certain mouse events when the user has been away.

- user-msg msg ::
  Sends a message to the room.
  
- user-move direction ::
  If already pointed towards ~direction~ then move that way, otherwise change it.
  
- user-bubble-position direction ::
  Changes the orientation of the user's message bubble to ~direction~.

- user-block userId ::
  Blocks the user at ~userId~ from seeing anything you do. Unlike ignoring this is server-side, IP-based and permanent until you log out. This isn't implemented by Gikomacs as its author considers it to be a harmful feature.

- user-want-to-stream (streamSlotId withVideo withSound streamIsVtuberMode isNicoNicoMode isVisibleOnlyToSpecificUsers info) ::
- user-want-to-stop-stream ::
- user-want-to-take-stream streamSlotId ::
- user-want-to-drop-stream streamSlotId :: 
- user-rtc-message (streamSlotId type msg) :: 
- user-update-allowed-listener-ids ::

- special-events:client-add-shrine-coin ::

- user-want-to-play-chess ::
- user-want-to-quit-chess ::
- user-chess-move source target ::

*** Extended Client Messages
- user-change-character characterId isAlternateCharacter ::
- user-change-name name :: 

- user-ghost ::
- user-unghost ::

*** Standard Server Messages
- server-cant-log-you-in ::
  Sent by the server when the socket connection is refused for some reason, i.e. if you're banned.

- server-update-current-room-state state ::
  Sent when (re)joining a room, with the room object in ~state~. See [[*Room Objects]].

- server-room-list roomList ::
  Sent in response to ~user-room-list~. For the contents of ~roomList~, see [[*Room Lists]].

- server-user-joined-room user &optional isReconnecting fromRoom ::
  Sent to everyone in the room when someone joins it, where ~user~ is a user object, see [[*User Objects]].
  ~isReconnecting~ and ~fromRoom~ are optional extensions by Gikomacs, where ~isReconnecting~ is true when the user rejoined from having to reconnect (so the client can choose not to notify), and ~fromRoom~ is the room ID of the room the user joined from, if any.

- server-user-left-room userId &optional forRoom ::
  Sent to everyone when someone leaves the current room, with ~userId~ being the ID of the user.
  ~forRoom~ is an extension by Gikomacs, being the room ID of the room the user has left for, if any.

- server-user-active userId ::
  Sent to everyone when the user with the ID ~userId~ has gone active.

- server-user-inactive userId ::
  Sent to everyone when the user with the ID ~userId~ has gone inactive.

- server-move (userId x y direction lastMovement isInstant shouldSpinwalk) ::
- server-bubble-position userId direction ::
- server-character-changed userId characterId isAlternateCharacter :: 
- server-msg userId msg :: 
- server-system-message type &optional msg :: 
  dwadads
- server-reject-movement ::
- server-stats (userCount streamCount) :: 
  Used to update the info box when someone joins or leaves the area or a stream goes up or down.
  
- server-ok-to-stream ::
- server-not-ok-to-stream reason ::
- server-rtc-message streamSlotId type msg :: 

- server-not-ok-to-take-stream streamSlotId ::
- server-update-current-room-streams streams ::

- special-events:server-add-shrine-coin coinCounter ::

- server-chess-win userId ::
- server-chess-quit userId ::
- server-update-chessboard chessboardState ::

*** Extended Server Messages
- server-roleplay userId msg :: 
- server-roll-die userId sideCount result diceNum ::

The following are used for Gikopoi.hu's magic system.
- pushmana manaPoints ::
- pushxp experiencePoints ::
- server-failedspell userId ::

- server-update-postitnote state ::
  Used for Gikopoi.hu's post-it note system, essentially the same as ~server-update-current-room-state~.

Unique to Gikomacs:
- server-name-changed userId name ::
- stream-viewer-count count ::
- server-update-current-room-objects objects ::

*** Lossage Prevention
A feature of the Gikomacs server is that when a user reconnects from having his connection broken, the server will try to re-send some messages which would have been lost during that time. Upon reconnecting, the server looks at the time of the user's last ping or last sent client message (whichever is sooner) and re-sends all of the messages he would have recieved between then and now, in the order they came. Although the Socket.IO sever is said to buffer packets by itself, in practice this does not seem to work very well.

** Stream API
** Data Structures
*** Room Objects
*** User Objects
*** Languages
*** Room Lists
An array of objects with the attributes ~id~, ~group~, ~userConut~, ~streamers~ and ~streams~ where ~id~ is the room ID, ~group~ is the ID of the group that the room belongs to, ~userCount~ is how many users in the room and ~streamers~ is an array of names. ~streams~ is an array of objects with attributes ~userName~ and ~isVisibleOnlyToSpecificUsers~, making ~streamers~ redundant.

* History
** BARギコっぽいONLINE (Bar Gikopoi Online)
Bar Gikopoi Online, what was usually referred to as just Gikopoi (some have since adopted the retrospective moniker ``flashpoi''), is an avatar chatroom where you can play as text art characters from the Japanese textboard 2channel. It is one of several Flash-based ``AA chatrooms'' that were at one time popular with users of the site, and likewise were platforms for anonymous discussion.

It was a successor to an earlier and similar chatroom called just Bar Giko (BARギコONLINE). 4chan users discovered this site around 2005, much to the chagrin of the locals; and although a rich cultural exchange was confirmed to have been had, the foreigners were promptly restricted to their own part of the server. This tradition continued for several years up to and after the migration to Bar Gikopoi, forming the Gikopoi International (_​for) community.

[[./harbl.gif]]

As Gikopoi 

Despite it's relative antiquity the site continues to be hosted at http://l4cs.jpn.org/gikopoi/, and you can play it if you have a browser that still runs flash. Since it's userbase was subsumed by Gikopoipoi, it's for the most part a complete ghost town save for a few of us who occasionally walk in there for kicks, or the four Boons who perpetually sit in the Anonymous bar, presumably for all eternity...

** Gikopoi2 (Gikopoipoi)
[[https://github.com/iccanobif/gikopoi2][Gikopoi2]], later called Gikopoipoi and hosted at https://gikopoipoi.net was written by international user ``iccanobif'' as a modern and necessary successor to Bar Gikopoi, what with Flash being forced off the web. It's for the most part a one-to-one remake, with many additional rooms and characters. The 

A couple years later, ``Archduke'' [[https://github.com/153/gikopoi3][forked Gikopoi2]] into his own version slowly accumulating minor changes, hosted at https://play.gikopoi.com. This is the version that Gikomacs follows, as its API is stable and it's author spends the most time on it. This version is notable for being a mostly separate foreign community away from Gikopoipoi (although there is some overlap), with its own slew of events and notable memes. The site =gikopoi.com= was actually registered before =gikopoipoi.net=, and originally acted as a portal to Gikopoipoi with a bit of information and links to a few related sites. It seems that many newcomers end up finding this site first and are unaware of the existence of the others, this may be due in part to the fact that it has for a time been one of the top Google results for Gikopoi, and has been advertised on semi-popular sites such as [[https://4-ch.net][4-ch]]. The site also hosts its own [[https://bbs.gikopoi.com][textboard]], [[https://booru.gikopoi.com][booru]] and [[https://wiki.gikopoi.com][wiki]] with user-contributed content.

At some point, ``aaaaa'' [[https://github.com/ieksobeh/gikohun][also forked Gikopoi2]], reintroducing the magic system and other motifs missing from it, bringing it aesthetically closer to Bar Gikopoi. It also sports a Hungarian localization and a few original features. This version can be played at https://gikopoi.hu, although it is not as active as the others. 

In April of 2024, ``iccanobif'' correlated with the _​gen community at an undisclosed location in Saitama Prefecture, Japan for a week of illicit drugs and sex orgy. A list of who else attended the event is known to exist and rumoured to be of up to 50 people, but has not yet surfaced at the time of writing.

** Gikomacs (Gikopoi Emacs/gikopoi.el)
There had been 

** Trivia


* Glossary
+ Gikopoi ::
  In this manual, a blanket term for all the versions of Gikopoi and the communities that inhabit them. See [[*History]].

+ Bar Gikopoi ::
  The original Flash version by ``lllll''. See [[*BARギコっぽいONLINE (Bar Gikopoi Online)]].

+ Gikopoi2/Gikopoipoi ::
  The new HTML5 implementation of Gikopoi written by ``iccanobif''. See [[*Gikopoi2 (Gikopoipoi)]].

+ Gikopoi3/Gikopoi.com ::
  The version of Gikopoi2 modified by ``Archduke'' and its associated instance.

+ Gikohun/Gikopoi.hu ::
  The version of Gikopoi2 modified by ``aaaaa'' and its associated instance.

+ Gikomacs/Gikopoi.el ::
  A Gikopoi2-compatible client and server implementation written by ``gyudon​_addict''. See [[*Gikomacs (Gikopoi Emacs/gikopoi.el)]].

+ 2channel ::
  A Japanese textboard. Although it has faded in relevancy within its homeland due to prolonged disputes as to its status and being generally eclipsed by spinoff sites and other @@html:<abbr title="Social Networking Services">@@SNS@@html:</abbr>@@ like Twitter, it's indispensable to native and global internet culture. Its original content in the form of @@html:<abbr title="ASCII Art">@@AA@@html:</abbr>@@ served as the basis for several chatrooms, with Bar Gikopoi being one of them.

home // current // other revisions