View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0000928 | Spring engine | General | public | 2008-05-10 16:27 | 2008-11-02 11:32 |
| Reporter | jK | Assigned To | Auswaschbar | ||
| Priority | normal | Severity | feature | Reproducibility | N/A |
| Status | resolved | Resolution | fixed | ||
| Product Version | 0.76b1+svn | ||||
| Summary | 0000928: [PATCH] huge patch (hwCursors,LuaStuff,Rendering,BumpWater,Speedup) | ||||
| Description | Yeah, finally it got finished. ^-^ Sorry that it took a bit longer and grow in size a bit, but nothing was really finshed until now, so I couldn't commit it further. It's subdivided in 8 patches + 1 zip with images (for new BumpWater). (Test compiled it under windows and linux.) | ||||
| Additional Information | changelog: *hwCursor.patch added full hardware cursor support for x11 and windows (with alpha blending and animations) use "-finline-functions -funroll-loops" when optimize flag is set (they aren't part of -O2!) *units.patch removed redundant dependencies to CursorIcons.h removed 50% capture progress, after an unit got captured replaced some f3Dist with f3SqLen added moveState and fixed fireState tag (unitdef) *LuaCallins.patch new IsGameOver LuaRules callin (can force and prevent gameend) fixed DrawUnit and some other callins (-> removed "args=n" checks, those caused wierd error messages (wrong argument count)) *LuaCallouts.patch OpenGL added gl.Texture($shading) & gl.Texture($grass) fixed missing return;'s in LoadMatrix() and MulMatrix() Allow to use CopyToTexture with non GL_TEXTURE2D, i.e. GL_TEXTURE_RECTANGLE Read new Spring.GetUnitVectors(unitID) -> {front_x,front_y,front_z},{up_x,up_y,up_z},{right_x,right_y,right_z} new Spring.GetUnitWeaponVectors(unitID,weaponNum) -> wpos_x,wpos_y,wpos_z, wdir_x,wdir_y,wdir_z new Spring.GetPlayerStates(playerID) -> mousePixels,mouseClicks,keyPresses,numCmds,unitCmds Ctrl new Spring.HeightMapFunc(lua_func,arg1,arg2,..) This new function allows, in contrast to the old existing heightmap interfaces, to make non-planar heightmap changes (like mounds) with a decent performance (a whole 16x16 map takes 1:30min, using multiple Spring.LevelHeightMap() took >30mins!). Now instead of calling Spring.LevelHeightMap() multiple times, you call Spring.HeightMapFunc() once and use the following sub-functions: new Spring.SetHeight(x,z,h) only valid in Spring.HeightMapFunc! new Spring.SetTerraform(x,z,h,terraform) only valid in Spring.HeightMapFunc! with 0<=terraform<=1 . It is the same equation the engine use internal, terraform is 0 at the beginning and goes upto 1 when finished. example: Spring.HeightMapFunc(function(x1,z1,x2,z2) local scale = math.pi/300 for x=x1,x2 do for z=z1,z2 do Spring.SetHeight(x,z,(math.sin(scale*x)+math.cos(scale*z))*50) end end end, 0,0,Game.mapSizeX,Game.mapSizeZ) *rendering.patch extended /wiremap to BasicSkybox fixed smoke textures loading from resource.tdf (resources/graphics/smoke/smoke00 .. smoke11) enabled polygon offset for all units begin built (fixs a clipping issue) fixed a wrong rotation in ApplyTransform() (which is used by lua's gl.UnitPieceMultMatrix) removed some redundant texture unbindings in dynWater and removed 256*256 foamTex limit fixed glyph (vertical) spacing in fontatlas fixed spacing in particle atlas new TextureLODBias option (global mipmapping bias) new CompressTextures option (It is only used by the new mygl.cpp::glBuildMipmaps() function, so the 3do texture atlas won't be compressed) merged all mipmap creation functions into mygl.cpp::glBuildMipmaps() fixed dds mipmapping filter setting. (yeah smoth was always true, there was something wrong with s3o textures ;) added PBO (PixelBufferObject) support to smf groundtexture loader. info: PBO use DMA and are async (-> 0% cpu usage). Under some conditions PBOs can be slower than the old mechanism, so you can turn them off with "UsePBO". (note: DynWater.cpp needs the mapInfo.[cpp|h] change in bumpwater.patch) *ui.patch new /unitreplyvolume [0.0-1.0] new /hardwarecursor [0|1] new /minimap drawprojectiles [0|1] + implementation (you can turn off drawing of projectiles on the minimap now) added /grounddecals [0|1] to word completion added /water 4 *speedups.patch inlined all VertexArray::AddVertex() (note: -O2 doesn't handle inlines! that's why the hwCursor.patch adds "-finline-functions" when optimize flag is set) speedup CMatrix44f by ~5x! (Translate(),Rotate[X|Y|Z](),Invert()) this can be a huge speed improvement in late games (IIRC profiler had shown CMatrix44f in top10 of most time consuming functions) *bumpwater.patch + bumpwater.zip (needs changes of the rendering.patch: mygl.h::glBuildMipmaps() ) yeah, a new water shader! It is modular so, you can turn off reflections and refractions to get the same speed as /water 0 and still get a nice looking enviroment. Also it's the first water shader in spring that gives the water an ambient color, so the water doesn't look always like puddle. Features: normal map ambient/diffuse lighting specular lighting fresnel (refraction) caustics new map water options (with defaults) are: FresnelMin(0.2), FresnelMax(0.3), FresnelPower(4.0) (define the refraction) WaterSpecularFactor(20.0) WaterSpecularColor(groundSunColor) WaterSurfaceAlpha(0.55) WaterFoamTexture(DynWater uses this, too) WaterNormalTexture(bumpmap) new resource.tdf options: resources\\graphics\\caustics\\caustic00 .. caustic32 new .springrc/registry settings: BumpWaterTexSizeReflection(256) BumpWaterReflection(1) BumpWaterRefraction(1) | ||||
| Tags | No tags attached. | ||||
| Attached Files | |||||
| Checked infolog.txt for Errors | |||||
|
|
Forgot to mention that hwCursor are default off, cos I don't want to risk that someone got no cursor ingame. (to turn it on use "/hardwarecursor 1" (ui.patch)) |
|
|
I am starting by looking a hwCursor.patch and units.patch. If someone else wants to look over some of the others, that would be great. Edit: and I guess ui.patch so I can see the hardware cursor |
|
|
ui.patch only adds the ingame /hardwarecursor command, you can also instead add HarwareCursor=1 to your .springrc/registry and start spring then. |
|
|
I vote jK gets commit access if these are accepted. :) |
|
|
Whoa, very good patches, don't see them like this every day. (Just skimmed over the patches themselves; didn't apply/compile/test anything yet.) Most major issues I found are still quite minor :-) Here are they anyway (the ones I remember): - CBumpWater has everything public, making private stuff private makes the code a little bit easier to understand (because you can then be sure no other code uses the private members) - In CBFGroundTextures::LoadSquare, when stitching together the small tiles into big tiles, you copy 4 bytes at a time using GLfloat (instead of 1 byte at a time using char). However, IIRC this is DXT1 compressed texture data, so just using int would make more sense. (Since (unsigned) int is more commonly used for arbitrary streams of data then float :-)) - SpringApp.cpp seems to be a full-file diff in rendering.patch, maybe some line endings issue? - When removing #includes, you may actually remove them, not just comment them out :) (for some reason everyone always comments #includes out instead of removing them, so you're not the only one ;-)) Especially in relation to the quality in general these are minor issues, so IMHO don't bother with them (yet) until at least these patches are committed. If the SpringApp.cpp really proves to be a problem when applying the patch I'll inform you about it. And funny we get yet another water renderer :-) |
|
|
First thoughts about hwCursor.patch. 1 annoying minor bug. When I start the game, the cursor is hidden, and acting like the cross cursor. Clicking the middle button changes it to the cross cursor. Clicking a second time returns the normal cursor. If it matters any, I'm on XP, and this occurs in both full screen and windowed mode. One other minor stylistic thing. I can somewhat understand not wanting to write the curly braces around one-line if and for statement bodies, but why would you ever remove existing braces around said statements? |
|
|
@ILMTitan: Oh sorry, I forgot that you need the ui.patch, cos it makes game.cpp to enables/show the mouse ingame, so that would solve the missing cursor (and hopefully the starting in middle mouse scrolling, too). Edit: Oh and it is not that I am to lazy to make curly braces (they are easy to access on a us keyboard), I am one of those programmers who want to put as much information on the screen as possible, so I like to remove any redundant syntax and unnecessary linebreaks (IMO it is much easier to read then). Yeah, I know most ppl don't like such a coding style :/ @tvo thx :) - yeah, CBumpWater.h was one of my first c++-files, so i simply copied it from DynWater what doesn't use privates, too (still a bad programming design by me). - yeah, an int should be cleaner and faster for copying 4bytes. - meh .. some editor of me changed the newline ending again. I had that already once and fixed it, but it happened again... Oh, and I don't think the SpringApp.cpp is a problem to patch (it worked fine on my clean linux compile ebuild). But mapInfo.cpp,mapInfo.h and README.txt don't want to patch on my computer (linux), the strange is that when you seperate each one those files into an own patch, it works fine. (using a svn prog to patch it should work in all cases) |
|
|
hwCursor.patch and units.patch are all clear. ui.patch is mostly clear, except for /water 4 and the skybox wireframe sections, which require bumpwater.patch and rendering.patch respectively to test. Those are also the two I feel least qualified to approve. |
|
|
* Applied hwCursor.patch and ui.patch from jK's patch set (mantis 0000928), except the -finline-ffunctions -funroll-loops change from hwCursor.patch, and the water and wireframe hunks from ui.patch (will all follow later). |
|
|
Applied units.patch Found that the GameOver LUA callin in LuaCallins.patch is wrong; the call is being made in the CGameServer thread/process currently, which will at least cause race conditions and worst case will not compile at all (because I don't think Auswaschbars dedicated server has a dependency on LUA.) |
|
|
In LuaCallouts.patch, GetPlayerStats seems to be wrongly placed in LuaSyncedRead.cpp; looking at the rest of that file it seems it only returns synced stuff, while player stats are unsynced. Is there a particular reason to put it there or can it go in LuaUnsyncedRead.cpp? |
|
|
bumpwater.patch and rendering.patch committed, see commit msg for comments |
|
|
"In LuaCallouts.patch, GetPlayerStats seems to be wrongly placed in LuaSyncedRead.cpp; looking at the rest of that file it seems it only returns synced stuff, while player stats are unsynced. Is there a particular reason to put it there or can it go in LuaUnsyncedRead.cpp?" PlayerStats are sended through server, and Spring.GetPlayerControlledUnit is also more unsynced than synced and it is placed in LuaSyncedRead, too. So it is part of both, but it contains informations that should be not accesible by all players (while the match is running), so imo it is more synced than unsynced. @GameServer(IsGameOver) And yeah, I already had a presentiment, that it won't work that way (it worked on a single pc game). Need to investigate GameServer/client differentiation then a bit more (not that easy ^^). |
|
|
applied speedups.patch; only the Lua patches left. |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2008-05-10 16:27 | jK | New Issue | |
| 2008-05-10 16:27 | jK | File Added: hwCursor.patch | |
| 2008-05-10 16:28 | jK | File Added: units.patch | |
| 2008-05-10 16:28 | jK | File Added: LuaCallins.patch | |
| 2008-05-10 16:29 | jK | File Added: LuaCallouts.patch | |
| 2008-05-10 16:29 | jK | File Added: rendering.patch | |
| 2008-05-10 16:29 | jK | File Added: ui.patch | |
| 2008-05-10 16:29 | jK | File Added: speedups.patch | |
| 2008-05-10 16:30 | jK | File Added: bumpwater.patch | |
| 2008-05-10 16:42 | jK | File Added: bumpwater.zip | |
| 2008-05-10 17:39 | jK | Note Added: 0002253 | |
| 2008-05-10 17:40 | ILMTitan | Note Added: 0002254 | |
| 2008-05-10 17:41 | ILMTitan | Note Edited: 0002254 | |
| 2008-05-10 18:54 | jK | Note Added: 0002255 | |
| 2008-05-10 18:55 | jK | Note Edited: 0002255 | |
| 2008-05-10 18:55 | jK | Note Edited: 0002255 | |
| 2008-05-10 20:13 | LordMatt | Note Added: 0002256 | |
| 2008-05-11 01:01 | tvo | Note Added: 0002258 | |
| 2008-05-11 03:31 | ILMTitan | Note Added: 0002259 | |
| 2008-05-11 08:04 | jK | Note Added: 0002260 | |
| 2008-05-11 08:17 | jK | Note Edited: 0002260 | |
| 2008-05-12 00:28 | ILMTitan | Note Added: 0002262 | |
| 2008-05-12 15:02 | tvo | Note Added: 0002265 | |
| 2008-05-12 15:14 | tvo | Note Added: 0002266 | |
| 2008-05-12 15:30 | tvo | Note Added: 0002268 | |
| 2008-05-12 17:07 | tvo | Note Added: 0002269 | |
| 2008-05-12 18:21 | jK | Note Added: 0002270 | |
| 2008-05-12 22:19 | tvo | Note Added: 0002271 | |
| 2008-11-02 11:32 | Auswaschbar | Status | new => resolved |
| 2008-11-02 11:32 | Auswaschbar | Resolution | open => fixed |
| 2008-11-02 11:32 | Auswaschbar | Assigned To | => Auswaschbar |