IRCiv is a little game (and game engine of sorts) for building stuff like in "Civilization"-branded games.
Currently it piggybacks as a couple of scripts for the exec bot. Refer to the wiki for more info on exec: http://wiki.soylentnews.org/wiki/IRC:exec
Implemented some basic unit movement last night. Can use "up" or "u" action on the active unit (along with equivalents in the 3 other directions).
The game is being gradually developed/tested most nights (Australian time) in the #civ channel of Soylent IRC. Feel free to join, but be aware that you may get pinged by the bot a fair bit (you're always free to duck in and out whenever you like of course).
Other stuff that has been implemented already:
- auto-login on join/logout on part
- logins based on nickserv account name (using whois), so means that players must be registered with nickserve
- supports nick changes
- map generator has been developed (random landmasses based on a couple of parameters)
- map image dump
- map text file dump
- player settings and flags system
- player active unit status output to either game channel or private message (based on "public_status" flag)
Currently development is mainly in PHP, but using the exec bot system, game features/modules can be developed in any language.
Each command runs as a separate script in its own process instance, but can easily communicate with IRC and access persistent game data.
The project is open-source (GPL2) and can be found here: https://github.com/crutchy-/test
Feel free to fork or pilfer, but please share your changes/derivatives.
Anyone interested in contributing to the current project, look for crutchy in #soylent or #civ on IRC.
https://github.com/crutchy-/test/blob/master/karma_published.php
bacon+
(only single +/- to differentiate from bender)
~karma bacon
~rainbow pretty text
etc
todo: quotes
no more searching
reset color:
~color -1
bold white:
~color 00
change color per mirc values: http://www.mirc.com/colors.html
~color 01
thru
~color 15
requote last in weird and wonderful ways (or show about):
~
bot doesn't quote itself (shows about)
atm only verbs ending in "ing" and a small set of nouns recognised, but this will grow
if you're interested in contributing (even just to the arrays) have a squiz at:
https://github.com/crutchy-/test/blob/master/bacon.php
anyone new to git, have a squiz at http://wiki.soylentnews.org/wiki/User:Crutchy#Git.2FGitHub
you can also edit directly on github (ideally only for simple changes such as additions to arrays).
todo: add collective noun substitution
todo: add ability to append arrays from within irc
thanks heaps mrbluze... ideas man and english extraordinaire
https://github.com/crutchy-/test/blob/master/crunch.php
designed to quote either the last thing said by a nick or the last thing said by a nick containing a search query
usage:
~
quotes a little about string including github source link
~q or ~quit
tells bot to quit
~find nick
quotes last thing said by nick (in local recorded log files)
~find nick query
quotes last thing said by nick that contains query (in local recorded log files)
code is fairly short and (hopefully) sweet. no comments sorry.
TODO: search online logs @ http://logs.sylnt.us/
i was inspired to work on this after i saw mention of piping irc to the wiki @ http://wiki.soylentnews.org/wiki/CommunitySupport#Projects
it's been tested some but is still a work in progress.
getting around the anti-spam/anti-bot features of wiki is something i'll have to consult a wizard on.
https://github.com/crutchy-/test/blob/master/bot.php
i'm not a professional programmer so it probably sucks.
any criticisms etc are welcome, and if i can be bothered i may even take them on board, or you can do a pull request if you feel like having a play.
this is my first open source code file :-)
some some notes & snippets from fun with the chat bots in IRC.
times are australian eastern daylight saving time.
[22:25] <@aqu4> crutchy: s/tim/blaat/
[22:27] <crutchy> $sr /i/u/s
[22:27] <@aqu4> s/u/i/
[22:27] <SedBot> <aqu4> /taalb/mit/s :yhctirc[22:31] <NCommander> O_o;
[22:34] <crutchy> $sr /O_o/o_O/s :rednammoCN
[22:34] <@aqu4> NCommander: s/O_o/o_O/
[22:34] <SedBot> <aqu4> <NCommander> o_O;[22:39] <crutchy> $sr /O_o/o_O/s :rednammoCN ## yas sb/
[22:39] <@aqu4> /bs say ## NCommander: s/O_o/o_O/$sr ++nocab
/bs say ## $sr ++nocab
/bs say ## bacon++yet to try (bender+aqu4+sedbot?):
xyz say first: bacon++
/bs say ## $sr /--/++/s :zxy
Currently trying to learn how to use git and github.
http://wiki.soylentnews.org/wiki/index.php/User:Crutchy#Git.2FGitHub
An idea that came to mind during talk about Soylent hosting on IRC today.
Thanks to Titanium, prospectacle, stderr, useless, swiss, FoobarBazbot and MrBluze for a lively discussion :-)
It started with:
[19:43] * crutchy wonders if a distributed service could be developed... divide the load, build in redundancy and if anyone's host goes down others will pick up the slack
Time is AEDT
The idea has been developed a little bit further since the IRC discussion.
General System
==============
- independent of DNS
- with a distributed model anyone can volunteer to host a node (no single person relied on to front hosting costs)
- system consists of a network of apache host nodes set up by volunteers willing to cover the costs of their host, and users connect to the web service using their web browser with the remote host selected by a launcher program
Host Node
=========
- not required to access web service (only for those who choose to offer to host)
- apache web server configured for web service (mysql, mod_perl, etc as required)
- must periodically execute a script (using crontab?) that requests nodelist from listed nodes and updates local nodelist as required (adds/removes based on some kind of agreement algorithm)
- must respond to nodelist requests from launchers, but can be isolated php/pl/etc script and need not be built into hosted service
- must contain scripts to synchronize data and site source code updates securely with other nodes as required (this will be the tricky bit)
Launcher
========
- user executes launcher to access web service
- no gui
- executable or source downloaded from trusted location (such as debian repository or github) along with nodelist containing one or more known host IP addresses
- purpose is to select a remote host node and open web browser pointed to selected remote host IP address
- before opening browser, a nodelist request is sent to every host in local nodelist, and local nodelist is updated in same way as server nodelist is updated (see above)
- possibly a simple settings file if required
- could be a bash script for Linux and a small Delphi or C program for Windows
On IRC there was concern expressed about security and verification of host nodes.
Since you're using a browser as a client (and all the security features that come with) and you're only receiving normal http responses (otherwise your browser would throw an error), there's only so much bad stuff a host node can do.
Worst case scenario might be that it redirects to goat.cx or some site with driveby downloads (which most browsers will block anyway).
If required a trusted network of host nodes could be formed using signed certificates (perhaps using OpenSSL).
Nodelists may not be that big since there isn't likely to be a huge number of hosts for the same service (such as SoylentNews) but if need be the list could be gzipped. As mentioned earlier, the tricky bit will be synchronizing website data and service application source code, but I don't think it is an insurmountable challenge.
edit: data could be distributed, but would need to be synchronized on all host nodes (the tricky bit mentioned above)
edit: thinking about data synchronizing... would either require modification of the service application to execute a script when data is changed (and script would do the work of sending data to other hosts) or a shell script with a loop that checks for changes to data file timestamps and if change is detected send data files to other hosts. for max efficiency it would be ideal just to post a single mysql insert/modify query whenever data changes, but that would require integration into the main application (slashcode in Soylent's case). you don't want to be sending entire database files around the place whenever there is a change. a good place to start might be to host the data on one or two high performance 'supernodes' until an improved synch system can be developed.
had a go at scripting a little quick & dirty irc bot for soylent
requires sic (http://tools.suckless.org/sic)
if you're using debian: sudo apt-get install sic
#!/bin/bash
chan="#test"
log="test.log"
pipe="log-pipe"trap "rm -f $pipe" EXIT
if [[ -f $log ]]; then
rm $log
fiif [[ ! -p $pipe ]]; then
mkfifo $pipe
fisubstr="End of /MOTD command"
joined=""sic -h "irc.sylnt.us" -n "log-bot" <> $pipe | while read line; do
if [[ -n "$line" ]]; then
echo $line >> $log
fi
if [[ -z "$joined" ]] && [[ -z "${line##*$substr*}" ]]; then
joined="1"
echo ":j $chan" > $pipe
fi
doneexit 0
also posted on the wiki @ http://wiki.soylentnews.org/wiki/index.php/User:Crutchy#IRC_logging_bot
After a minor problem with virtualbox (f*ck you nvidia) I got the slashdev virtual machine going. If you're running a 32-bit host OS (as I do), you can probably still run the 64-bit slashdev VM. You just need to make sure your CPU supports it (Intel VT-x or AMD-V) and that it's enabled in your BIOS (usually disabled by default). GIYF.
When you're importing the vm, gotta make sure you don't hit the checkbox that reassigns mac addressses on network interfaces, cos eth0 won't show up in ifconfig and you won't have internet access.
After a quick flick through the bash history I realised that sudo works with the "slash" user.
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install gnome
*hides* (cli is awesome, but on its own is claustrophobic for me)
login under gnome classic session (default ubuntu session fails to login, not that i mind)
Ephiphany works as a web browser, but I prefer firefox/iceweasel:
sudo apt-get install iceweasel
Can also use synaptic with same password as slash user.
To start apache (compiled per slashcode install instructions, not from repositories), open a terminal:
./apache/bin/apachectl start
Full command is (just for the curious):
/srv/slashdev/apache/bin/apachectl start
Start the slashd (slash daemon) - gleaned from bash history:
sudo /etc/init.d/slash start
Close slashd terminal window (will continue to run in background).
Open Firefox:
http://localhost:1337/
Apache public directory:
/srv/slashdev/slash/themes/slashcode/htdocs/
It contains mostly links to files in the /srv/slashdev/slash/ directory.
It was nice of NCommander to make the slash user home directory as /srv/slashdev... thanks for that
Tried to register a new user but doesn't seem to work. Seemed like maybe MTA not configured. I use exim4 normally on my debian boxen (removes postfix):
sudo apt-get install exim4
sudo dpkg-reconfigure exim4-config
During configuration, mostly self-explanatory (select defaults for all except make sure to select option "internet site; mail is sent and received directly using SMTP"). Tested password retrieval with exim4 ok. As per usual check your junk folder in hotmail etc.
Sagasu is an awesome search tool:
sudo apt-get install sagasu
After install, you'll find it under Application -> Accessories
Change your file pattern to *.pl or whatever (can just use * if you want), select "/srv/slashdev/slash" as your search directory, uncheck match case, enter a search string such as "sub displayComments" and click Search.
Couldn't find sub createEnvironment though (is called at the bottom of a lot of perl files). Anyone got any ideas?
Also recommend installing mysql-workbench.
If anyone finds anything wrong with any of this stuff please let me know.
edit: the other reason why i prefer to install gnome is cos gedit is a great little development tool.
edit: thanks heaps to paulej72 for the git advice. here's the script provided by paulej (i just added the git pull, as also mentioned by paulej):
#!/bin/sh
cd /srv/slashdev/slashcode
git pull
make USER=slash GROUP=slash SLASH_PREFIX=/srv/slashdev/slash installrm -rf /srv/slashdev/slash/site/slashdev/htdocs/*.css
/srv/slashdev/slash/bin/symlink-tool -U
/srv/slashdev/slash/bin/template-tool -U/srv/slashdev/apache/bin/apachectl restart
Note: This produced a couple of errors for me. Don't run this under sudo cos the script has a hissy fit (I had to do a "sudo chown slash:slash -R ./slashcode" to recover).
Also, I use this command to execute the script:
bash ./Desktop/deployslash.sh > ./Desktop/deployslash.log
more so that I can have a squiz at what happened if it goes pear shaped.
9-mar-14
paulej72: If you hand install to /srv/slashdev/slash/themes/slashcode/templates/dispComment;misc;default you need to run /srv/slashdev/slash/bin/template-tool -U to update the templates in the database. Should also restart apache when touching the tempates