UnityLobby - Page 22

UnityLobby

Discuss everything related to running Spring on your chosen distribution of Linux.

Moderator: Moderators

Locked

What would u like to see implentent next (after next release should be tomorrow or day after at most)???

Poll ended at 20 Jul 2006, 01:04

Direct IP Multiplayer Games
7
54%
Chatroom (chat only for the moment)
1
8%
More Options for Configure Section
2
15%
More Options for Skirmish Section i.e colors teams spectators etc
3
23%
 
Total votes: 13

hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

updated:

Its mainly because code for
Lobby Protocol CLIENTSTATUS
Updates from server about user status.
i.e if user goes afk / present / ingame / or advances in rank

Instead of scaning all of

Code: Select all

self.lobby_channel_users[X]
self.battle_liststore
for the user.

Get channels user is in, from self.userlist[X].listChannels()
This way will only need to updating self.lobby_channel_users[X] or/and self.battle_liststore.

Alot of clientstatus commands are send to lobby client from server. So worth the extra work keeping track.
imbaczek
Posts: 3629
Joined: 22 Aug 2006, 16:19

Post by imbaczek »

wrt wine, I was hoping that merely generating required commands in script.txt and being able to exec 'wine spring.exe -whatever -options -needed' would suffice.
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

  • 1/ Battle Code is not finished yet. Almost done, want to fix up some UI things first for Battle Code i.e gtk.CellRenderCombo to Battle gtk.TreeView first.
    Before i add code to update battle values.
    Thus atm, no way to generate your script.txt for online.

    2/ Falls under unneeded extra bloat code imo.
    Be alot better to add windows code for registry options. And just run it inside wine if u want.

    3/ Will just split up linux userbase. Between wine & or pure linux.
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

Sry about lack of development, been busy lately
But will try & have basic multiplayer working this weekend.
Not to much left todo for it *crosses fingers*.

If anyone has any patchs ready post here or pm plz so can get them added in aswell.

edit:- Also uf anyone knows of missing options (i.e spring options i.e resolution) plz post here so i will know of them & remember to code them in aswell.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

Made some minor changes to Battle.py so Unity doesn't crash when a user doesn't have any maps or mods installed (remember to import sys):

Code: Select all

map_treeselection = self.map_treeview.get_selection()
map1 = self.map_liststore.get_iter_first()

if (map1 == None):
	print "error: no maps found in" + self.ini.get(self.profile, 'SPRING_DATADIR') + "/maps"
	sys.exit(1)
else:
	map_treeselection.select_iter(map1)

Code: Select all

mod_selection = self.mod_treeview.get_selection()
mod1 = self.mod_liststore.get_iter_first()

if (mod1 == None):
	print "error: no mods found in" + self.ini.get(self.profile, 'SPRING_DATADIR') + "/mods"
	sys.exit(1)
else:
	mod_selection.select_iter(mod1)

(EDIT) Also fixed a few "local variable referenced before assignment" errors in GUI_Lobby.py::get_default_lobby_server():

Code: Select all

server_list = self.lobby_ini.sections()

if (len(server_list) > 0):
	server = server_list[0]
	port = self.lobby_ini.getint(server, 'Port')
	username = self.lobby_ini.get(server, 'UserName')
	password = self.lobby_ini.get(server, 'UserPassword')

	i = 0
	while (i < len(server_list)):
		if server_list[i] == 'COLORS':
			server_list.pop(i)
		else:
			i = i + 1

	for i in range(0, len(server_list)):
		default = self.lobby_ini.get(server_list[i], 'Default', 'No')
	
		if default == 'Yes':
			server = server_list[i]
			port = self.lobby_ini.getint(server_list[i], 'Port')
			username = self.lobby_ini.get(server_list[i], 'UserName')
			password = self.lobby_ini.get(server_list[i], 'UserPassword')
			break
	
	return server, port, username, password
else:
	print "error: no servers present in list\n"
	sys.exit(1)
Those sys.exit() calls should of course be replaced by better exception handling at some point.

As well, I am getting a whole bunch of "failed to open file" runtime exceptions from GUI_Lobby.py::clients() and GUI_Lobby.py::joined() which apparently look for the files "EU.png" and "XX.png" and die when they don't find them (since neither is actually present in resources/flags), and yet another "local variable referenced before assignment" from GUI_Lobby::left() that I've fixed below:

Code: Select all

def left(self, command):
	try:
		channel_index = -1

		for i in range(0, len(self.lobby_channel_names)):
			if (command[0] == self.lobby_channel_names[i]):
				channel_index = i

		if (channel_index >= 0):
			iter = self.lobby_channel_users[channel_index].get_iter_first()

			while (iter != None):
				username = self.lobby_channel_users[channel_index].get_value(iter, 0)
				if (username == command[1]):
					gtk.gdk.threads_enter()
					self.lobby_channel_users[channel_index].remove(iter)
					gtk.gdk.threads_leave()
					break

				iter = self.lobby_channel_users[channel_index].iter_next(iter)
	
			text = ''
			for i in range(2, len(command)):
				text = text + ' ' + command[i]

			text = '* ' + command[1] + ' has left ' + command[0] + ' (' + text[1:] + ')'
			self.UpdateTextbufferChannelChat(command[0], None, text, "Leave")
keithjr
Posts: 110
Joined: 30 Jun 2006, 18:45

Post by keithjr »

I just compiled everything from the tagged 0.73b1 release, and UnityLobby gives me the following error after the profile selector goes away:

Code: Select all

  File "/home/keithjr/.spring/UnityLobby/client/main.py", line 44, in ?
    from Battle import battle
  File "/home/keithjr/.spring/UnityLobby/client/Battle.py", line 37, in ?
    import Image
ImportError: No module named Image
Is the version of Unity in the tagged branch functional?
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

U need Python Imaging Library small library for python to generate images.
Package could be called
  • Python Imaging Library
    PIL
    python-imaging
    etc
depending on distro
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Post by BrainDamage »

when i run main.py i got this error message (i do have copied unitsync.so & i do have PIL & i wrote the paths into global.py)

unitsync: Unitsync assertion failed: tools/unitsync/unitsync.cpp:638: Call InitArchiveScanner before GetPrimaryModCount.
python: tools/unitsync/unitsync.cpp:638: int GetPrimaryModCount(): Assertion `archiveScanner && hpiHandler' failed.
Abortied

any ideas?
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

@ Brain Damage Sounds like u are using an old version of taspring before the changes to unitsync. Maybe u are using an old svn checkout or debspring (hasnt been updated in awhile).

If u can get a newer version of spring would be best.
But if u want grab an older version of UnityLobby was called SpringGUI i.e @ http://taspring.clan-sy.com/phpbb/viewt ... =springgui

This is older GUI version of UnityLobby with no lobby chat.

@ Everyone else Will upload newer version tomorrow
User avatar
BrainDamage
Lobby Developer
Posts: 1164
Joined: 25 Sep 2006, 13:56

Post by BrainDamage »

i am using sources from svn, revision 2685 (most recent), updated it today again & i still have the same error
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

@ Kloot
Completey missed your how post after u edited it :(

Have a look @ code it a sec. Maybe add a GUI Dialog box with error when no server is setup. As for missing flags :/

Guess its time to add auto-updating think i talk to Betalord about it i.e does he auto update flags via Lobby Server or check web for newer flags when he updates.
malric
Posts: 521
Joined: 30 Dec 2005, 22:22

Post by malric »

I tried to use the last svn version and I'm not sure if I did something wrong or this is how it is expected to behave.

So:
- the windows are always created to small (even after I enlarge them, at the next restart there are small again)
- in lobby preferences, I can choose from the list in the left just: Colors, Add Lobby and List Lobby.
- can't create battle on the server for 0.74 (cheetah.sentvid.org)
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

  • Havent got around to fixing UnityLobby for remembering window sizes..

    Didnt want to code in rest of battle code till i got comboboxs to work in Battle List. Just fixing the combo code up atm

    Battle is incomplete atm, just allows to create battles atm. Not to start them etc... still afew bits of code todo. But mostly there now
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

@Kloot
As for channel been referenced before be assigned it should never happen. And if it does something went wrong in the logic of the code.

CHANNEL NAME = command[0]
USER = command[1]

First it looks for CHANNEL NAME in self.lobby_channel_users
When found channel_index is assigned its value

It then scans self.lobby_channel_users[channel_index] for USER
Removes USER from self.lobby_channel_users[channel_index] if found
Updates Channel Text to say user has left channel.

It should never occur that a user has left a channel that client didnt know was in channel. And if it does i rather have client choke & die plainfully so i am aware there is a bug elsewhere in the code.




Also for country flags got XX off from Betalord & gonna use it aswell if any flag is not found same as TASClient does.
pythonhead
Posts: 1
Joined: 12 Oct 2006, 19:11

Post by pythonhead »

I'm trying to get a skirmish started. Using unity-lobby I can get a game started with some AI's, but the other commander just sits there, doesn't start building anything, or the game crashes after the 3,2,1 countdown with no error message in the console.

I'm using your Gentoo ebuild, Hollowsoul, and have had these results for the last couple weeks, re-emerging it every couple days and testing it.

Are skirmish games possible with unity-lobby at this point or is this a bug?

I've got this in ~/.spring/infolog.txt
Using read-write data directory: /home/rob/.spring/
Using read-only data directory: /usr/share/games/taspring-linux-svn/
Using read-only data directory: /var/tmp/portage/games-strategy/taspring-linux-svn-0.72-r3/image///usr/share/games/taspring-linux-svn/
Map: SmallDivide.smf
Mod: "AASS223.sdz" from AASS223.sdz
Number of damage types: 41
TA Spring 0.74b1
Player Player joined as 0
rts/System/Platform/Linux/SoLib.cpp:41: SoLib::FindAddress: /usr/share/games/taspring-linux-svn/AI/Bot-libs/AAI.so: undefined symbol: IsCInterface
/usr/share/games/taspring-linux-svn/AI/Bot-libs/AAI.so has C++ interface
own3d
Posts: 129
Joined: 25 Aug 2006, 16:31

Post by own3d »

Have you tried checking it out from SVN then compiling it?
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

/var/tmp/portage/games-strategy/taspring-linux-svn-0.72-r3/image///usr/share/games/taspring-linux-svn/
U can ignore that line the build for spring remembers the directory it was compiled & installed to. Its basicly a gentoo / spring quirk.

I really need to update ebuild been busy lately, try using a older checkout i.e

Code: Select all

ESVN_OPTIONS="-r <insert number from working revision here>" emerge taspring-linux-svn
try 2748 or 2357

If AI doesnt anything & sits there some AI's get stuck on certain maps.
type
  • .cheat
    .teamX ( where X is team number )
    move AI comander
    .teamY ( where y is your team number)
This is just to get AI commander to move & get it unstuck.

Just after updating gentoo here & will upload newer code with some of Kloot fixes & GUI changes i.e combobox for side selection in Battle Screen & saving window sizes tomorrow.

Will try & also update ebuilds aswell. i.e newer release one, think the svn is ok though. Havent test it though.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

@hollowsoul:

The problem with those "variable referenced before assignment" errors isn't what can/should and can't/shouldn't happen, it's that they're bonafide syntactic show-stoppers. Take for example GUI_Lobby.py::get_default_lobby_server():

Code: Select all

if default == 'Yes':
       server = server_list[i]
       port = self.lobby_ini.getint(server_list[i], 'Port')
       username = self.lobby_ini.get(server_list[i], 'UserName')
       password = self.lobby_ini.get(server_list[i], 'UserPassword')
       break

** return server, port, username, password
The way you've written this (and the other examples) means that the Python interpreter sees the line prefixed by a '**' and realizes it might not be valid because the line contains references to variables that POSSIBLY get assigned in the preceding if-statement, but NOT if that if-statement evaluates to false, in which case the return values will be undefined garbage which Python 2.4.3 warns you about in the form of a crash:

Code: Select all

Traceback (most recent call last):
  File "UnityLobby/client/GUI_Lobby.py", line 2295, in Connection
    server, port, username, password = self.lobby_preferences.get_default_lobby_server()
  File "UnityLobby/client/GUI_Lobby.py", line 581, in get_default_lobby_server
    return server, port, username, password
UnboundLocalError: local variable 'server' referenced before assignment
I don't know the version of the interpreter you have, but if it accepts code-structures like that I don't think I should upgrade mine :wink:
hollowsoul
Posts: 665
Joined: 06 Jun 2006, 19:49

Post by hollowsoul »

@ Kloot
Nothing wrong with the code except it assumes server is already configured...

And doesnt catch when server is not configured i.e
Ideally need some sort of GUI wizard to guide user through configuring server. i.e gtk.Assistant.
Which was another reason i upped requirement to newer gtk

quick example i found via google

Code: Select all

#!/bin/env python



import gtk



class FunkyAssistant(gtk.Assistant):

    def __init__(self):

        gtk.Assistant.__init__(self)



        self.connect('delete_event', self.cb_on_delete)

        self.connect('close', self.cb_close)



        # Construct page 0

        vbox = gtk.VBox(False, 5)

        vbox.set_border_width(5)

        vbox.show()

        self.append_page(vbox)

        self.set_page_title(vbox, 'Page 0: Howto do absolutely nothing useful')

        self.set_page_type(vbox, gtk.ASSISTANT_PAGE_CONTENT)



        label = gtk.Label("Press the Execute button below to simulate some work. This enables the Forward button when done...")

        label.set_line_wrap(True)

        label.show()

        vbox.pack_start(label, True, True, 0)



        button = gtk.Button(stock=gtk.STOCK_EXECUTE)

        button.connect('clicked', self.cb_do_something)

        button.show()

        vbox.pack_end(button)



        # Construct page 1

        # As this is the last page needs to be of page_type

        # gtk.ASSISTANT_PAGE_CONFIRM or gtk.ASSISTANT_PAGE_SUMMARY

        label = gtk.Label('Thanks for using FunkyAssistant!')

        label.set_line_wrap(True)

        label.show()

        self.append_page(label)

        self.set_page_title(label, 'Page 1: byebye')

        self.set_page_type(label, gtk.ASSISTANT_PAGE_SUMMARY)



        self.show()



    def cb_on_delete(self, widget, event):

        gtk.main_quit()



    def cb_do_something(self, button):

        self.set_page_complete(button.get_parent(), True)



    def cb_close(self, assistant):

        self.emit('delete_event', gtk.gdk.Event(gtk.gdk.NOTHING))



if __name__ == '__main__':

    win = FunkyAssistant()

    win.show()

    gtk.main()

Feel free to finish off GUI code for missing parts. As gtk & getting GUI to behave like u imagine is a pain in the ****.

What i am working on since yesterday
Done -> , added cellrenderercombo for Battle gtk.TreeView for side selection. Wanted to get done before i worked on rest of battlecode
Nearly done -> atm add XX.png flag & also support for loading XX.png if map is missing.

Basicly if u want to bug me on public forums about coding dont, or take it in private. From my point of view am getting hounded over code that i havent got around to finishing, and there is alot.

Or offer a code solution that doesnt involve sys module & exiting program with a console warning.


**********************

Also difference between our coding is i dont initialize every variable if there is no need to. Just wastes processing time imo. I do know coders off course who initialise every variable. But dont see us giving grief to each other over minor coding differences.

Also if it bails then it exposes a bug deeper in code or in coder's understanding of the logic in the code.

And i dont care about bonafide syntactic show-stoppers if i aware of problem & will get around to adding code to it when i get the free time.

Lastly if u dont like how its coded & keep pointing out code mistakes in your point of view feel free to start your own or fork the current code its gpl 2 after all.

But for arguement sack lets see what needs coding / polishing. Before u bug me on public forums again about something u found.
Add GUI wizards

Catching lack of mods / maps via unitsync <since there can be multiple datadirs>. Also future proofs code to changes in future if changes to unitsync handling of datadirs

Catching multiple maps in archive & tell user nolonger supported. And option to remove the offending maps if possible.

Finish off code for automatic UnityLobby Configure i.e so package maintainers can add system file that will run by default on first run of app. So user doesnt need to know where spring is installed etc.

Add Code for autoupdating via Lobby, or hopefully i get some cash for sourceforge so dont need to bug Betalord for lobby server version update to get clients to check for updates.

Update popup dialog for hosting as its ulgy imo

Update OPENBATTLE for new server

Rest of Lobby Protocol

Finish Lobby Options

Add support for remembering window sizes again

Add support for unit limitations, hosting / playing replays

Add threaded code to monitor if user is ingame playing i.e for rankings & battlecode

Add file / directory checking for Setup Profile for UnityLobby to help warn user if types an incorrect path etc..
Now for rest of today after this lengthly post to defend myself on public forum is add ram / dvd burner to friends machine. Go out.
Replace 2x100gb hd on my machine with 350gb. Install win + linux.
Move 100gb to server & 100gb to another machine. Put off resizing partations till tomorrow.
Kloot
Spring Developer
Posts: 1867
Joined: 08 Oct 2006, 16:58

Post by Kloot »

Fine then, no more reports of crashes that I DO NOT KNOW you know about and plan to fix, no more anything. I don't submit these to attack you, and I sure as hell don't submit them to get that kind of response.
Locked

Return to “Linux”