These are chat archives for ZaneDubya/UltimaXNA

10th
Dec 2015
Taras Polishchuk
@wake-up-neo
Dec 10 2015 01:17
Hi again. @jeffboulanger drawing of characters move is so poor((( (not clientEntity) MobileMoving of other heroes is over smoothed and looks not real
I tried to play with animations, delays, frames etc but that doesn't fix it
Animation of ClientEntity is ok
but other heroes are floating on the screen but not really moving like in older clients
I wonder if there are simple steps to make it some laggy ? maybe decrease fps or whatever. any ideas?
Zane Wagner
@ZaneDubya
Dec 10 2015 02:09
Too smooth? :)
Perhaps you can make a video of it so we can see what you're talking about?
Jeff Boulanger
@jeffboulanger
Dec 10 2015 02:23
I think @wake-up-neo is talking about how uxna looks different than the standard client, the reason for this is the standard client runs st 11-15fps and uxna runs at 60+.
Jeff Boulanger
@jeffboulanger
Dec 10 2015 02:35
I don't think it will ever look like the classic client
Deniz Sökmen
@denizsokmen
Dec 10 2015 08:55
I log on to UO demise with modified UXNA yesterday
I was able to see people around
handled the new object packet etc
but there is a damn animation frame that causes crash :D
but it was a great experience
in terms of running around in crowded areas
it's a little bit different from the previous time I did
this time I could see multis
Taras Polishchuk
@wake-up-neo
Dec 10 2015 10:38
@ZaneDubya will try to make a video
@jeffboulanger that sounds right, but not only fps is the reason
Taras Polishchuk
@wake-up-neo
Dec 10 2015 11:02
btw how to decrease fps manually ? :)
Jeff Boulanger
@jeffboulanger
Dec 10 2015 15:56
you cant thats not how dx works
The classic client doesn't slow down the FPS, it renders with something called GDI+, which is nothing like DX, its basically the same rendering engine, every single windows app uses, and its just inherently slow. It actually doesn't even draw frames, so it truely doesnt have a FPS, it just draws what changes in pieces, rather then drawing the entire scene ever frame
Taras Polishchuk
@wake-up-neo
Dec 10 2015 20:47
You know what I mean, I need to find a way to make it looks like in the classic client. With current smoothing it looks like players are floating on the screen like a ball in arcanoid, but not really doing steps
Jeff Boulanger
@jeffboulanger
Dec 10 2015 20:57
Ya, good luck ;)
Taras Polishchuk
@wake-up-neo
Dec 10 2015 21:02
thanks ;)
Taras Polishchuk
@wake-up-neo
Dec 10 2015 21:24
Do not misunderstand me, but this issue crosses out all other efforts and work with the client. I'm not trying to offend you or Zane somehow, I wish to shake your hand and say Thank you for your work and such opportunity to work with qualitative open-source client. I just representing the opinion of my testing group of players which play UO more than 10 years for now on a shard with strong PvP, classes triangle and about hundred PvP tournaments each year. That is why I'm pointing you to this issue. No doubts I will try to find a solution, but for now it is a question you should ask yourself - could this client become official client for other guys who trying to implement it to their shards or this is just a toy ? That's the point. @jeffboulanger @ZaneDubya
Deniz Sökmen
@denizsokmen
Dec 10 2015 21:27
well I don't want people with 144hz monitors to bleed their eyes
unlimited fps is cool
now I can't get used to old client with 15 fps
Taras Polishchuk
@wake-up-neo
Dec 10 2015 21:28
the question is not in fps. old client laggy movement is a crap. but I'm talking about appearance of other heroes and mobs on the screen and how they are moving
"fps" was just for example in order to understand we are talking about same things
I should make a video.. it's hard to explain)
Jeff Boulanger
@jeffboulanger
Dec 10 2015 21:44
Its not offense, its just a difference in rendering
DX does full frame, floating point rendering
the classic client doesnt
so it will just look differently
i get what you are trying to accomplish, but its a step backward imo
games don't render like that, games dont look that way, every single UO client made that uses opengl/dx/etc looks like UXNA, smooth and clean. Look at krioss client, playuo, iris, anything, they all look the same
If you want the client to look like it studders, you need to do some radical stuff in XNA/DX, or use BltBit rendering, where you only replace what changes, not a full frame render.
hard to explain i guess
Basically, Classic UO doesnt use hardware acceleration
here's an article explaining DX vs GDI+
maybe that will help
Gabriele Tozzi
@gtozzi
Dec 10 2015 21:52
@jeffboulanger if you have some time to give me some starting info, maybe i can try to shrink down that shader
Jeff Boulanger
@jeffboulanger
Dec 10 2015 21:53
Its not really info, its experience
I've worked with shaders for years ;)
Its just math quirks and tricks
and years of experience optimizing
Gabriele Tozzi
@gtozzi
Dec 10 2015 21:54
basically, I understand the code but have no idea what those variables are for and what's the final goal :D
Jeff Boulanger
@jeffboulanger
Dec 10 2015 21:55
ya, i understand, but im at work, kinda hard to teach it at the moment ;)
Gabriele Tozzi
@gtozzi
Dec 10 2015 21:55
np, just tried to save you some time ;)
Jeff Boulanger
@jeffboulanger
Dec 10 2015 21:58
ya thx ;)
lots of branching
Taras Polishchuk
@wake-up-neo
Dec 10 2015 22:03
@jeffboulanger "games don't render like that, games dont look that way"
I totally agree. But this also affects on animations and sprites, isn't it ? The sprites that was made for "old-rendering-behaviour" was used with not compatible rendering in terms of design. It is like take UO character and put it into Warcraft
Jeff Boulanger
@jeffboulanger
Dec 10 2015 22:03
reduced branching will reduce instructions
no, sprites are just sprites
2d vs 3d has nothing to do with what im talking about
im talking about the smooth movement, the smoothness of moving in the game, and how the world apears to move smooth like its on rollers
thats because of floating point interpolation
something GDI doesnt really do, when writing GDI games
u can probably emulate GDI with DX but ur gonna need to rewrite how everything is rendered
change everything to be no longer based on time
and fix the frame rate to 15 fps
probably not doable with XNA, XNA has 2 modes, 60FPS or as fast as possible
we use as fast as possible I believe
Taras Polishchuk
@wake-up-neo
Dec 10 2015 22:11
Can't make a video. On a video everything is Ok :(((
Jeff Boulanger
@jeffboulanger
Dec 10 2015 22:36
@gtozzi Things I see right away
float alpha = 1 - IN.Hue.z; This should be pre-processed which would reduce the instructions by 3 since you would just apply IN.Hue.z * color, rather than setting alpha, subtracting from 1, then multiplying.
The harder part is reducing the branching, all those if/else statements take a huge toll
but im sure there is a clever way to do it ;)
I know playuo doesnt do hueing in the shader, it hues graphics as it reads them from disk, this might be an alternative as well, but would require a lot of rewrite, so probably not a great option
The toss up is, shaders make it easy, and less memory intensive because texture creation is reduced, but then the offload in this case is that we store an extra 2 floats per vertex, so 32 bytes per item, even if they aren't hued
and since a large majority of the game world isnt hued, mostly just items get hues (some statics), its a lot of wasted memory
Jeff Boulanger
@jeffboulanger
Dec 10 2015 22:41
might need to make a branch to test this theory
we need more diagnostic features for uxna, visibility of memory usage, cpu, update vs draw time, etc
Taras Polishchuk
@wake-up-neo
Dec 10 2015 22:44
here is how it looks like on the video https://www.youtube.com/watch?v=_2S7zbOeVlk
and it is OK here, but in UO game window it is not like this, it is twice smoother
Jeff Boulanger
@jeffboulanger
Dec 10 2015 22:45
Ya, thats GDI ;)
skipping frames
cause its slow
we dont skip frames
Taras Polishchuk
@wake-up-neo
Dec 10 2015 22:46
do I have any chance to skip frames? I'm not experienced in graphic development but I beleive I can just make a skip each 3rd frame for instance? or it doesn't work this way?
Jeff Boulanger
@jeffboulanger
Dec 10 2015 22:49
u could program that, but i dont think it will look the same
they arent skipping the same frames each time
its all based on time, basically the time since the last draw in that region was longer than X number of frames
I keep saying it, but GDI+ doesnt redraw the whole screen, just what changes
so the more change, the more it will look like frames are skipped
i dont have a solution for you
probably gonna have to figure it out yourself, or just live with UXNA looking way better than the classic client ;)
Personally, idont know why you want it to look that way, I prefer seeing it work the way it was actually intended
Taras Polishchuk
@wake-up-neo
Dec 10 2015 22:55
this is a habit :) could you please point me into the code where should I play with this stuff? the only things I found is how to decrease/increase speed of animation or frames of separate object, but not the whole picture
Jeff Boulanger
@jeffboulanger
Dec 10 2015 22:57
I dotn know off hand
i havent touched much of the rendering code
i mostly play with low level systems, net code, input, optimizations, ui stuff
Taras Polishchuk
@wake-up-neo
Dec 10 2015 22:59
I have an issue for you in terms of optimizations:) but just need to start working with this frames. "I keep saying it, but GDI+ doesnt redraw the whole screen, just what changes". I got it, but don't know what to do with it. If I understand it is impossible to change current rendering to GDI+, so I have to find a way to slow down current rendering
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:00
correct
what you want to change, is not optimization
its more, less optimized lol
so its not a issue with me ;)
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:00
Optimization is needed for another issue. give me a second
On this video you may see I'm jumping into portal to guild shop. And you may see how long the items are loading. And there are 3 times more vendors, but they are all appears 1 of 3 times, 2/3 times is what you can see on the video. Yes, there are laggy place with many items and vendors, but 3.0.0c client loads all this stuff in one second maximum. https://www.youtube.com/watch?v=CFrqxt57-c8
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:03
have you tried the latest code?
we just added some netcode optimizations on the 9th
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:04
not yet, will try. do you remember I have a little bit different NetworkClient
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:04
i fixed what you had an issue with
and then some ;)
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:05
Good, will try now. I've refactored that solution to just shifting the buffer for each packet size, without copying into new array. Will check your solution now
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:05
thats what i di
did
ZaneDubya/UltimaXNA@8eea49e
used buffer pooling where i could
that way we arent constantly doing new byte[]
still more to do but it was a good start
ZaneDubya/UltimaXNA@009b2bb
heres the other merge
for optimization
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:07
So two of them?
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:08
ya it was 1 pull request
but looks like 2 merges for some reason
dunno
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:08
I can't just merge with the latest commit coz I've done many fixes for my shard. Will do it manually now
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:08
ya
thats the problem with doing your own stuff
;)
especially on a project no where near complete
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:08
yep, but what can I do )
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:09
be patient"?
;)
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:09
No way) We are waiting for the client for many years
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:09
or, if you fixes are valid and not specific to your server, submit pull requests ;)
its a lot of work man, what do you expect
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:10
most of them are not so specific. there are many NullReference errors that just need to have a condition before)
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:10
see i always question those
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:10
but some of them are related to the packets, paperdolls etc
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:10
maybe the problem was that it shouldnt be null
and if it is null, why
throwing a if(blah != null) is 9/10 an improper fix
if you write up issues, we can investigate
just fixing them yourself, and not contributing doesnt help our codebase ;(
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:11
for example when I'm trying to close other players paperdoll after opening
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:11
write up an issue
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:11
it tries to -= mouseEvent
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:12
ya thats a valid bug, but sounds like its firing out of order
so putting a if check is wrong
you just caused a memory leak
;)
that -= HAS to happen
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:12
no, "if check" in other places)
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:12
so does the -= happen?
or is it getting skipped?
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:13
protected override void OnKeyboardInput(InputEventKeyboard e)
{
  • if (Text == null)
  • Text = string.Empty;
    +
  • if (m_Cache[body] == null)
  • return null;
    +
  • if (m_Cache[body][action] == null)
  • return null;
    +
etc
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:13
seems weird
but ok
i'd have to see the whole context
but ya, -= stuff has to occur
or memory leaks occur
just keep that in mind
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:14
Ok
// Add the item...
Item item = add_Item(i.Serial, i.ItemID, i.Hue, i.ContainerSerial, i.Amount);
+
  • if (item == null)
  • continue;
    +
    item.InContainerPosition = new Point(i.X, i.Y);
a lot of places without appropriate check for null reference
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:14
see i would question why add_item returned null
thats not an appropriate check, if add_item isnt suppose to return null
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:15
After playing more then 12 years in UO I can tell you that there could be issues related to that, even some GameMaster could create wrong or broken item etc. And each time you approaching it you will have client crash. The same situation with 3.0.0c client
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:16
see the real fix is
before calling add_item
we should check that its not a container
oh actually
item should never be null
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:16
even player could send you wrong packets through injection or whatever
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:17
@wake-up-neo That concept works on the server, on a client its a different scenario
the client shouldn't receive invalid things from the server
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:17
you should always check everything to be safe
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:17
ya
and if a player sends packets, it shoudl crash
dont protect against players cheating
break instead
@wake-up-neo you should only check if its expected, if its not expected, it should fail
100% of the time
if you had a job, writing software, and added if(meh==null) checks just to be safe, you have to have a valid response, and just returning is never valid if you never expect a null
its a bad practice picked up by a lot of hobby programmers
its a lazy practice
instead, if you never expect null, you should have guard checks
somethingf like
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:19
I totally agree with your approach, but let's be honest that there are Server side which is not every time under your control
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:19
Guard.RequireIsNotNull(item, "item")
server, yes, client no
client should be exact to what the server sends
server can disconnect a player in the middle of doing anything, so, it has to always check for null context
on a client, its literally a video player
so its a very controled scenario
if you look at add_item
you should determine why null is returned rather than just protecting
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:21
on our server we've done a lot of fixings for Injection. drag speed, object distances and whatever. Do you know what players do now? There are adding object in Injection like NPC, and then staying in the safe zone attacking them like a test. And because they have all their ID's and there server responds wether the NPC dead or alive - the player know if there are someone are "cleaning" that respawn
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:21
like i said
server
it makes sense in the server world, clients are different
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:23
"if you look at add_item
you should determine why null is returned rather than just protecting"
ok
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:24
looks to me like it should add the item
seems like it shouldnt be null, but, i'd have to dig more
im just looking at github
it looks like no matter what, add_item should return an item
because, in all cases, we pass "true" to "create" when calling GetObject<T>
so the fact that it is null, seems like there is another bug
and by adding that null check you added, you just swept it under the rug, no one will ever fix that ;)
validating my point hehe
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:26
I remember the point when I've got the error there
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:26
m_Entities.Remove(serial);
if (create)
{
entity = InternalCreateEntity<T>(serial);
return (T)entity;
}
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:26
I just exploring some player's vendor, opening it's bags and boxes
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:27
can you write up an issue
so we can fix it?
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:27
and when there was item that not exists in Legacy client verdata - it causes error
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:27
with the steps to reproduce
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:27
I don't know how to reproduce it. Just add an item that you don't have in the "verdata" or how it call now
And you will get tons of errors)
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:28
ah, so the real problem is that that item id isnt valid
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:28
When adding it, drawing on paperdoll, drawing in a backpack, on the floor etc
yep
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:28
so we should add a check to see if the item id is valid instead
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:28
that is what I told you before )
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:28
if not, then don't even process this add item code
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:28
yes
on the receive level
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:29
right
thats a much more appropriate fix
;)
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:29
))
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:29
Trace warnings to the console
so people can see we received something we can't show
or
better yet, draw a placeholder graphic
"No Draw"
that'd be the best, that way you see something is wrong
instead of just skipping with a null check
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:30
not so easy to draw no draw on paperdoll ;)
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:30
but anything will do
just a placeholder
So you know, I write software for a living, i help run a team writing cutting edge code, and we have a very high standard for proper practices, property coding standards, etc. So it has it's way to move to even my hobby world ;) So if i come off harsh about those kinds of things, its just passion for wanting things done the right way, cause I literally do it day in and out ;)
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:38
I have nothing against it) And I agree approach of fixing local problem but not global is not correct. The only excuse for this is I'm still learning how the client works, and this is my first interaction with C#))
Now I'm starting to integrate your optimizations. Will tell you the results. And still believe you will help me with "FPS Patch" as you are the only experienced person I know doing such things ;)
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:41
;)
we'll see
lol
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:41
good;)
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:41
I'm am to nice sometimes
or so im told
but im also told im an asshole, so, we'll see
haha
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:42
haha)))
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:44
I do think uxna is missing a lot of guard conditions for a lot of things
but, zane is a hobbiest, and considering what he has accomplished thus far, I find it amazing ;) smart guy
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:45
:thumbsup:
I see you are refactoring under_score with camelCase
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:47
i have arguments about the coding practice with zane alot, we have come to an agreement that i can live with but ya _'s are crap
i only ever use them on private members
private int _myInt
never between words tho
the only thing i dont like in the current codebase is m_
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:47
)))))
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:47
1 extra character i have to type
follows an old out of practice C/C++ standard
but it is tollerable ;)
i delt with it long enough on runuo
Taras Polishchuk
@wake-up-neo
Dec 10 2015 23:48
but you see this is global in Zane's code
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:49
ya, old coding styles get fixed as we see them
but some of the code is really old and not touched in a long time
so it still has old styles
Jeff Boulanger
@jeffboulanger
Dec 10 2015 23:56
private int m_MyInt;
protected int MyInt;
public int MyInt;

private const int MY_INT;
protected const int MY_INT;
public  const int MY_INT;

private void MyFunction()
protected void MyFunction()
public void MyFunction()
I believe this is the style we are currently using. @ZaneDubya can confirm if he gets a chance. Also, never use "var" keyword