Unitsync documentation?

Unitsync documentation?

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

Post Reply
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Unitsync documentation?

Post by Belmakor »

The link on the wiki (http://spring.osocial.se/db/de7/unitsync__api_8h.html) leads to a "503 Service Temporarily Unavailable" page, and has done so for some time now. I'm wondering if there is an alternative source of documentation on how the unitsync library is designed to be used?
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Re: Unitsync documentation?

Post by Belmakor »

Maybe I should clarify a little.

I know about the API docs inside the unitsync.h file itself. What I'm more interested in are the subtleties of how it should be used.

Is a loaded instance of unitsync thread-safe, or should I lock/unlock before and after each call to the library?

I've discovered that reading most of the map info is quite a time-consuming operation, but getting the list of map names is relatively quick by comparison.

I know that I need to call the Init() function before anything else, but there is an UnInit() function as well. If e.g. a new map is downloaded and put in the maps directory, will the value I have cached for GetMapCount() now be invalid, or will unitsync not know about the new map until UnInit() and then Init() are called again?

Regarding the info map - GetInfoMapSize() returns an int - I presume this is the number of bytes needed to create a buffer of sufficient size for the GetInfoMap() call? What is the "type" info map? The height map - is each entry a float value indicating the height in the same scale as returned by the GetMapMinHeight/GetMapMaxHeight functions?

(I'm only working on map-related functionality right now, so I'm sure I'll run into questions later on with mods, etc).

Thanks in advance for any help :)
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Re: Unitsync documentation?

Post by Belmakor »

Oh, and I take it that client code is responsible for freeing the buffer returned by the GetMinimap call?
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Unitsync documentation?

Post by abma »

what do you want to do?

springlobby has a wrapper for unitsync which should make unitsync thread-safe: https://github.com/springlobby/lsl/blob ... unitsync.h

also it can handle multiple versions of unitsync... dynamicly load/unload it when needed.

api is here:

https://github.com/spring/spring/blob/d ... sync_api.h

(the broken link created some html text from the source file, it didn't contain better/different info)
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Re: Unitsync documentation?

Post by Belmakor »

abma wrote:what do you want to do?
I'm experimenting right now with writing a Swift/Objective-C wrapper to the unitsync library, with the possible eventual goal of writing a native OS X Spring client / lobby.
springlobby has a wrapper for unitsync which should make unitsync thread-safe: https://github.com/springlobby/lsl/blob ... unitsync.h
I'll take a look at that and see what I can learn :)
also it can handle multiple versions of unitsync... dynamicly load/unload it when needed.
I've already got code in my wrapper that can do this :)
api is here:

https://github.com/spring/spring/blob/d ... sync_api.h

(the broken link created some html text from the source file, it didn't contain better/different info)
Ah, I was hoping it had different info. The unitsync_api.h file has already been useful to me, but it is lacking in certain areas.

I also discovered a bug in the documentation: specifically for the GetMinimap call. The documentation states:

Code: Select all

* @param fileName The name of the map, including extension.
This led me to believe that I should supply the value returned by GetMapFileName. However, this is not the case; rather the correct value is the map name (without extension), i.e. the value returned by the GetMapName() call.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: Unitsync documentation?

Post by abma »

Belmakor wrote:I'm experimenting right now with writing a Swift/Objective-C wrapper to the unitsync library, with the possible eventual goal of writing a native OS X Spring client / lobby.
whats wrong with springlobby?

also there is a WIP for an inengine lobby. viewtopic.php?f=64&t=32030
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Re: Unitsync documentation?

Post by Belmakor »

abma wrote:whats wrong with springlobby?
I use Springlobby all the time and I'm thankful it's there. It's currently the only viable option (that I know of) on OS X.

However:
  • there are plenty of usability issues with springlobby on OS X; I personally find the UI design of the lobby frustrating: back in my early Spring days I loved TASclient, but it's Windows-only and I moved to OS X years ago.
  • I was casting around for a project to further my OS X programming skills (I'm a former Java developer turned iOS developer) and this seemed like a good fit i.e. this is a learning project for me.
  • As this is a "for fun"/learning project for me, I'm not keen on spending time wrestling with someone else's well-established and large code-base, especially if it's mostly C++.
also there is a WIP for an inengine lobby. viewtopic.php?f=64&t=32030
Looks interesting! That isn't part of the current development engine, is it? (I haven't seen it in the dev builds I've been running)
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: Unitsync documentation?

Post by CarRepairer »

Perhaps you might like to help in this effort. I was running weblobby on a macbook for a while (unfortunately the current version of spring was not supporting OSX at that time, no idea if it does now).

https://github.com/springweblobby/swl-w ... evelopment
gajop
Moderator
Posts: 3051
Joined: 05 Aug 2009, 20:42

Re: Unitsync documentation?

Post by gajop »

Belmakor wrote:
also there is a WIP for an inengine lobby. viewtopic.php?f=64&t=32030
Looks interesting! That isn't part of the current development engine, is it? (I haven't seen it in the dev builds I've been running)
No it's not.
This is technically an in-game lobby rather than an in-engine one - it's standalone and runs like any other game.
I've been developing it and as abma said, it's still pretty early in the development (not usable), but I'd gladly welcome any outside contribution.
The only caveat is that it requires a special version of spring that contains some changes to allow md5 server login and pr-downloader support which aren't yet ready to be merged upstream.
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Re: Unitsync documentation?

Post by Belmakor »

CarRepairer wrote:Perhaps you might like to help in this effort. I was running weblobby on a macbook for a while (unfortunately the current version of spring was not supporting OSX at that time, no idea if it does now).

https://github.com/springweblobby/swl-w ... evelopment
It's not really the area I want to be playing in at the moment, but thanks for the tip anyway :)
User avatar
Belmakor
Posts: 212
Joined: 16 Nov 2005, 00:01

Re: Unitsync documentation?

Post by Belmakor »

gajop wrote:This is technically an in-game lobby rather than an in-engine one - it's standalone and runs like any other game.
I've been developing it and as abma said, it's still pretty early in the development (not usable), but I'd gladly welcome any outside contribution.
The only caveat is that it requires a special version of spring that contains some changes to allow md5 server login and pr-downloader support which aren't yet ready to be merged upstream.
I think I'll continue playing with what I'm working on, then :)
Post Reply

Return to “Engine”