Jump to content

  • Log In with Google      Sign In   
  • Create Account

cignox1

Member Since 12 Mar 2003
Offline Last Active Dec 17 2013 07:10 AM

Topics I've Started

Pieces movements through graphs (Java)

26 April 2013 - 03:40 PM

Hi all,

I'm developing a board game, kind of chess (Cyvasse, for those who know "A Song of Ice and Fire") and I would like the game to highlight valid target cells when the user select a piece.

Ideally, pieces can move a max distance (say 4), where diagonal steps count as 2. Movements are 'free': as long as they are shorter than max allowed length, a piece can reach its target call the way it wants.

Some cells may contain obstacles, the exact behaviour of which also depends upon the piece.

 

My first idea was to use graphs to compute if a path exists: I build a graph with the cells inside the max distance contraint and then compute the shortest paths between src and target cells. For each of these paths I decide if it is valid (i.e, no obstacles are on the way) and if a valid one is found, I allow the move.

 

First question: is that a good approach to start with?

 

I tried by using the jgrapht library, with the KShortestPaths component. Simply too slow, apparently (several seconds for every target cell).

Better would be to use the Bellman-Ford algo to simply compute the shortest path, but then I should compute valid edges when I build the graph, so tha every path found is a valid move. I'm not sure I can do this though: for example, some pieces cannot cross an obstacle, but they can stop on them. Others can cross an obstacle, but not rest there.

 

I would rather avoid implementing everything by myself if possible, but this could be my only option. Before taking this route, I would like to hear your opinions.

 

Thank you.


PHP Class not found error

20 March 2012 - 04:55 PM

Hi all, in order to improve my PHP knowledge, I'm trying to build a small framework with the goal to use it to develop my music band site.

I layed out a simple configuration class (just a placeholder actually):
<?php
/*
Class to handle all application wide Quarkweb configuration parameters.
*/
namespace quarkweb;

class QWConfiguration
{
protected static $mClassName = "QWConfiguration"; //By changing this before the configuration is read, an application can force the use of a specified configuration class
public function __construct()
{
//initialize the values
}

public static function getClassName()
{
return QWConfiguration::$mClassName;
}
public static function setClassName($aClassName)
{
QWConfiguration::$mClassName = $aClassName;
}

static public function getConfiguration()
{
$aClassName = QWConfiguration::getClassName();
$aClass = new $aClassName();
return $aClass;
}
}
?>


The idea is that it should work as a simple factory: the application sets the desidered class name for its own configuration and at the proper time an instance will be created. I've used the dynamic class instancing elsewhere without issues.
But I get the following error:

Fatal error: Class 'QWConfiguration' not found in C:\inetpub\wwwroot\quarkweb\core\qwconfiguration.php on line 28

I bet this is one of those errors that any half-experienced PHP programmer will spot in two seconds. Any idea?

Thank you!

Windows Vista/7 and services interaction with desktop

12 January 2012 - 10:36 AM

Ok, I know it is generally a bad idea, but before starting to judge, read what follows: :-)

We are using an api to access a DMS. The api uses com and creates small windows when the code issues queries to the server.
Now I have been asked to write a service listening for soap queries. When the service receives a soap call, it performs the relative operation on the server.
The problem is that those operations fail. I suppose that the new services session 0 'feature' prevents the com layer from creating the window object (I'm quite positive that this is the reason, still investigating though), so my question is:

-is there a way to make 'allow service to interact with desktop' work in vista/seven?

In case of a negative answer I could try different options (i.e. the service runs a common app which does the work) but I fear I would most probably face other related issues, so if I can stop that now I would be happier.

Thank you!

Cross platform GUI toolkit

29 December 2011 - 06:25 PM

Hi all, I'm currently thinking to start a new spare time project, and would like to have advices about which GUI toolkit could fit my needs. Up to now, I've considered Qt and wxWidgets, but I'm looking for something more lightweight (if such thing exists). To be honest, I've already tried to set up wxWidgets on Eclipse without luck, so perhaps it is not really what I want :-(

Requirements:
-Should be available on windows and linux (mac would be a welcome plus)
-Lightweight and easy to both install and use (no much time to spend on the project, and would rather spend it on the core than the GUI)
-Based on standard c++

Bonus:
-Python bindings (I might want to add scripting capabilities)
-OpenGL support

Not required:
-I don't need it to look like a native app (no host widgets used under the hood required), as long as all common widgets are provided and the interface is nice to look at.
-I don't need the toolkit to provide other facilities (network/threads/sound/database...): boost and other tools are good enough, and probably even better, and I don't need many other features anyway, since it would be an image manipulation app.

I could consider to use Java, but I'm going to do quite intensive image processing and there are wonderful c/c++ libraries which could help (FreeImage and the like) not to mention the performance issues.
I'm open to suggestions on this as well, though, if you think that a good option would be another language (that is Java: no python, as I'm not good enough with it, and no c#, since .net is only theoretically cross platform :-)

There could be more to say, but let's start with that. Any advice?

Thank you all!

HTML based GUI for desktop applications

30 September 2011 - 01:44 AM

Hi all, I'm just curious: today, html(5), css and javascript with Ajax are really powerful tools to create beatiful and customizable layouts. Wouldn't it be interesting to have all this for desktop applications as well? I mean, the app GUI is just a local 'website', where controls are implemented as javascript components, and layouts as HTML/css pages. An application or os level engine will run the pages and the application interacts through events.

I can think of several interersting benefits of such approach: applications can interact though html pages: serializing GUI elements (i.e. windows) will then be just a matter of sending the related html/javascript code. Applications can host web components, or web sites can host applications components.
100% cross platform gui's.
100% cross language gui's layouts.
Reuse of elements is enhanced thank to the nature of the components and the fact that a simple update of the css can drastically change the aspect.

I think that this is a nice idea to play with, so I'm pretty sure somebody already did that: does someone know of such a tool?

Thank you!

PARTNERS