PDA

View Full Version : How does OpenGL work for you? (v2)



Obscurity
10-22-2015, 03:19 AM
June 6th, 2016 edit: we have a new question about your FPS experience, see this post and follow the instructions to contribute! (https://villavu.com/forum/showthread.php?t=114823&p=1375835#post1375835)


Recently Clarity;, Ross;, and myself have put a lot of work into making OGL better. From adding SRL compatibility, to trying to reduce lag, to completely changing coding styles, etc.

We primarily want people who suffered from slow performance prior.

Firstly, we want your opinion on it's speed, FPS, etc.

This requires the newest ogLib.

Put your layout into Old School.

Run this.

program new;
{$i ogLib/lib/core/core.simba}

begin
ogl.setup([800,600],[0,0,576,388]);
ogl.setDebugMode(2);
repeat
wait(1000);
until false;
end.

Enable Debug.

If your models don't line up, stop and rerun it. You'll get a graphics error when stopping - that's fixed and awaiting an update, DW.

Let it sit for a bit.



How does performance hold up? Try pressing alt+` (the button next to your 1) and typing displayfps.

StickToTheScript
10-22-2015, 03:24 AM
On my computer my performance hits 9 FPS after 5 minutes. I teleported once to add to it.

Currently have debug enabled.

E: Its still usable, but noticeable lag. So, it technically works... :P

I also have a decent computer, not a crappy one. But apparently its not good enough to deal with the plugin.

Clarity
10-22-2015, 03:38 AM
On my computer my performance hits 9 FPS after 5 minutes. I teleported once to add to it.

Currently have debug enabled.

E: Its still usable, but noticeable lag. So, it technically works... :P

I also have a decent computer, not a crappy one. But apparently its not good enough to deal with the plugin.

Specs? Using the latest ogLib, starting SMART in OGL?

StickToTheScript
10-22-2015, 03:52 AM
Specs? Using the latest ogLib, starting SMART in OGL?

Yes to all of those.

AMD FX-6300 @ 3.5GHz
XFX Radeon HD 7950 3 GB
8 GB of DDR33-1600 Ram (2x4GB)
Windows 10

Clarity
10-22-2015, 03:59 AM
Yes to all of those.

AMD FX-6300 @ 3.5GHz
XFX Radeon HD 7950 3 GB
8 GB of DDR33-1600 Ram (2x4GB)
Windows 10

Does your FPS start at around 9 immediately, or around 30-40 and hit 9 after 5 minutes?

StickToTheScript
10-22-2015, 04:03 AM
Does your FPS start at around 9 immediately, or around 30-40 and hit 9 after 5 minutes?

It starts at approx. 31, then drops to close to 15 with debug off and not moving.

E: http://i.imgur.com/QVJ4vrI.jpg

THats standing still after 25 seconds of login.

2 mins after login, Standing still in GE:
http://i.imgur.com/QlA2ML4.png

fady
10-22-2015, 04:09 AM
Getting 24 fps as soon as I start it, but it stays that way. Been running Ross's runespan for hours tho at 38 fps. Sadly I never used older versions of the plugin/library, so I cant compare improvements.

i7-3632QM 2.2GHz
GeForce 640M 2GB
6 GB DDR3 RAM
Windows 10

EDIT: Left the Runespan to the wizards tower, and fps dropped to 7 with debug on, 24 with debug off

Clarity
10-22-2015, 04:37 AM
Getting 24 fps as soon as I start it, but it stays that way. Been running Ross's runespan for hours tho at 38 fps. Sadly I never used older versions of the plugin/library, so I cant compare improvements.

i7-3632QM 2.2GHz
GeForce 640M 2GB
6 GB DDR3 RAM
Windows 10

EDIT: Left the Runespan to the wizards tower, and fps dropped to 7 with debug on, 24 with debug off

The FPS with debug is less relevant, it will always be a bit lower - glad to know that you have reasonable FPS steadily however.

IROC-Z
10-22-2015, 11:25 PM
The FPS for me stays right around 20 with debug on, it'll hop up to 25 sometimes. I started in Varrock and teled to Falador and I'm mining that buried chest thing in Falador park. So far it's working great and I've been doing it for about 15 minutes.

Twinki
10-22-2015, 11:43 PM
Works for me just fine, unless I re-log. Sometimes i'll log back in and it'll be perfectly fine, but other times i'll log back in and the FPS will be stuck at 10.

It's random, it'll happen when I've only ran the script for 10 minutes and it somehow logs out, or it'll happen after 10 different relogs in a 24 hour period.

Comodo
02-14-2016, 10:54 PM
I made a simple script for OpenGL, and ran it for a couple hours, It starts out fine at 30+ FPS, but over time it slows down and after 30mins or so I had to restart the client. I did this a couple times, and it managed to maintain a decent FPS for over an hour before I stopped botting for the day. Maybe it was downloading the cache.
Could leaving the debug cause the game to gradually drop in FPS, because I had it enabled in my script but not on the client.

jaybob
02-16-2016, 12:06 AM
I think I know the reason for the fps drops:
GLX uses a vector to store OpenGL Buffer objects (see here https://github.com/Brandon-T/GLX/blob/master/OpenGL32/src/Hooks/Structures.cpp#L26)
and walks it for every model render in the current frame (see here https://github.com/Brandon-T/GLX/blob/master/OpenGL32/src/Hooks/Structures.cpp#L173)
this vector can grow enormously huge (up to 10k until buffer objects get deleted). every frame has about 400 models on average... thats a worst case of 4 million loops per frame.
(same thing with fonts although with a lesser impact)
solutions: use a hashmap.

Laquisha
02-16-2016, 01:38 AM
I think I know the reason for the fps drops:
GLX uses a vector to store OpenGL Buffer objects (see here https://github.com/Brandon-T/GLX/blob/master/OpenGL32/src/Hooks/Structures.cpp#L26)
and walks it for every model render in the current frame (see here https://github.com/Brandon-T/GLX/blob/master/OpenGL32/src/Hooks/Structures.cpp#L173)
this vector can grow enormously huge (up to 10k until buffer objects get deleted). every frame has about 400 models on average... thats a worst case of 4 million loops per frame.
(same thing with fonts although with a lesser impact)
solutions: use a hashmap.
Brandon;

Kasi
02-16-2016, 02:02 AM
I think I know the reason for the fps drops:
GLX uses a vector to store OpenGL Buffer objects (see here https://github.com/Brandon-T/GLX/blob/master/OpenGL32/src/Hooks/Structures.cpp#L26)
and walks it for every model render in the current frame (see here https://github.com/Brandon-T/GLX/blob/master/OpenGL32/src/Hooks/Structures.cpp#L173)
this vector can grow enormously huge (up to 10k until buffer objects get deleted). every frame has about 400 models on average... thats a worst case of 4 million loops per frame.
(same thing with fonts although with a lesser impact)
solutions: use a hashmap.

iirc the entire buffer is freed right after the hooked SwapBuffers (or rather right before it exits). it is emptied and freed every frame.

Ross
02-16-2016, 02:04 AM
...


...


...

Dw about it, magic is happening. :)

Kasi
02-16-2016, 02:10 AM
Dw about it, magic is happening. :)

Nice teaser man.

Ross
02-16-2016, 02:11 AM
Nice teaser man.

Nice title change D:

Kasi
02-16-2016, 02:14 AM
Nice title change D:

The respect on these forums is abysmal. No decency to even tell me about my title change. Meh, still beats OpenGL Dev.

Ross
02-16-2016, 02:15 AM
The respect on these forums is abysmal. No decency to even tell me about my title change. Meh, still beats OpenGL Dev.

Repped

Brandon
02-16-2016, 02:34 AM
Brandon;


TLDR: Give up on the plugin. It's there for learning purposes only (and legacy tutorials that are still very relevant as they describe how the game works & renders) and soon I'll probably get rid of it on my git once and for all (so long as there's a replacement and/or time to write a clean new one).



He's right (and that was the reason I had to iterate the buffer backwards to get the last buffers first but that causes many issues so I removed it). Although he's right, he's half right. The plugin was written WITHOUT std::unordered_map (aka HashMap) because it simply did NOT exist before C++11 and C++14 and Mingw's support for it was horrible. Nonetheless, even the include is bad (it's pure PascalScript and copying).

The plugin doesn't use Move-Constructors either or perfect forwarding. Over the years, I did change some things with the update to the language but couldn't get rid of a lot (I did minor patches for map rendering and minimized storage and usage by deleting at the end of the frame and shrinking the vectors' capacities) but those updates didn't get rid of vector because there was no better alternative at the time (std::map is way too slow and std::vector of std::tuple would be equally slow).


Things like textures use a map (as of the most recent patches): https://github.com/Brandon-T/GLX/blob/master/OpenGL32/src/Hooks/Structures.cpp#L301 but it's a multi-map of tuples: https://github.com/Brandon-T/GLX/blob/master/OpenGL32/src/Hooks/Structures.cpp#L22


Most of the slowdown is actually from fonts (which was the hardest thing to come up with an algorithm for.. So hard, that Kasi & I spent nights on finding the algorithm for it).. Each letter is stored and sent to Simba and there wasn't really a way to NOT store it or to determine what to delete other than letting the client handle it). After the massive amount of patches, I just gave up on it. Would be much easier to just rewrite it from scratch tbh. The code is only still on my Git for legacy purposes and the multitude of tutorials based on it (that are still very much relevant) on this site and others.


But anyway, let's not forget that there are NEW ways to handle things with C++11, C++14, C++17 and different ways to handle fonts, textures, and models. Specifically (Found & written around mid 2015 in preparation for NXT): https://villavu.com/forum/showthread.php?t=104932&p=1329338#post1329338

Brotein
02-19-2016, 07:47 PM
The OpenGL plugin, and the corresponding library, are both fantastic. I have just come back to RS after being away for a year and it's fantastic to see that the work I had done a year ago still worked perfectly(even better most of the functions I wrote are now in the library.)

The speed is fine, I run my bots at 1920x1080 so that I can get a large screen space to work with(usefuly for some scripts where you want to see a large area at once. But 1920x1080 at low settings on an old computer with no performance hickups for long 10+ hour sessions. Everything is stable compared to last year with the 100s of access violations :D

Hodor123
03-28-2016, 07:43 AM
OpenGL destroys my frames. I'll launch RS and be at 50FPS for a solid 20ish minutes and after that it all goes downhill.

Heres a fresh screenshot from 1h of clarityburialarmour *There are no other programs running or clients* 27281

SPECS
Intel i5 quadcore @ 3.3
8gb ram
Windforce r9 290 3gb

send help please.

Lemon star
03-31-2016, 06:41 PM
OpenGL destroys my frames. I'll launch RS and be at 50FPS for a solid 20ish minutes and after that it all goes downhill.

Heres a fresh screenshot from 1h of clarityburialarmour *There are no other programs running or clients* 27281

SPECS
Intel i5 quadcore @ 3.3
8gb ram
Windforce r9 290 3gb

send help please.

Yes I notice this too. I usually restart my simba client after 10 hours or so. The thing is that whenever i switch worlds on rs3 it gets worse. If im on the same world its good.
EDIT: You could always clear the cache

Hodor123
04-02-2016, 03:24 PM
snip
How do I clear the cache?

Icaro10100
04-08-2016, 11:36 AM
I used it to make scripts for darkscape and it worked great! It's much easier than color to make scripts with.

Lemon star
04-08-2016, 07:39 PM
me too

badez
06-02-2016, 01:21 AM
This is not an intentional bump of this thread. My frame rates start at 30FPS with Debug off and normally after 10-15 minutes drop to 9-10 and stick there. I'll read into some other threads later for any possible solutions. Note: this is only with the use of ClarityBurial.

I'll try clearing Cache when I am home. For anyone wondering how to do this head to http://services.runescape.com/m=rswiki/en/Browser_crashes/closes

Joopi
06-02-2016, 05:38 AM
Common problem, has been posted several times. It shouldn't be due to some script, rather the opengl plugin that smart uses. It used to do this to me even when not using any library or anything that utilizes opengl calls (e.g. oglib).

Clarity
06-06-2016, 04:59 AM
I'm currently curious about whether a past change to the include actually affected anything. I would appreciate if people could tell me if the following noticeably drops their FPS:

1. Go to glFonts.simba (https://github.com/ObscuritySRL/ogLib/blob/master/lib/core/glFonts.simba)
2. Comment out Line 7 and Line 14, so your entire glFonts.simba file looks like this:


function glFonts(var funcPointerSize:uInt32;funcIgnoreCache:boolean=fal se):pointer;
var
funcSystemTime:uInt32;
begin
if funcIgnoreCache or ((funcSystemTime:=getSystemTime())-oglFontTimeLast>oglCacheTime) then
begin
//ogl.setFontCapture(true);
if (result:=glxFonts(funcPointerSize))<>nil then
begin
oglFontPointer:=result;
oglFontPointerSize:=funcPointerSize;
oglFontTimeLast:=funcSystemTime;
end;
//ogl.setFontCapture(false);
end
else
begin
result:=oglFontPointer;
funcPointerSize:=oglFontPointerSize;
end;
exit(result);
end;


3. Put ogl.setFontCapture(true); anywhere after ogl.setup();
4. See if anything changes in your FPS.

We originally added those two lines with the intent of improving FPS issues. However this came with a drawback of increasing the time of glFonts calls by 200-300ms, which, depending on the script, can drastically affect performance.

Twinki
06-06-2016, 11:11 AM
.....

It doesn't appear to affect my FPS. Maybe a 1-5 FPS difference, but nothing blatant.

EDIT: I'd assume you wanted us to do a loop of a method like ogl.getChars

With the lines un-commented I drop down to 45-ish FPS from a stable 50.

With the lines commented, maybe a 1-2 FPS drop. Of course, ogl.getChars returns nothing with the lines commented out.

Clarity
06-06-2016, 11:28 AM
It doesn't appear to affect my FPS. Maybe a 1-5 FPS difference, but nothing blatant.

EDIT: I'd assume you wanted us to do a loop of a method like ogl.getChars

With the lines un-commented I drop down to 45-ish FPS from a stable 50.

With the lines commented, maybe a 1-2 FPS drop. Of course, ogl.getChars returns nothing with the lines commented out.

Thanks for testing and replying, +rep for you! :)

Linked
06-06-2016, 07:19 PM
Didn't experience any FPS drop

yogi
06-09-2016, 10:07 AM
hey clarity i have a problem , my script says compiled succesfully but my player manager wont load or i cant even update my plugins,srl,sps

srlMW
06-23-2016, 10:48 AM
Only just saw this. I run OG @ 50fps steady apart from 1 time which has never reoccurred.

Joopi
06-23-2016, 02:16 PM
FPS on SMART in OpenGL used to drop to like 5-10 after some minutes to me, but now, for whatever reason, it stays at a stable nice FPS. Probably due to some work on the plugin or something I'd assume.

SmallP3n0r
07-12-2016, 10:23 PM
I didn't see much benefit after making the above changes. I continue to see the steep degradation of fps 4-5 minutes (not loading new zones or chunks even). Went from a stable 50 fps to ~23 within 5 minutes which was about on par with running OGlib scripts prior to the glfont changes.

EDIT: I am running on a AMD Radeon HD 7950 which probably isn't (nor ever was) a stellar gfx card, which may be part of the problem.

Thomas
04-24-2017, 04:58 PM
I didn't see much benefit after making the above changes. I continue to see the steep degradation of fps 4-5 minutes (not loading new zones or chunks even). Went from a stable 50 fps to ~23 within 5 minutes which was about on par with running OGlib scripts prior to the glfont changes.

EDIT: I am running on a AMD Radeon HD 7950 which probably isn't (nor ever was) a stellar gfx card, which may be part of the problem.

Haven't the same problem with the 7950, never tested with another GPU afterwards though...

lely1103
05-24-2017, 03:42 AM
thank you so much for sharing this