Page 1 of 4

Freeciv-tao-client

Posted: Fri Sep 02, 2016 5:34 pm
by Lachu
I would like to develop Freeciv client based on my own I(interface) library called libgreattao. This library separates business logic and view. Libgreattao can run application in one of three modes - gui, text shell and network. GUI mode supports GTK+, Qt and console (CUI) backend. I think Freeciv-tao-client could replace current web client. To use libgreattao application remotely, you should use tao-network-client, which is libgreattao application(wrapper).

My question is - where should I start?

Re: Freeciv-tao-client

Posted: Fri Sep 02, 2016 6:04 pm
by mir3x
Here is first patch how qt-client was created:
https://gna.org/patch/?func=detailitem&item_id=2283

Its just copy of gui-stub dir + some build related stuff.

Re: Freeciv-tao-client

Posted: Fri Sep 02, 2016 6:18 pm
by louis94
If your toolkit is compatible with Gtk or Qt in any way, even if it's with one backend only, start from one of these clients. Else, start from the stub code, but keep an eye on the Gtk client -- it's the API reference.

I think the first thing to do is autoconnecting to a server (-a option). /start the game from the server, then implement the canvas and mapview callbacks to be able to render something. Then only handle unit orders, chat, research, cities, … in the order you like.

You might also want to take a look at the early months of the Qt client in svn history. It could give you a clue on what's needed to get a basic client working.

If you need help understanding something specific, I'll happily take a look -- I'm also learning the code.

Louis

Re: Freeciv-tao-client

Posted: Sat Sep 03, 2016 3:43 pm
by Lachu
First problem is related to missing Makefile.in file. I checked client/gtk3/Makefile.in file existence. It's missing. So what should I do?

Code: Select all



Index: /home/slawomir/Dokumenty/Projekty/trunk/configure.ac
===================================================================
--- /home/slawomir/Dokumenty/Projekty/trunk/configure.ac	(wersja 33744)
+++ /home/slawomir/Dokumenty/Projekty/trunk/configure.ac	(kopia robocza)
@@ -1251,6 +1251,9 @@
 fi
 AM_CONDITIONAL([RULEDIT], [test "x$ruledit" = "xyes"])
 
+AC_SUBST([gui_tao_cflags])
+AC_SUBST([gui_tao_libs])
+AC_SUBST([gui_tao_ldflags])
 AC_SUBST([gui_gtk2_cflags])
 AC_SUBST([gui_gtk2_libs])
 AC_SUBST([gui_gtk2_ldflags])
@@ -1296,6 +1299,7 @@
 AC_SUBST([HOST_PATH_SEPARATOR])
 AC_SUBST([HOST_DIR_SEPARATOR])
 AC_SUBST([FREECIV_STORAGE_DIR])
+AM_CONDITIONAL(CLIENT_GUI_TAO, test, "x$gui_tao" = "xyes")
 AM_CONDITIONAL(AUDIO_SDL, test "x$SDL_mixer" != "xno")
 AM_CONDITIONAL(CLIENT_GUI_SDL2, test "x$gui_sdl2" = "xyes")
 AM_CONDITIONAL(CLIENT_GUI_GTK_2_0, test "x$gui_gtk2" = "xyes")
@@ -1753,6 +1757,7 @@
 	  client/agents/Makefile
 	  client/include/Makefile
           client/gui-sdl2/Makefile
+	  client/tao/Makefile
 	  client/gui-gtk-2.0/Makefile
 	  client/gui-gtk-3.0/Makefile
 	  client/gui-gtk-3.x/Makefile


Re: Freeciv-tao-client

Posted: Sat Sep 03, 2016 3:53 pm
by louis94
Lachu wrote:First problem is related to missing Makefile.in file. I checked client/gtk3/Makefile.in file existence. It's missing. So what should I do?
Makefile.in is generated from Makefile.am. You should modify client/Makefile.am and client/tao/Makefile.am.

Re: Freeciv-tao-client

Posted: Sun Sep 04, 2016 9:11 am
by Lachu
I now get FC_TAO_CLIENT: command not found, but FC_GTK3_CLIENT is nowhere.

Re: Freeciv-tao-client

Posted: Sun Sep 04, 2016 9:25 am
by Lachu
Ok. I've created tao-client.m4 by copy content of existing file for another client, but probably it's requires to configure pkg-config. Am I correct?

Re: Freeciv-tao-client

Posted: Sun Sep 04, 2016 6:34 pm
by Lachu
I've compiled three bytecode files, but there's link problems. Probably ./configure doesn't add -lgreattao switch to gcc command.

Re: Freeciv-tao-client

Posted: Sun Sep 04, 2016 7:25 pm
by louis94
Lachu wrote:I've compiled three bytecode files, but there's link problems. Probably ./configure doesn't add -lgreattao switch to gcc command.
In tao-client.m4, make sure you have:

Code: Select all

gui_tao_libs="$TAO_LIBS"
where TAO_LIBS is the variable set by pkg-config.
In client/Makefile.am, you need:

Code: Select all

freeciv_tao_LDADD = \
# ... a few lines ...
 $(gui_tao_libs)
GNU Autoconf uses bin_PROGRAMS as the list of all programs to compile. Each program name gets normalized ('-' is replaced by '_') and Autoconf uses program_name_SOURCES, program_name_LDFLAGS and program_name_LDADD to generate the appropriate compiler command lines.

Does this help ?
Louis

Re: Freeciv-tao-client

Posted: Mon Sep 05, 2016 4:14 pm
by Lachu
Mistake was in naming convention. In pc file. I put TAO string instead GREATTAO. New problem is I must compile program in client/gui-tao before invoking make in client, but that's not critical bug.