Duke4.net Forums: Polymin: A hack to increase framerate in polymer - Duke4.net Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Polymin: A hack to increase framerate in polymer

User is online   Danukem 

  • Duke Plus Developer

#1

This mod is a "mutator" -- you can include the code and add it to the regular CONs, or to modified CONs, and it will do its thing.

DOWNLOAD

To install, what you want to do is put the file "polymin.CON" in the folder that contains your other CON files, then open one of them up, and near the top add "include polymin.CON"

First of all, results are mixed. In some cases, using this code will substantially increase framerate by introducing some pop-in to the game. In other cases, you get the pop-in without any significant benefit. In some rare cases, it may even give you reduced performance while introducing glitches. A notable success that I had was when adding it to Mark's Medevil TC (based on WGR2). My framerate went from an average of 16 to an average of 35, with the only drawback being some pop-in.

Polymin is an "optimization" in the same way that sawing your family's legs off so that they can all fit in a compact car for the road trip is an optimization. What it does is collapse sectors that you "don't need" at the moment. It also restores them when they are needed, though. So unlike on that roadtrip, your family will have working legs at the end. Probably.

Here are some defined values at the top of file that you can mess with:

define SECTBUFFERDIST 4096
define VIEWCUTDIST 16384

define SECTINC 512 // sectors processed for culling/restoring per-tic
define LAGTIME 3 // consecutive tics of low framerate before sector culling begins
define FPSTARGET 36 // framerate target


SECTBUFFERDIST is the amount of distance beyond where you are standing and beyond where you are looking before sectors will be collapsed. VIEWCUTDIST is something like the maximum distance your hitscans can go before my code says "you've looked far enough, if the framerate is low then sectors will be cut from that distance on". The other values are explained in the comments above.

Other notes: The code will do nothing unless polymer is the renderer. The code will do nothing until the framerate drops below FPSTARGET. This code does nothing to alter polymer lights. However, lights will automatically stop working in collapsed sectors (and start working again when sectors are restored). If you used this code in combination with code that culled/restored lights or changed/restored lights from spotlights to pointlights, you would probably get additional benefits.

Unfortunately, there are some visual glitches that go beyond pop-in. Not too many, from what I have seen, but I am aware of them. When it comes to bugs, I am more concerned about gameplay stuff (like sector effects getting broken). If you come across anything like that, please let me know. If anyone wants to share any success stories, please do -- I would like to think that this code is useful.

EDIT: A FEW LINES OF MY CODE USE DEFINED LABELS SO FOR GOD'S SAKE INCLUDE THIS CODE BELOW "INCLUDE DEFS.CON".
FOR EXAMPLE IN YOUR GAME.CON IT COULD LOOK LIKE THIS

include DEFS.CON
include USER.CON
include polymin.CON
9

User is offline   Mark 

#2

I just downloaded it and will try it in my various projects today. Smooches :P

This post has been edited by Mark.: 07 June 2017 - 03:12 AM

0

#3

Does it have any indirect effect on polymost too?
0

User is offline   The Nate 

#4

I tried adding it to GAME.CON, but it gave me compilation errors. Anyway to use this by itself?
0

User is offline   Mark 

#5

Hey Dan. When you tested it in MedEVIL exactly where did you install the include line? When I put it at the top of game.con I received a number of warnings and errors in the log file. I moved the include line to another con file, I forgot which one, and the log spit out a different list of errors and warnings. Polymin.con resides in the WGR2 folder and the include line reflects that.

I just realized my issues may be from the fact I'm running my favorite old version of Eduke32. Or did you test it with my TC using that older version?

This post has been edited by Mark.: 07 June 2017 - 05:12 AM

0

User is offline   MusicallyInspired 

  • The Sarien Encounter

#6

Interesting approach. I'll have to wait until I get home to try it, but has anyone else tried it yet? What's the difference like?
0

User is offline   TON 

#7

Edited

This post has been edited by TON: 07 June 2017 - 06:09 AM

0

User is online   Danukem 

  • Duke Plus Developer

#8

View PostSgt Jack V, on 07 June 2017 - 04:44 AM, said:

I tried adding it to GAME.CON, but it gave me compilation errors. Anyway to use this by itself?



View PostMark., on 07 June 2017 - 04:46 AM, said:

When I put it at the top of game.con I received a number of warnings and errors in the log file.


SEE MY EDIT

The code does not contain any syntax errors, I have tested it many times. The warnings you get are if it redeclares vars using some of the same var names in in your project (this is harmless).
0

User is offline   Mark 

#9

never mind, I read your OP edit.

This post has been edited by Mark.: 07 June 2017 - 10:23 AM

0

User is offline   Mark 

#10

I'm still not on the same page. As I expected, the log file says there is no USER.CON or DEF.CON Do I have to extract them from the WGR2.GRP file and put them out in the open?

Plus I am still getting tons of warning and error messages and the game won't run. The errors change depending on what order I put the include line in with the others.

This post has been edited by Mark.: 07 June 2017 - 10:38 AM

0

User is online   Danukem 

  • Duke Plus Developer

#11

View PostMark., on 07 June 2017 - 10:20 AM, said:

never mind, I read your OP edit.




Check it out, here is your town, which normally gives me about 16fps. My framerate is pretty low here and there is more pop-in than usual because I am recording with Xsplit gamecaster at 1080p, but you can still see what the code does.
0

User is offline   Mark 

#12

Thanks. Thats got more popping than a bag of the best microwave popcorn. :P Since I can't get it to run there I'll try a different project.

This post has been edited by Mark.: 07 June 2017 - 10:47 AM

0

User is online   Danukem 

  • Duke Plus Developer

#13

View PostMark., on 07 June 2017 - 10:44 AM, said:

Thanks. Thats got more popping than a bag of the best microwave popcorn. :P Since I can't get it to run there I'll try a different project.


All you have to do is put polymin.CON in the same folder with your other CON files, then add the line "include polymin.CON" in your list of includes (make it the bottom of the list to be safe). You can edit the defined values to reduce the pop-in. I would start by lowering FPSTARGET to 30, then change SECTBUFFERDIST to 6144.

This is a proof of concept. If pop-in is unacceptable, then it's a non-starter. If some pop-in is acceptable, then adjustments can be made and projects that were unplayable can be made playable. Personally I consider <20 fps to be not worth playing.
0

User is offline   Mark 

#14

That is exactly what I did the first time I tried. A long list of errors and warnings. Got the usual message of do I want to continue with internal cons?

It generates 1 warning and 64 errors in my WGR2.DEFS.con file.

Attached thumbnail(s)

  • Attached Image: mysetup.jpg


This post has been edited by Mark.: 07 June 2017 - 11:43 AM

0

User is online   Danukem 

  • Duke Plus Developer

#15

View PostMark., on 07 June 2017 - 11:36 AM, said:

That is exactly what I did the first time I tried. A long list of errors and warnings. Got the usual message of do I want to continue with internal cons?


Are you using an old version of EDuke32 before it allowed the new syntax shortcuts, such as player[] instead of player[THISACTOR]? I'll bet that's it.

If you are using an EDuke32 from before 2017, that would explain it. Other than that, I don't know what to tell you. I literally just put the polymin.CON file in the same folder as your other CONs, added the include line to WGR2MARKGAME.CON, and it works fine with no errors.

Just to be extra clear, the top of your edited WGR2MARKGAME.CON looks like this:

setdefname wgr2.def
setcfgname wgr2.cfg
setgamename WGR2 SIEGE BREAKER

include WGR2/WGR2DEFS.CON
include WGR2/WGR2MARKUSER.CON
include WGR2/WGR2MARKQUESTS.CON
include WGR2/WGR2VARS.CON
include WGR2/WGR2SHARED.CON
include WGR2/WGR2HUD.CON
include WGR2/WGR2PLAYER.CON
include WGR2/WGR2ITEMS.CON
include WGR2/WGR2MON.CON
include WGR2/polymin.CON

0

User is offline   Mark 

#16

GAH, I asked twice if you used a newer version of eduke than provided in my project and you didn't answer. Yes, I'm running the old version. Guess thats the problem. I'll install the latest so I can test it out. I still stay with my old favorite version because of the better rendering and slight frame rate increase over newer versions.

This post has been edited by Mark.: 07 June 2017 - 11:51 AM

0

User is online   Danukem 

  • Duke Plus Developer

#17

View PostMark., on 07 June 2017 - 11:44 AM, said:

GAH, I asked twice if you used a newer version of eduke than provided in my project and you didn't answer.


Sorry, I was in a hurry and didn't reply to that part. Everyone can be assured that any CON code I produce these days will require a recent revision of EDuke32. With the recent versions I can type lines like:

ifg player[].posz sprite[].z

instead of
ifvarvarg player[THISACTOR].posz sprite[THISACTOR].z


That extra typing really adds up. And if you go back to even older versions, then you have to put struct members into vars before comparing them, which is completely awful.
0

User is offline   Mark 

#18

I hate to beat a dead horse but...I'll let the numbers speak for themselves about why I stick with good old version 4593. These are 3 points in my map. As you can see, 4593 beats 6143 hands down in frame rate. Great improvement with Polymin over stock 6143. But with Polymin's default settings there is way too much popping. So if I adjust settings for it I will lose some of it's gains and may get closer to stock 4593 performance. I will adjust those settings later and update my chart with a 4th column.

4593 6143 6143/Polymin
37----16----26
11-----6-----30
30----14----44

I'll admit my test map may not be the best candidate because it is so wide open and it makes the popping so noticible. But I will make a final judgement after I tweak all the settings.

This post has been edited by Mark.: 07 June 2017 - 12:27 PM

0

User is online   Danukem 

  • Duke Plus Developer

#19

View PostMark., on 07 June 2017 - 12:23 PM, said:

4593 6143 6143/Polymin
37----16----26
11-----6-----30
30----14----44


That's interesting. I had no idea that newer revisions of EDuke32 were hurting performance that badly. It might be hardware specific. In any case, the polymin code could be made to work with 4593, it would just mean doing find/replace to expand some shit and then going in to make manual changes to some lines. For example, you would need to find '[]' and replace with '[THISACTOR]'. Replacing 'ife' is harder because it might require 'ifvare' or 'ifvarvare'. And so on.

EDIT: I just realized that 4593 probably doesn't have "appendevent" either... You can just replace that with "onevent"
0

#20

I've added the "include polymin.CON" in main CONs of the other TD mods just for experiment, they started all. There just a bunch of these duplicated actions in the log.


Dukeplus (modifying DUKEPLUS.CON)

DukePlus/dpcons/USERPLUS.CON: At top level:
DukePlus/dpcons/USERPLUS.CON:150: warning: duplicate definition `B' ignored.
DukePlus/dpcons/USERPLUS.CON:224: warning: duplicate definition `temp' ignored.
DukePlus/dpcons/USERPLUS.CON:230: warning: duplicate definition `spriteid' ignored.
DukePlus/dpcons/USERPLUS.CON:236: warning: duplicate definition `xydist2' ignored.
DukePlus/dpcons/USERPLUS.CON:237: warning: duplicate definition `angvar' ignored.

DukePlus/dpcons/LIGHTS.CON:6: warning: duplicate definition `wallpoint' ignored.
DukePlus/dpcons/LIGHTS.CON:7: warning: duplicate definition `currwall' ignored.
DukePlus/dpcons/LIGHTS.CON:21: warning: duplicate definition `WALLX' ignored.
DukePlus/dpcons/LIGHTS.CON:22: warning: duplicate definition `WALLY' ignored.
DukePlus/dpcons/LIGHTS.CON:27: warning: duplicate definition `SMALLX' ignored.
DukePlus/dpcons/LIGHTS.CON:28: warning: duplicate definition `BIGX' ignored.
DukePlus/dpcons/LIGHTS.CON:29: warning: duplicate definition `SMALLY' ignored.
DukePlus/dpcons/LIGHTS.CON:30: warning: duplicate definition `BIGY' ignored.


War Of Attrition (modifying ATTGAME.CON)

polymin.CON: At top level:
polymin.CON:27: warning: duplicate definition `xydist2' ignored.
polymin.CON:29: warning: duplicate definition `currwall' ignored.
polymin.CON:30: warning: duplicate definition `wallpoint' ignored.
polymin.CON:39: warning: duplicate definition `pscanx' ignored.
polymin.CON:40: warning: duplicate definition `pscany' ignored.
polymin.CON:47: warning: duplicate definition `pscanz' ignored.
polymin.CON:50: warning: duplicate definition `BIGX' ignored.
polymin.CON:51: warning: duplicate definition `BIGY' ignored.
polymin.CON:52: warning: duplicate definition `WALLX' ignored.
polymin.CON:53: warning: duplicate definition `WALLY' ignored.
polymin.CON:54: warning: duplicate definition `SMALLX' ignored.
polymin.CON:55: warning: duplicate definition `SMALLY' ignored.
polymin.CON:56: warning: duplicate definition `spriteid' ignored.
polymin.CON:57: warning: duplicate definition `temp' ignored.
polymin.CON:59: warning: duplicate definition `B' ignored.
polymin.CON:61: warning: duplicate definition `angvar' ignored.


Duke Forces (modifying the DF GAME.CON)

polymin.CON: At top level:
polymin.CON:24: warning: duplicate definition `x2' ignored.
polymin.CON:26: warning: duplicate definition `y2' ignored.
polymin.CON:27: warning: duplicate definition `xydist2' ignored.
polymin.CON:29: warning: duplicate definition `currwall' ignored.
polymin.CON:30: warning: duplicate definition `wallpoint' ignored.
polymin.CON:56: warning: duplicate definition `spriteid' ignored.
polymin.CON:57: warning: duplicate definition `temp' ignored.
polymin.CON:59: warning: duplicate definition `B' ignored.
polymin.CON:61: warning: duplicate definition `angvar' ignored.


I want to try a test with standard WGR2 but I'm using the Addon compilation version so all the CONs are packed into the .GRP, I suppose the results would be similar to the Mark project though.
0

User is online   Danukem 

  • Duke Plus Developer

#21

^I don't think it makes any sense to try using this with Duke Forces, since that doesn't have many models and framerate should be high already. I also don't recommend using Attrition with the HRP, since the HRP isn't fully compatible with it (you will get an ugly combination of models and 8-bit sprites, and some pals won't work right). That being the case, it doesn't make sense to use polymin with Attrition, either. That leaves DukePlus. In theory it can help there, but I wasn't getting great results in the maps I tried it with.
0

#22

Attrition actually has BECOME incompatible with it, since this has actually happened with the new versions. But restore the HRP compatibility it's not that tricky, half of the stuff have their 3D counterpart from Dukeplus and we can use the models I choosed for my WGR2 HRP for the new weapons (flamethrower, plasmagun and circular saw).

This post has been edited by Fantinaikos: 07 June 2017 - 01:04 PM

0

User is offline   VGames 

#23

BUMP: Is this still available somewhere?
0

User is online   Danukem 

  • Duke Plus Developer

#24

It was an experiment and the drawbacks to using it are not worth it imo. I can find it on one of my hard drives, but I would rather not have to look for it.

Remember, this was part of my description in the first post:

Quote

Polymin is an "optimization" in the same way that sawing your family's legs off so that they can all fit in a compact car for the road trip is an optimization. What it does is collapse sectors that you "don't need" at the moment. It also restores them when they are needed, though. So unlike on that roadtrip, your family will have working legs at the end. Probably.

0

User is offline   VGames 

#25

It’s ok if u don’t want to dig for it. I just wanted to test it with mod because of the extreme amount of gibs and debris and effects in general that are present in my mod and the fact all the vanilla maps are now slaughter maps. Polymer is off limits as of now for my mod. Was curious if this would benefit anything. It looked interesting.

This post has been edited by VGames: 07 January 2023 - 10:07 AM

0

User is online   Danukem 

  • Duke Plus Developer

#26

View PostVGames, on 07 January 2023 - 10:06 AM, said:

It’s ok if u don’t want to dig for it. I just wanted to test it with mod because of the extreme amount of gibs and debris and effects in general that are present in my mod and the fact all the vanilla maps are now slaughter maps. Polymer is off limits as of now for my mod. Was curious if this would benefit anything. It looked interesting.


Polymin increases framerate by reducing the amount of sector related rendering. This can be helpful in polymer in particular, since it struggles badly with rendering complex level geometry. The idea was that by flattening sectors that are far away and in the background, you get a boost in framerate without compromising the visuals too much. I don't remember how I handled live actors in the affected sectors -- possibly those sectors were ignored but clearly serious issues are possible since the code is literally change floor and ceiling heights of sectors and then changing them back again.

EDIT: I found the file. Taking a quick look, it handles actors in the collapsed sectors by temporarily changing them to a custom statnum which makes them effectively frozen in time and also making them invisible.

Attached File(s)


0

User is offline   VGames 

#27

View PostDanukem, on 07 January 2023 - 03:45 PM, said:

Polymin increases framerate by reducing the amount of sector related rendering. This can be helpful in polymer in particular, since it struggles badly with rendering complex level geometry. The idea was that by flattening sectors that are far away and in the background, you get a boost in framerate without compromising the visuals too much. I don't remember how I handled live actors in the affected sectors -- possibly those sectors were ignored but clearly serious issues are possible since the code is literally change floor and ceiling heights of sectors and then changing them back again.

EDIT: I found the file. Taking a quick look, it handles actors in the collapsed sectors by temporarily changing them to a custom statnum which makes them effectively frozen in time and also making them invisible.


That sounds very interesting. I'll give it a go and see what it can do. At the least this could be an experimental, use at your own risk, kind of thing for people that just got to use Polymer with my mod even though it's designed for Polymost. I'm just trying to give them options. Thanks for digging it up.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options