News:

If you are a developer, please build MegaGlest on your own and get in touch to contribute (or post your patches on the forums).

Main Menu

Glest with observers

Started by PolitikerNEU, 23 August 2009, 08:33:33

PolitikerNEU

Hello everyone, I made a "hack" to allow glest to have observers.

[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): http://billhome.at/glest/observer_hack_megaglest.patch

Patched source folder (Rev 159) http://billhome.at/glest/observer_hack_megaglest_source_159.zip

The patched glest binary (Ubuntu 10.04, 32bit) http://billhome.at/glest/glest.bin

wciow

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

#2
This source was not complete and may not allow win to compile:

here is the complete source (with the hack) : http://billhome.at/glest/glest.zip

Omega

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

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

Platyhelminth

Quote from: omega on  1 September 2009, 18:06:58But what about windows?!?

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

assassin

Yeah, why do windows users expect everything pre-compiled?

Hectate

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

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

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

Yeah compiling on windows is harder, but not impossible  :-\

ultifd

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

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

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:...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

Just add this to posix/socket.cpp, near top:

#include <cstdio>

The rest are warnings.

jda

Yep, worked like a charm. Thanks, Yggdrasil. :)

jda

#16
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

PolitikerNEU

#17
Well _if_ this really doesn't interfere with recent changes you can try to apply the following patch:
[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.

jda

#18
Quote from: PolitikerNEU on 26 March 2010, 17:43:29
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...?

Quoteyou can try to apply the following patch:
[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... :(

QuoteI'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. :)

PolitikerNEU

ok, I'll try to apply this patch "manually" to current megaglest. Maybe it gets ready today, maybe not.

jda


PolitikerNEU

#21
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): [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: http://billhome.at/glest/observer_hack_megaglest_source_159.zip

EDIT III: The patched glest binary (Ubuntu 10.04, 32bit) [url=http://billhome.at/glest/glest.bin]http://billhome.at/glest/glest.bin[/url]

ElimiNator

Cool, I always wanted observers.  :)
Get the Vbros': Packs 1, 2, 3, 4, and 5!

PolitikerNEU

Well - there is still no windows version, so unfortunately you still can't use it :-) :-(

ElimiNator

I don't use windows , I have linux.  ;D
Get the Vbros': Packs 1, 2, 3, 4, and 5!