Author Topic: Glest with observers  (Read 16075 times)

PolitikerNEU

  • Guest
Glest with observers
« on: 23 August 2009, 08:33:33 »
Hello everyone, I made a "hack" to allow glest to have observers.

Code: [Select]
[url=http://billhome.at/glest/glestf.zip]http://billhome.at/glest/glestf.zip[/url]
You can now choose a team "Observer" (you have to add the Observer-String to your .lng or it will appear as ???Observer???) which doesn't play but has no fog of war.

There are many flaws including incorrect handling of <4-Player maps, the player taking a slot and the observer always getting the "You-Lose"-Messagebox instead of a neutral game-end-messagebox.

EDIT: I have updated the zip to fix the Mouse-movement bug

EDIT II: Fixed the missing #include <cstdio>

EDIT III: Glest is dead ==> used megaglest (no, I won't update it for each megaglest version)

Patch to megaglest (Rev 159):
Code: [Select]
http://billhome.at/glest/observer_hack_megaglest.patch
Patched source folder (Rev 159)
Code: [Select]
http://billhome.at/glest/observer_hack_megaglest_source_159.zip
The patched glest binary (Ubuntu 10.04, 32bit)
Code: [Select]
http://billhome.at/glest/glest.bin
« Last Edit: 10 April 2016, 15:40:25 by filux »

wciow

  • Behemoth
  • *******
  • Posts: 968
    • View Profile
Re: Glest with observers
« Reply #1 on: 23 August 2009, 12:28:19 »
Awesome, hopefully this can make it into the next release of GAE  :)
Check out my new Goblin faction - https://forum.megaglest.org/index.php?topic=9658.0

Platyhelminth

  • Guest
Re: Glest with observers
« Reply #2 on: 24 August 2009, 17:40:13 »
This source was not complete and may not allow win to compile:

here is the complete source (with the hack) :
Code: [Select]
http://billhome.at/glest/glest.zip
« Last Edit: 10 April 2016, 15:40:58 by filux »

Omega

  • MegaGlest Team
  • Dragon
  • ********
  • Posts: 6,167
  • Professional bug writer
    • View Profile
    • Personal site
Re: Glest with observers
« Reply #3 on: 1 September 2009, 18:06:58 »
Fantastic!

But what about windows?!?

It would need more bug testing as well, but regarless, that is a good idea, and might be great for learning sessions. For example, someone could teach someone how to beat ultra AIs while the other guy spectators.
Edit the MegaGlest wiki: http://docs.megaglest.org/

My personal projects: http://github.com/KatrinaHoffert

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Glest with observers
« Reply #4 on: 1 September 2009, 18:20:04 »
But what about windows?!?

What about it!
Get the Vbros': Packs 1, 2, 3, 4, and 5!

Platyhelminth

  • Guest
Re: Glest with observers
« Reply #5 on: 1 September 2009, 18:42:15 »
But what about windows?!?

Every one who knows how to compile in windows is welcome to do it if he wants.

assassin

  • Guest
Re: Glest with observers
« Reply #6 on: 1 September 2009, 19:36:40 »
Yeah, why do windows users expect everything pre-compiled?

Hectate

  • Guest
Re: Glest with observers
« Reply #7 on: 1 September 2009, 21:15:36 »
Be cause we either don't know how, don't feel inclined to learn, or don't care about it if we have to put an effort into it  ;D

Seriously though, I haven't taken the time to practice compiling myself, although I have successfully in the past with proper instructions.

assassin

  • Guest
Re: Glest with observers
« Reply #8 on: 2 September 2009, 07:42:59 »
there is something in the glest wiki about compiling glest in windows, why don't you look there?
What annoys me is the way people go "Oh look it's some C++ code! It must be for linux users because we windows users are above compiling"

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Glest with observers
« Reply #9 on: 2 September 2009, 09:07:13 »
linux users just need to type 'jam' to compile.
If they are missing any deps, they can easily be found with their package manager, and will be installed where the build environment (Jam) will see them.

windows users don't generally have a compiler, even if they did Glest 3.2.2 does not come with any project files.
deps are not so easy to get, they have to be found individually, occasionally built from source, and the files put in the right place once obtained.

That said, I see no reason why PolitikerNEU should provide windows binaries, he after all is a linux user, and he too has no project files for windows.

Ps; nice hack :)
Glest Advanced Engine - Code Monkey

Timeline | Downloads

assassin

  • Guest
Re: Glest with observers
« Reply #10 on: 2 September 2009, 09:14:44 »
Yeah compiling on windows is harder, but not impossible  :-\

ultifd

  • Airship
  • ********
  • Posts: 4,443
  • The Glest Video Guy :) The one and only. :P
    • View Profile
    • My Youtube Channel
Re: Glest with observers
« Reply #11 on: 16 March 2010, 03:05:37 »
Sorry, I know this is an OLD topic, but...  ::)
Since this would be helpful...   :)
Can anyone compile the files for Windows...  :bomb:  :thumbup:
thanks.  :O

John.d.h

  • Moderator
  • Airship
  • ********
  • Posts: 3,757
  • I have to go now. My planet needs me.
    • View Profile
Re: Glest with observers
« Reply #12 on: 17 March 2010, 08:00:00 »
I rarely ever read the multiplayer board, but I just happened to come across this topic, and I think it's a great idea.  Specifically, this could allow recordings of multiplayer battles and (other) fun tournament-related stuff.

jda

  • Guest
Re: Glest with observers
« Reply #13 on: 17 March 2010, 11:32:12 »
Could not get this to compile on Ubuntu Linux 9.10 Karmic Koala, 32 bit, neither with PolitikerNEU's nor with Platyhelmith's sources. :(

Here is the output of running jam (after ./configure of course) on Platyhelith's source:
Code: [Select]
...found 509 target(s)...
...using 44 temp target(s)...
...updating 22 target(s)...
C++ ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/platform/posix/socket.o
shared_lib/sources/platform/posix/socket.cpp: In member function ‘void Shared::Platform::ClientSocket::connect(const Shared::Platform::Ip&, int)’:
shared_lib/sources/platform/posix/socket.cpp:228: error: ‘sprintf’ was not declared in this scope
shared_lib/sources/platform/posix/socket.cpp:229: error: ‘stderr’ was not declared in this scope
shared_lib/sources/platform/posix/socket.cpp:229: error: ‘fprintf’ was not declared in this scope

    g++ -c -o ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/platform/posix/socket.o  -DPACKAGE_NAME="glest" -DPACKAGE_TARNAME="glest" -DPACKAGE_VERSION="3.1.2" -DPACKAGE_STRING="glest 3.1.2" -DPACKAGE_BUGREPORT="matze@braunis.de" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_POSIX_SOCKETS=/**/ -DX11_AVAILABLE=1 -DHAVE_GLOB_H=1 -DHAVE_SYS_IOCTL_H=1 -DUSE_SDL=/**/ -DHAVE_PTHREAD=1 -I. -I/usr/include/SDL -D_GNU_SOURCE=1 -D_REENTRANT -pthread -pthread     -I/usr/include/lua5.1 -Ishared_lib/sources/../include/platform/sdl -Ishared_lib/sources/../include/platform/posix -Ishared_lib/sources/../include/util -Ishared_lib/sources/../include/graphics -Ishared_lib/sources/../include/graphics/gl -Ishared_lib/sources/../include/sound -Ishared_lib/sources/../include/sound/openal -Ishared_lib/sources/../include/xml -Ishared_lib/sources/../include/glew -Ishared_lib/sources/../include/lua   -O3 -DNDEBUG shared_lib/sources/platform/posix/socket.cpp

...failed C++ ./build/i686-pc-linux-gnu/optimize/shared_lib/sources/platform/posix/socket.o ...
...skipped libglestlib.a for lack of libglestlib.a(socket.o)...
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/types/object_type.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/types/command_type.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/types/element_type.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/types/unit_type.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/world/time_flow.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/world/tileset.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/world/water_effects.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/world/unit_updater.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/world/surface_atlas.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/world/minimap.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/world/map.o
glest_game/world/map.cpp: In member function ‘void Glest::Game::Map::load(const std::string&, Glest::Game::TechTree*, Glest::Game::Tileset*)’:
glest_game/world/map.cpp:124: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glest_game/world/map.cpp:148: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glest_game/world/map.cpp:149: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glest_game/world/map.cpp:162: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glest_game/world/map.cpp:172: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glest_game/world/map.cpp:182: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/world/scenario.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_game/world/world.o
...skipped glest for lack of libglestlib.a...
MkDir1 ./build/i686-pc-linux-gnu/optimize/glest_map_editor
C++ ./build/i686-pc-linux-gnu/optimize/glest_map_editor/renderer.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_map_editor/map.o
glest_map_editor/map.cpp: In member function ‘void Glest::MapEditor::Map::loadFromFile(const std::string&)’:
glest_map_editor/map.cpp:413: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glest_map_editor/map.cpp:424: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glest_map_editor/map.cpp:425: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glest_map_editor/map.cpp:432: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glest_map_editor/map.cpp:439: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
glest_map_editor/map.cpp:447: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’, declared with attribute warn_unused_result
C++ ./build/i686-pc-linux-gnu/optimize/glest_map_editor/program.o
C++ ./build/i686-pc-linux-gnu/optimize/glest_map_editor/main.o
...skipped glest_editor for lack of libglestlib.a...
...failed updating 1 target(s)...
...skipped 3 target(s)...
...updated 18 target(s)...
No executables are found afterwards. :(

Anyone got a clue?

Yggdrasil

  • GAE Team
  • Ornithopter
  • ********
  • Posts: 408
    • View Profile
Re: Glest with observers
« Reply #14 on: 17 March 2010, 12:54:30 »
Just add this to posix/socket.cpp, near top:
Code: [Select]
#include <cstdio>
The rest are warnings.

jda

  • Guest
Re: Glest with observers
« Reply #15 on: 18 March 2010, 00:30:01 »
Yep, worked like a charm. Thanks, Yggdrasil. :)

jda

  • Guest
Re: Glest with observers
« Reply #16 on: 26 March 2010, 17:16:31 »
Sorry for DPosting but I wanted to bring the attention back to this...

This is working perfectly ( Platyhelith's source ).
But... it is NOT in GAE.

Is it in Megaglest?It's not in Megaglest either.

This is a really useful feature, both for single/multi player teaching/learning as well a balancing tool (in the likes of the Spectators map Archmage did a while back ago, but honestly IMO, better).

I'd really like to see this implemented somewhere. ;)
It's also, AFAICT, completely unobstrusive of more recent/current developments. ;)

EDIT: I'd forgotten I had already looked for this in Megaglest. ;D
« Last Edit: 26 March 2010, 17:21:43 by jda »

PolitikerNEU

  • Guest
Re: Glest with observers
« Reply #17 on: 26 March 2010, 17:43:29 »
Well _if_ this really doesn't interfere with recent changes you can try to apply the following patch:
Code: [Select]
[url=http://billhome.at/glest/myhacks.patch]http://billhome.at/glest/myhacks.patch[/url] (and fix the thing with stdio afterwards).

I'll try that for megaglest, will edit my post to say whether it succeeds or not.

The main problem is that the code quality is really bad - it was just a quick hack without any "strategy" behind it so there are no chances to include it permanently into megaglest and/or gae.

EDIT: No, it doesn't work. Sorry.
« Last Edit: 10 April 2016, 15:41:39 by filux »

jda

  • Guest
Re: Glest with observers
« Reply #18 on: 26 March 2010, 18:04:14 »
Well _if_ this really doesn't interfere with recent changes
Erm, actually, I confess, I was talking out of my arse... ;D
What I meant to say was it does not interfere with current releases logic.
However, megaglest did add four more teams.
And gae, as of 0.2.13-beta1 sets FoW on or off in a per-match basis instead of the previous per-application-session one.
So you might run into some glitches there...?

Quote
you can try to apply the following patch:
Code: [Select]
[url=http://billhome.at/glest/myhacks.patch]http://billhome.at/glest/myhacks.patch[/url] (and fix the thing with stdio afterwards).
Right, maybe I'll try if I find some time. But if you couldn't get it to work... :(

Quote
I'll try that for megaglest, will edit my post to say whether it succeeds or not.
(...)
EDIT: No, it doesn't work. Sorry.
That's a shame. :( Still, I can still use the your original version for balancing purposes. So, your contribution is still very useful! ;)

Thanks. :)
« Last Edit: 10 April 2016, 15:42:57 by filux »

PolitikerNEU

  • Guest
Re: Glest with observers
« Reply #19 on: 26 March 2010, 18:33:05 »
ok, I'll try to apply this patch "manually" to current megaglest. Maybe it gets ready today, maybe not.

jda

  • Guest
Re: Glest with observers
« Reply #20 on: 26 March 2010, 18:37:58 »
Sweet! ;D  :thumbup:

PolitikerNEU

  • Guest
Re: Glest with observers
« Reply #21 on: 26 March 2010, 20:48:24 »
So - i have manually applied the patch and made changes so at least glest is not crashing :-)

I can upload the patch to current megaglest svn and I'll upload the source folder, note that for this version of megaglest, you additionally need to have libpng and libjpeg; if you use Ubuntu 10.04 I could also give you a compiled binary if you want.

I'll edit my post when done.

Note that I "ported" only the observer-thing, not the simulanous keyboard/mouse-Movement things since the camera code changed a lot since I made this hack.

EDIT I: Patch to megaglest (Rev 159):
Code: [Select]
[url=http://billhome.at/glest/observer_hack_megaglest.patch]http://billhome.at/glest/observer_hack_megaglest.patch[/url]
EDIT II: Since the whole folder is too large, here is the patched source folder only:
Code: [Select]
http://billhome.at/glest/observer_hack_megaglest_source_159.zip
EDIT III: The patched glest binary (Ubuntu 10.04, 32bit)
Code: [Select]
[url=http://billhome.at/glest/glest.bin]http://billhome.at/glest/glest.bin[/url]
« Last Edit: 10 April 2016, 15:44:40 by filux »

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Glest with observers
« Reply #22 on: 26 March 2010, 21:33:42 »
Cool, I always wanted observers.  :)
Get the Vbros': Packs 1, 2, 3, 4, and 5!

PolitikerNEU

  • Guest
Re: Glest with observers
« Reply #23 on: 26 March 2010, 21:59:45 »
Well - there is still no windows version, so unfortunately you still can't use it :-) :-(

ElimiNator

  • Airship
  • ********
  • Posts: 3,391
  • The MegaGlest Moder.
    • View Profile
Re: Glest with observers
« Reply #24 on: 27 March 2010, 03:28:09 »
I don't use windows , I have linux.  ;D
Get the Vbros': Packs 1, 2, 3, 4, and 5!

 

anything