Spring is running in SMP
Moderator: Moderators
Re: Spring is running in SMP
LOS is represented as a 2D grid per allyteam. That makes it possible, just hard wrt. sync.
Re: Spring is running in SMP
So there is only one LOS object per allyteam? I want to know how the engine works with it. My best guess for how the LOS is calculated would be that the engine first looks at every unit and calculates their LOS, but I still can't understand how that calculation is used. I can see a CLosMap::At function that returns an unsigned short but I don't know what happens after.Kloot wrote:LOS is represented as a 2D grid per allyteam. That makes it possible, just hard wrt. sync.
Re: Spring is running in SMP
Every allyteam has a LosMap, this is basically a 16 bits per "pixel" bitmap.
Every unit adds itself to the LosMap, this is done by raycasting against terrain, and incrementing the pixels of the LosMap for the squares the unit can see. The squares it can see are remembered, to be able to remove the unit even after terrain changes etc. (the raycasting may give a different result then.)
Every unit has an array of bitmasks (losStatus), one for each allyteam. These are regularly updated by reading data from the LosMaps of all allyteams. These bitfields may contain the flags LOS_INLOS, LOS_INRADAR, LOS_PREVLOS and LOS_CONTRADAR. (This is used to tracks things like: "Has the unit ever been in LOS, and has it since then always been in radar?")
When a weapon or unit or the renderer wants to know whether a unit is in LOS of allyteam at, it just checks (unit->losStatus[at] & LOS_INLOS) != 0, instead of using the LosMap for it.
Every unit adds itself to the LosMap, this is done by raycasting against terrain, and incrementing the pixels of the LosMap for the squares the unit can see. The squares it can see are remembered, to be able to remove the unit even after terrain changes etc. (the raycasting may give a different result then.)
Every unit has an array of bitmasks (losStatus), one for each allyteam. These are regularly updated by reading data from the LosMaps of all allyteams. These bitfields may contain the flags LOS_INLOS, LOS_INRADAR, LOS_PREVLOS and LOS_CONTRADAR. (This is used to tracks things like: "Has the unit ever been in LOS, and has it since then always been in radar?")
When a weapon or unit or the renderer wants to know whether a unit is in LOS of allyteam at, it just checks (unit->losStatus[at] & LOS_INLOS) != 0, instead of using the LosMap for it.
Re: Spring is running in SMP
After zerver's patch above posted above:
Code: Select all
Scanning dependencies of target gml
[ 1%] Building CXX object rts/lib/CMakeFiles/gml.dir/gml/gml.cpp.obj
E:\Data\spring\rts\lib\gml\gml.cpp:172: error: no matching function for call to
'gmlSingleItemServer<unsigned int, GLhandleARB (*)()>::gmlSingleItemServer(GLuin
t (**)(), int, int)'
E:\Data\spring\rts\lib\gml\gmlcls.h:875: note: candidates are: gmlSingleItemServ
er<T, C>::gmlSingleItemServer(C, int, int) [with T = unsigned int, C = GLhandleA
RB (*)()]
E:\Data\spring\rts\lib\gml\gmlcls.h:865: note: gmlSingleItemServ
er<unsigned int, GLhandleARB (*)()>::gmlSingleItemServer(const gmlSingleItemServ
er<unsigned int, GLhandleARB (*)()>&)
E:\Data\spring\rts\lib\gml\gml.cpp:173: error: no matching function for call to
'gmlSingleItemServer<unsigned int, GLhandleARB (*)()>::gmlSingleItemServer(GLhan
dleARB (**)(), int, int)'
E:\Data\spring\rts\lib\gml\gmlcls.h:875: note: candidates are: gmlSingleItemServ
er<T, C>::gmlSingleItemServer(C, int, int) [with T = unsigned int, C = GLhandleA
RB (*)()]
E:\Data\spring\rts\lib\gml\gmlcls.h:865: note: gmlSingleItemServ
er<unsigned int, GLhandleARB (*)()>::gmlSingleItemServer(const gmlSingleItemServ
er<unsigned int, GLhandleARB (*)()>&)
E:\Data\spring\rts\lib\gml\gml.cpp:182: error: invalid conversion from 'GLUquadr
ic* (*)()' to 'GLUquadric* (*)()'
E:\Data\spring\rts\lib\gml\gml.cpp:182: error: initializing argument 1 of 'gml
SingleItemServer<T, C>::gmlSingleItemServer(C, int, int) [with T = GLUquadric*,
C = GLUquadric* (*)()]'
E:\Data\spring\rts\lib\gml\gml.cpp:184: error: invalid conversion from 'void (*)
(GLsizei, GLuint*)' to 'void (*)(GLsizei, GLuint*)'
. . .
Re: Spring is running in SMP
Try removing the & character on line 172 in gml.cpp.
If that makes a difference, remove all the & characters in that section.
Edit: On second thought not a good idea at all. Might compile, but will crash. Will try to post some fixed code here.
If that makes a difference, remove all the & characters in that section.
Edit: On second thought not a good idea at all. Might compile, but will crash. Will try to post some fixed code here.
Re: Spring is running in SMP
Replace the corresponding section in gml.cpp with this:
and in gml.h replace with this:
Code: Select all
// Item server instances
#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) && (__GNUC_PATCHLEVEL__ == 0)
// gcc has issues with attributes in function pointers it seems
gmlSingleItemServer<GLhandleARB, GLhandleARB (**)(void)> gmlProgramServer(&glCreateProgram, 2, 0);
gmlSingleItemServer<GLhandleARB, GLhandleARB (**)(void)> gmlProgramObjectARBServer(&glCreateProgramObjectARB, 2, 0);
gmlSingleItemServer<GLUquadric *, GLUquadric *(*)(void)> gmlQuadricServer(&gluNewQuadric, 100, 25);
gmlMultiItemServer<GLuint, GLsizei, void (*)(GLsizei,GLuint *)> gmlTextureServer(&glGenTextures, 100, 25);
gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlBufferARBServer(&glGenBuffersARB, 2, 0);
gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlFencesNVServer(&glGenFencesNV, 2, 0);
gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlProgramsARBServer(&glGenProgramsARB, 2, 0);
gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlRenderbuffersEXTServer(&glGenRenderbuffersEXT, 2, 0);
gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlFramebuffersEXTServer(&glGenFramebuffersEXT, 2, 0);
gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlQueryServer(&glGenQueries, 20, 5);
gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlBufferServer(&glGenBuffers, 2, 0);
#else
gmlSingleItemServer<GLhandleARB, PFNGLCREATEPROGRAMPROC *> gmlProgramServer(&glCreateProgram, 2, 0);
gmlSingleItemServer<GLhandleARB, PFNGLCREATEPROGRAMOBJECTARBPROC *> gmlProgramObjectARBServer(&glCreateProgramObjectARB, 2, 0);
gmlSingleItemServer<GLUquadric *, GLUquadric *(GML_GLAPIENTRY *)(void)> gmlQuadricServer(&gluNewQuadric, 100, 25);
gmlMultiItemServer<GLuint, GLsizei, void (GML_GLAPIENTRY *)(GLsizei,GLuint *)> gmlTextureServer(&glGenTextures, 100, 25);
gmlMultiItemServer<GLuint, GLsizei, PFNGLGENBUFFERSARBPROC *> gmlBufferARBServer(&glGenBuffersARB, 2, 0);
gmlMultiItemServer<GLuint, GLsizei, PFNGLGENFENCESNVPROC *> gmlFencesNVServer(&glGenFencesNV, 2, 0);
gmlMultiItemServer<GLuint, GLsizei, PFNGLGENPROGRAMSARBPROC *> gmlProgramsARBServer(&glGenProgramsARB, 2, 0);
gmlMultiItemServer<GLuint, GLsizei, PFNGLGENRENDERBUFFERSEXTPROC *> gmlRenderbuffersEXTServer(&glGenRenderbuffersEXT, 2, 0);
gmlMultiItemServer<GLuint, GLsizei, PFNGLGENFRAMEBUFFERSEXTPROC *> gmlFramebuffersEXTServer(&glGenFramebuffersEXT, 2, 0);
gmlMultiItemServer<GLuint, GLsizei, PFNGLGENQUERIESPROC *> gmlQueryServer(&glGenQueries, 20, 5);
gmlMultiItemServer<GLuint, GLsizei, PFNGLGENBUFFERSPROC *> gmlBufferServer(&glGenBuffers, 2, 0);
#endif
gmlSingleItemServer<GLhandleARB, GLhandleARB (*)(void)> gmlShaderServer_VERTEX(&glCreateShader_VERTEX, 2, 0);
gmlSingleItemServer<GLhandleARB, GLhandleARB (*)(void)> gmlShaderServer_FRAGMENT(&glCreateShader_FRAGMENT, 2, 0);
gmlSingleItemServer<GLhandleARB, GLhandleARB (*)(void)> gmlShaderServer_GEOMETRY_EXT(&glCreateShader_GEOMETRY_EXT, 2, 0);
gmlSingleItemServer<GLhandleARB, GLhandleARB (*)(void)> gmlShaderObjectARBServer_VERTEX(&glCreateShaderObjectARB_VERTEX, 2, 0);
gmlSingleItemServer<GLhandleARB, GLhandleARB (*)(void)> gmlShaderObjectARBServer_FRAGMENT(&glCreateShaderObjectARB_FRAGMENT, 2, 0);
gmlSingleItemServer<GLhandleARB, GLhandleARB (*)(void)> gmlShaderObjectARBServer_GEOMETRY_EXT(&glCreateShaderObjectARB_GEOMETRY_EXT, 2, 0);
Code: Select all
#if defined(__GNUC__) && (__GNUC__ >= 4) && (__GNUC_MINOR__ >= 3) && (__GNUC_PATCHLEVEL__ == 0)
// gcc has issues with attributes in function pointers it seems
extern gmlSingleItemServer<GLhandleARB, GLhandleARB (**)(void)> gmlProgramServer;
extern gmlSingleItemServer<GLhandleARB, GLhandleARB (**)(void)> gmlProgramObjectARBServer;
extern gmlSingleItemServer<GLUquadric *, GLUquadric *(*)(void)> gmlQuadricServer;
extern gmlMultiItemServer<GLuint, GLsizei, void (*)(GLsizei,GLuint *)> gmlTextureServer;
extern gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlBufferARBServer;
extern gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlFencesNVServer;
extern gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlProgramsARBServer;
extern gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlRenderbuffersEXTServer;
extern gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlFramebuffersEXTServer;
extern gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlQueryServer;
extern gmlMultiItemServer<GLuint, GLsizei, void (**)(GLsizei, GLuint*)> gmlBufferServer;
extern gmlItemSequenceServer<GLuint, GLsizei,GLuint (**)(GLsizei)> gmlListServer;
#else
extern gmlSingleItemServer<GLhandleARB, PFNGLCREATEPROGRAMPROC *> gmlProgramServer;
extern gmlSingleItemServer<GLhandleARB, PFNGLCREATEPROGRAMOBJECTARBPROC *> gmlProgramObjectARBServer;
extern gmlSingleItemServer<GLUquadric *, GLUquadric *(GML_GLAPIENTRY *)(void)> gmlQuadricServer;
extern gmlMultiItemServer<GLuint, GLsizei, void (GML_GLAPIENTRY *)(GLsizei,GLuint *)> gmlTextureServer;
extern gmlMultiItemServer<GLuint, GLsizei, PFNGLGENBUFFERSARBPROC *> gmlBufferARBServer;
extern gmlMultiItemServer<GLuint, GLsizei, PFNGLGENFENCESNVPROC *> gmlFencesNVServer;
extern gmlMultiItemServer<GLuint, GLsizei, PFNGLGENPROGRAMSARBPROC *> gmlProgramsARBServer;
extern gmlMultiItemServer<GLuint, GLsizei, PFNGLGENRENDERBUFFERSEXTPROC *> gmlRenderbuffersEXTServer;
extern gmlMultiItemServer<GLuint, GLsizei, PFNGLGENFRAMEBUFFERSEXTPROC *> gmlFramebuffersEXTServer;
extern gmlMultiItemServer<GLuint, GLsizei, PFNGLGENQUERIESPROC *> gmlQueryServer;
extern gmlMultiItemServer<GLuint, GLsizei, PFNGLGENBUFFERSPROC *> gmlBufferServer;
extern gmlItemSequenceServer<GLuint, GLsizei,GLuint (GML_GLAPIENTRY *)(GLsizei)> gmlListServer;
#endif
extern gmlSingleItemServer<GLhandleARB, GLhandleARB (*)(void)> gmlShaderServer_VERTEX;
extern gmlSingleItemServer<GLhandleARB, GLhandleARB (*)(void)> gmlShaderServer_FRAGMENT;
extern gmlSingleItemServer<GLhandleARB, GLhandleARB (*)(void)> gmlShaderServer_GEOMETRY_EXT;
extern gmlSingleItemServer<GLhandleARB, GLhandleARB (*)(void)> gmlShaderObjectARBServer_VERTEX;
extern gmlSingleItemServer<GLhandleARB, GLhandleARB (*)(void)> gmlShaderObjectARBServer_FRAGMENT;
extern gmlSingleItemServer<GLhandleARB, GLhandleARB (*)(void)> gmlShaderObjectARBServer_GEOMETRY_EXT;
Last edited by zerver on 20 Jun 2009, 15:00, edited 2 times in total.
Re: Spring is running in SMP
I did some thinking and this is possibly caused by your GL version which is 1.3. The SMP version currently requires 1.5, but this may change in the next version.eyu100 wrote:Spring crashes (access violation) immediately on startup.
Re: Spring is running in SMP
USE_GML still doesn't want to build on my Win32 system with GCC 4.4.0 TDM. This was pulled from the master about two hours ago with build type as Debug2 and USE_GML set, everything else default CMake settings:
http://pastebin.com/m3b755804
Anything else I should try?
http://pastebin.com/m3b755804
Anything else I should try?
Re: Spring is running in SMP
Sorry, but I don't know how to help. The errors are obviously very very bogus
Maybe try a different (older) GCC version?
invalid conversion from 'GLUquadric* (*)()' to 'GLUquadric* (*)()
Maybe try a different (older) GCC version?
Re: Spring is running in SMP
the bogusness comes from attributes which are a part of the type but aren't printed out. can't say more now, except that i got rid of those errors once in a not-very-finesse way, by changing signatures.
Re: Spring is running in SMP
I just downloaded "4.4.0-tdm-1 (r2)" and it compiles just fine here.
Makes me even more confused.
Edit: Oops, a mistake during installation I see now, will get back with updated results.
Makes me even more confused.
Edit: Oops, a mistake during installation I see now, will get back with updated results.
Re: Spring is running in SMP
OK, it turned out that the fix itself was the problem. Master should compile now.
Re: Spring is running in SMP

Re: Spring is running in SMP
/screenshot is crashing my MT build. I've tried with and without a /screenshots directory in the read-write directory. A normal build will create the needed directory and image without issue.
Re: Spring is running in SMP
This smp build is made of pure and epic win!
The frame rate is no longer tied to the cpu for me, and I can move up to 3000 core vamps around on dsd while still maintaining 20 fps if they are all in full view. Also, if they are not in view, my fps pop back up to 80! This is with quite high gfx settings.
Oh rite, and turning off threaded optimization gave me another 50% boost. So turning that off is essential.
The frame rate is no longer tied to the cpu for me, and I can move up to 3000 core vamps around on dsd while still maintaining 20 fps if they are all in full view. Also, if they are not in view, my fps pop back up to 80! This is with quite high gfx settings.
Oh rite, and turning off threaded optimization gave me another 50% boost. So turning that off is essential.
Re: Spring is running in SMP
Wow, awesome work.
Re: Spring is running in SMP
I enabled lupsmanager in BA, and all the effects showed fine, but it spammed warnings that sim code called GML 
Can anything be done about this?

Can anything be done about this?
Re: Spring is running in SMP
yeah, fix lupsmanager so it doesn't violate GML assumptions.
Re: Spring is running in SMP
fix what?
it is the fault of zerver/GML!
it is the fault of zerver/GML!
Re: Spring is running in SMP
I did not, for even a second try to push blame on the widget.