till now, games::risk was using map files from jrisk. this allowed me to concentrate on the gui and the game experience without having to tackle everything at once.
being a simple format, it was somehow easy to read the maps... but its simplicity has some drawbacks, and for example it's not possible to translate them. therefore, i finally bit the bullet and implemented a format for prisk. basically, information remains the same (such as the mechanism to determine the current country), with one exception: maps are implemented as perl modules. and this allows the use of gettext and other i18n schemes.
this means that maps are now translatable! french translation is of course provided, but help is needed for other languages... (hint, hint)
of course, i wrote an importer to migrate jrisk maps to new prisk format. i also intend to take this opportunity to create some new perl dists with extra maps.
this prisk release shows also a lot of cleanup in the internals, with a partial migration to moose and moosex::poe. using weak_ref for scalar attributes and a tied hash::noref to cache objects allowed to use circular references without having to deal with their problems. finally, prisk is now deferring some module loading to runtime, leading to a faster startup. the changes are plenty, so now is a good time to give it a try! (after v3.112590 has hit your nearest mirror of course)
future releases will continue to see code cleanups and migration to moose. prisk also finally has a configuration system to save user preferences - i "just" need to use this system throughout the code. some dialogs needs also to migrate to prisk's look&feel (thanks tk::role::dialog), and i have some ideas to improve the artificial intelligences & better use poe. not counting other game modes to take into account... oh well, let's say that prisk will keep me busy quite some time! :-)
Showing posts with label games. Show all posts
Showing posts with label games. Show all posts
2011-09-16
2010-05-31
further prisk enhancements
imagine a world map. now show me on the map where china is - easy, uh? where is irkustk? tougher, isn't it? but it remains a region which exists in our world... now imagine we have another map in front of us... a map named godstorm for example... where is thule? or poseidonis?
those questions aren't rethorical, when playing prisk. because, when you exchange 3 cards to get reinforcements, you also get bonuses if you exchange a card representing a country that you own. and if it's easy to check at a glance if you own china when playing classical risk map, it's another challenge to locate thule on godstorm map.
therefore, i'm glad to introduce latest prisk version (3.101510, currently on its way to cpan). in the card window, one can now double-click a card, and this will highlight a country on the big map. this way, you'll know exactly which card to exchange (or what country to invade) in order to maximize your reinforcements. happy invasion!
(remember that i'm always welcoming code contribution or new translations)
those questions aren't rethorical, when playing prisk. because, when you exchange 3 cards to get reinforcements, you also get bonuses if you exchange a card representing a country that you own. and if it's easy to check at a glance if you own china when playing classical risk map, it's another challenge to locate thule on godstorm map.
therefore, i'm glad to introduce latest prisk version (3.101510, currently on its way to cpan). in the card window, one can now double-click a card, and this will highlight a country on the big map. this way, you'll know exactly which card to exchange (or what country to invade) in order to maximize your reinforcements. happy invasion!
(remember that i'm always welcoming code contribution or new translations)
2010-05-24
new continent window for prisk
some further enhancements to prisk: latest version got a brand new continent window, listing the continents, their bonus, and who owns the countries. it also highlights when a continent is totally owned by a player. it is also updated during the game, when players gain and loose countries.
without further ado, here's a snapshot of the new shiny feature:

also new in version 3.101430, the ability to run prisk directly from the checkout. previously one would need to run "dzil run ./bin/prisk" since file::sharedir requires a fully built + installed distribution before finding its stuff. now, prisk detects if it's running in a local checkout, and will bypass file::sharedir.
the code is on github where you can fork it: patches and translations welcome!
without further ado, here's a snapshot of the new shiny feature:

also new in version 3.101430, the ability to run prisk directly from the checkout. previously one would need to run "dzil run ./bin/prisk" since file::sharedir requires a fully built + installed distribution before finding its stuff. now, prisk detects if it's running in a local checkout, and will bypass file::sharedir.
the code is on github where you can fork it: patches and translations welcome!
2010-05-17
games::risk speaks your language!
well, maybe not yet, but very soon - as soon as you'll contribute the translated strings! :-)
those days, i feel like working on prisk, the risk clone that i wrote in perl. i added full internationalization, and contributed the first foreign language (french, as you may have guessed :-) ).
you can contribute translations for your language by forking the project, and then sending a pull request with your changes. it should be quite fast, since it only features 73 strings to translate. you know what to do... :-)
note that i also fixed a crash that was appearing sometimes during game startup. i'll now try to find some time to work on bigger topics, such as sanitizing the whole codebase, or adding features...
those days, i feel like working on prisk, the risk clone that i wrote in perl. i added full internationalization, and contributed the first foreign language (french, as you may have guessed :-) ).
you can contribute translations for your language by forking the project, and then sending a pull request with your changes. it should be quite fast, since it only features 73 strings to translate. you know what to do... :-)
note that i also fixed a crash that was appearing sometimes during game startup. i'll now try to find some time to work on bigger topics, such as sanitizing the whole codebase, or adding features...
2010-01-04
retrospective 2009
2009's over, but the year was quite a busy one for me on the perl front:
- i finally took the time to investigate moose, and decided to port some of my code to use it.
- i discovered dist::zilla, and definitely plan to use it in all my dists.
- i discovered some other cool new perl modules (thanks guys).
- i uploaded some new dists on cpan, including games::pandemic (which i'm quite proud of, even if i need to continue hacking on it).
- i updated & released some of my existing dists.
- i contributed to other projects such as padre, dist-zilla, etc. sending patches is a good way to thank the author for their work.
- it's even easier to contribute with github, which i'm using more and more for my projects (and it's no more slow by now, woohoo!). of course, git is the master piece allowing this easy sharing.
- on mandriva's front, i resurrected parrot rpm, and finally shipped rakudo.
- 2009 was also the year of the great migration to %perl_convert_version
- ... with lots of new perl modules available as rpm (i am managing 450 of them).
- ... and finally i took ownership of perl rpm. (thank you perl5 porters btw for 5.10.1 and the push for next stable version!)
2009-09-21
first external pandemic translation
i'm really happy to release a new pandemic version, namely 1.092640 (that is first release of 264th day of year 2009 for those that skipped previous entry).
beside the introduction of the medic player (which in itself is interesting), it's with great pleasure that i committed a japanese translation that tomita naoki provided me with. thank you tomita for this first external contribution!
so, if you want to contribute, an easy way to start is by providing a translation for your language! of course, any other contribution is also welcome. :-)
beside the introduction of the medic player (which in itself is interesting), it's with great pleasure that i committed a japanese translation that tomita naoki provided me with. thank you tomita for this first external contribution!
so, if you want to contribute, an easy way to start is by providing a translation for your language! of course, any other contribution is also welcome. :-)
2009-09-07
full pandemic stikes, woohoo \o/
erm, not this pandemic, but the pandemic game written in perl...
so yes, i'm happy to report that milestone 1.01 has been reached. indeed, here's what warrants the bump:
however, all in all, i'm quite happy (and proud) of the release. version 1.0 is definitely not the ultimate one, it only means that you can play with it with comfidence.
of course, i'm always eager to have (constructive) feedback2 on it. and if you want to contribute, well, the source is available on github.
[1] in fact, it's 1.000000 (i know it's ugly) since i'm switching to rjbs' versioning scheme: 1.yydddn3. it'll make versioning boring (even if not beautiful).
[2] fan & love mail is ok too :-)
[3] yes, i'm taking every bad habit rjbs has to offer, as long as it helps my laziness. of course, games-pandemic is using the excellent dist-zilla since the beginning.
so yes, i'm happy to report that milestone 1.01 has been reached. indeed, here's what warrants the bump:
- infection rate grows as epidemics strike
- special event: airlift implemented
- special event: forecast implemented
- special event: government grant implemented
- special event: one quiet night implemented
- special event: resilient population implemented
- epidemics now shown in past cards
however, all in all, i'm quite happy (and proud) of the release. version 1.0 is definitely not the ultimate one, it only means that you can play with it with comfidence.
of course, i'm always eager to have (constructive) feedback2 on it. and if you want to contribute, well, the source is available on github.
[1] in fact, it's 1.000000 (i know it's ugly) since i'm switching to rjbs' versioning scheme: 1.yydddn3. it'll make versioning boring (even if not beautiful).
[2] fan & love mail is ok too :-)
[3] yes, i'm taking every bad habit rjbs has to offer, as long as it helps my laziness. of course, games-pandemic is using the excellent dist-zilla since the beginning.
2009-08-28
pandemic nearing v1
so games::pandemic 0.8.0 has just been uploaded on cpan. this release saw lots of improvements:
of course, this does not mean that game is complete and won't be improved after. for example, the startup dialog to choose the game and player roles, ui improvements, etc. will be post 1.x material.
but in the meantime, enjoy 0.8.0, which is already quite interesting to play.
- diseases can be eradicated
- performing infection outbreaks
- detecting game over condition when too many outbreaks
- allowing player to choose which disease to treat in multi-infected cities
- return/escape bindings for dialogs
- tooltips for various game information
- fix unfair epidemic repartition
- fix never-ending too many cards / deal more cards when dropping a card but still being beyond max number of cards
- better dialog for past cards / infections
of course, this does not mean that game is complete and won't be improved after. for example, the startup dialog to choose the game and player roles, ui improvements, etc. will be post 1.x material.
but in the meantime, enjoy 0.8.0, which is already quite interesting to play.
2009-08-22
new pandemic release
games::pandemic 0.7.0 is now on cpan, with a lot of improvements and a crash fix:
- wiping all cubes from a city if a cure has been found for the disease
- reacting to winning conditions
- reacting to game over condition when no more disease cubes
- possibility to see cards already played / discarded
- possibility to see past infections
2009-08-08
epidemics strike in games::pandemic!
games::pandemic 0.6.0 is now on cpan, with a lot of improvements:
- introducing epidemic events - fear! :-)
- closing current game is now supported
- player cards now displayed in a window of their own
- detecting game over condition when no more cards
- sorting cards by type then by disease then by city name
- introducing a new "action" menu, with shortcuts for actions
- actions now independant of buttons / menu for easier reuse
2009-07-18
pandemic turns implemented
so games::pandemic 0.5.0 is now released[0].
the basic game play is now done: besides the player actions, the cards are now dealt and infections propagated. card limit is also implemented, so player can discard them if needed. add to that a bit of ui polishing, and we now have a solid basis on which to build upon...
next releases will see (in no special order):
[0] and without any more warnings, since i spotted a bug in moosex::semiaffordanceaccessor which has been swiftly fixed!
the basic game play is now done: besides the player actions, the cards are now dealt and infections propagated. card limit is also implemented, so player can discard them if needed. add to that a bit of ui polishing, and we now have a solid basis on which to build upon...
next releases will see (in no special order):
- the special cards (including the epidemics)
- end of game conditions (both game-over and win cases)
- more ui polishing (i think the players cards will have their own toplevel)
- easier game play (drag-n-drop on the canvas)
- missing player features (dispatcher, medic)
- missing rule implementation (disease eradication, ...)
- start game dialog
- etc.
[0] and without any more warnings, since i spotted a bug in moosex::semiaffordanceaccessor which has been swiftly fixed!
2009-07-02
perl helps save world pandemic
ok, maybe the title was a bit too much dramatic - especially in those days. :-)
i like playing board games, and my wife and i discovered recently pandemic, from z-man games. it is a tremendous cooperative game, where players allies to eradicate 4 diseases. but the infections spread out, and if you aren't fast enough, you end up with a global pandemic - and loose...
it is really addictive, so i decided to write a perl module games::pandemic implementing a clone of this board game, with all its rules. it was also a good occasion to learn moose, dist::zilla and other modern perl stuff. at least, this goal is already fulfilled! :-)
i'm also using poe and tk (i know, i know). i just published the first public release, version 0.4.0. it already implements all the player actions, and here's a snapshot of a game:

of course it isn't finished, but i'm pretty happy of the result (even if the gui might change in the future). i aim for a v1.0.0 playable alone, and then allow networked game...
the code is available on github if you want to help - even "only" translating strings is welcome!
so, expect to hear more about pandemic on this blog. and while waiting for this perl version to be complete, i recommend you to buy a pandemic board game: you won't regret it...
i like playing board games, and my wife and i discovered recently pandemic, from z-man games. it is a tremendous cooperative game, where players allies to eradicate 4 diseases. but the infections spread out, and if you aren't fast enough, you end up with a global pandemic - and loose...
it is really addictive, so i decided to write a perl module games::pandemic implementing a clone of this board game, with all its rules. it was also a good occasion to learn moose, dist::zilla and other modern perl stuff. at least, this goal is already fulfilled! :-)
i'm also using poe and tk (i know, i know). i just published the first public release, version 0.4.0. it already implements all the player actions, and here's a snapshot of a game:

of course it isn't finished, but i'm pretty happy of the result (even if the gui might change in the future). i aim for a v1.0.0 playable alone, and then allow networked game...
the code is available on github if you want to help - even "only" translating strings is welcome!
so, expect to hear more about pandemic on this blog. and while waiting for this perl version to be complete, i recommend you to buy a pandemic board game: you won't regret it...
2009-05-29
image resizing in perl
perl is really versatile, and can do a lot of things. moreover, you can do it in a lot of different ways. the difficult part being sometimes to choose the way you want to do it...
so i need to resize an image within perl. this is for games::risk, a perl implementation of the famous board game (btw, try it and tell me if you like it!). i want the background image to fit the window size on resize events. of course, i want it to be fast - but i also want something maintainable.
looking on cpan, i found 3 modules: gd, image::magick and image::imlib2. using gd to resize a picture is a nightmare, therefore i ditched it for image::resize which is a convenient wrapper around gd.
here are the needed incantations to resize:
however, image::imlib2 has a drawback: the only way to get back the new image is to save it to a file, where one can get the new image as a scalar directly:
therefore, one must also take this into account in the benchmarking! so here's the latest version of the bench:
and i was quite astonished to see that image::imlib2 is still 2 or 3 times faster that image::magick or image::resize!
so, imlib2 may not the best api around, but sure it's fast...
so i need to resize an image within perl. this is for games::risk, a perl implementation of the famous board game (btw, try it and tell me if you like it!). i want the background image to fit the window size on resize events. of course, i want it to be fast - but i also want something maintainable.
looking on cpan, i found 3 modules: gd, image::magick and image::imlib2. using gd to resize a picture is a nightmare, therefore i ditched it for image::resize which is a convenient wrapper around gd.
here are the needed incantations to resize:
- with imlib2
- with image::magick - note that the operation is done inplace, so one needs to clone the image first to compare the same things.
- with image::resize
my $old = Image::Imlib2->load($src);
my $new = $old->create_scaled_image($w, $h);
my $old = Image::Magick->new;
$old->Read($src);
my $new = $old->Clone;
$new->Scale(width=>$w, height=>$h);
my $old = Image::Resize->new($src);
my $new = $old->resize($w, $h);
however, image::imlib2 has a drawback: the only way to get back the new image is to save it to a file, where one can get the new image as a scalar directly:
- image::resize with $img->jpeg
- image::magick with $img->ImageToBlob
therefore, one must also take this into account in the benchmarking! so here's the latest version of the bench:
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
use Benchmark qw{ :all };
use Image::Size;
use Image::Resize;
use Image::Imlib2;
use Image::Magick;
my $src = "src.jpg";
my $dst = "dst.jpg";
my ($w, $h) = imgsize($src);
my @sizes = (
[10,10], [100,100], [1000,1000],
[640,400], [840,600], [1024,768],
[$w,$h], [$w/2,$h/2], [$w/4,$h/4],
[$h,$w], [$h/2,$w/2], [$h/4,$w/4],
);
my $imlib2 = Image::Imlib2->load($src);
my $resize = Image::Resize->new($src);
my $magick = Image::Magick->new; $magick->Read($src);
foreach my $s ( @sizes ) {
my ($width, $height) = @$s;
say "-> ${width}x${height}";
local $/;
cmpthese( -3, {
imlib2 => sub {
my $img = $imlib2->create_scaled_image($width, $height);
$img->save($dst);
open my $fh, '<', $dst;
return <$fh>;
},
magick => sub {
my $img = $magick->Clone;
$img->Scale(width=>$width,height=>$height);
return $img->ImageToBlob;
},
resize => sub {
my $img = $resize->resize($width,$height);
return $img->jpeg; # $img->png
},
} );
say '';
}
and i was quite astonished to see that image::imlib2 is still 2 or 3 times faster that image::magick or image::resize!
so, imlib2 may not the best api around, but sure it's fast...
Subscribe to:
Posts (Atom)