“not x” is faster than “x == False”
scrolling a surface is faster than blitting it
-
Recent Posts
Recent Comments
Archives
Categories
Meta
“not x” is faster than “x == False”
scrolling a surface is faster than blitting it
in discussions with a good friend, we have come up with a concept for a new RPG-style game that will combine elements of traditional RPG’s and the now hot genre of time management games. i’m not going to release many details in this blog. Instead, i will be using this blog as a platform for posting game design and programming scraps/notes. i hope that i can use it to share my ideas and to record them for easy search later if i need to refresh myself with some concepts/ideas.
if you are interested in commenting on this blog, you can send me an email and i will approve you. unfortunately this blog gets almost 100 spam comments a month, and its a pain to go through them. my email address is not < moc.liamg@nedeht.fiel >, because it’s backwards! just rearrange the letters and you will have the correct address. thank you!
for a project i did with a tour company, i needed to create images of chinese characters. here’s how i created the 100+ images and optimized them with imagemagick.
the basic format of the command is:
convert -font [chinese font] -pointsize [font size] label:[chinese text] [output image]
lets try it out with these settings: 300 size, character 天:
convert -font bkai00mp.ttf -pointsize 300 label:天 tian-pt300.jpg
jpg looks good but the file size is 7865 bytes (over 7 THOUSAND bytes!). we can do better.
convert -font bkai00mp.ttf -pointsize 300 label:天 tian-pt300.gif
just by using a gif, we go to 4039 bytes (that’s 49% smaller). the image is really just shades of black, we can reduce the colors to make it smaller still:
convert -font bkai00mp.ttf -pointsize 300 -colors 4 label:天 tian-pt300.gif
then by changing the colors down to 4, it reduces the size to 1161 bytes.
thats 60% smaller than the unmodified gif and 80% smaller than the jpg.
we could go a step further and make it monochromatic:
convert -font bkai00mp.ttf -pointsize 300 -colors 2 label:天 tian-pt300.gifi also tried with png’s, but they ended up being slightly larger than the gifs, with the same quality.
AND FINALLY!!!! (!!!)
a python script to tie it all together. supply it with a tab seperated file of chinese and pinyin (or a filename) and it will render them all for you. be sure to check the file for things like the chinese font to use and font size.
heres some tricks i use imagemagick to create an interesting look that has light vignetting, high contrast, a glowing look, and retro white borders.
first, make a vignette.
sorry, i lost the command i used to make this. will update later.
for the initial effects:
convert [file] [vignette] -sigmoidal-contrast 7,50% -modulate 95,70,105 -compose pegtop_light -composite [output]
then the border
convert [file] -bordercolor white -border 20 [output]
here’s the original:
and processed:
its not 100% done, but complete enough. the vignetting on the stone floor looks a little fake, but alright. in photoshop you could do some manual touchups, but overall i think its good. the commands are set up in such a way that you can do the same set of effects to a group of images. for a project i worked on with a tour company, i was able to do a set of about 50 photographs in 5 minutes with these effects. not too shabby.
to do this in batch, its best to make the images the same size, then create a vignette mask that is the same size as your images. basically, its just a png with dark edges and a transparency channel. then you can reuse the vignette on the other images, instead of creating one for each image. saves a lot of processor time.
for file in *; do name=$(basename $file .gif); convert $file -crop 18×100+0+0 +repage $name-left.gif; done
convert -size 20×100 xc:none -fill red -draw ‘rectangle 19,100 20,0′ -channel A -blur 0×8 -alpha Set fade.png
convert -compose Over {background} fade.png -composite {new filename}
finally:
for file in *; do name=$(basename $file .gif); convert -compose Over $file fade.png -composite $name-faded.gif; done
new update on 360 connect. fixed a problem where connection would leak, causing problems when the 360 actually connected. fixed an issue with ssh, and finally, made the output nice and pretty.
udp still doesn’t tunnel.
360 connect is a python script that configures your linux computer to act as a wireless bridge for your xbox 360 game system. it also can be used to forward the connection over ssh or socks. while i’ve only tested with my 360, there is no reason why it shouldn’t work for other game systems or computers.
have fun!
i am releasing a tool i use to connect my xbox 360 to a wireless lan. i wrote it over the past couple weeks and would like to share it with anyone interested. it allows you to connect your xbox onto a wireless lan using a spare computer/laptop without needing to buy a wireless adapter for the xbox 360. another cool feature is the ability to tunnel the connection (tcp portion) through a ssh connection. this is the first release, and currently the biggest missing feature is the ability to tunnel the udp packets. this is a limitation of all ssh tunnels, however. i’ve used it a few times (i don’t have much time for games).
to get started you will need a linux computer. if you don’t want to sacrifice a computer, you can try some of the bootable distributions such as knoppix, puppy linux, dsl, and slax. put the script and other files on a usb stick. if you want to use this, but have problems, just let me know, i would be happy to help!
if you are using windows, its possible to use vmware to host a linux installation to use this. who wants to try it? =)
and finally, the link:
http://leif.freeshell.org/code/xbox-connect.tgz
There really is no name for this thing. I would have used “pyfighter”, but it was already taken.
Cool Stuff:
* Attack Holds (see below)
* Fluid controls with combos
* Cancels (smooth transition between animations)
* Sounds ripped from enter the dragon, like IK)
* Recording input for playback later
Combos and special moves ==================
LK, MK, HK, HK => Roundhouse Kick (hit the buttons quickly) J, K => Jumping Kick (hit any kick during the jump) Back, J => Backflip Forward, J => Frontflip
P1 Default keys: Q: LK W: MK E: HK A: Block* D: P F: (F)lip. Turn character around. Up: Jump Down: Crouch. (try kicking)
Attack Holds In the original IK, attacks could be “held” on the attack frame. This is also implemented here by holding down that attack button.
Characters can be modified and animations are pretty easy to create. Open the “anim.def” files in the “fighters” folder to check it out.