RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

Open source XNA Ultima Online client

Poplicola

Sorceror
Open source XNA Ultima Online client

I played Ultima Online my first semester in college. It was a lot of fun, although I remember struggling with the interface. Now I'm working on my own Ultima Online client, both as a hobby and in a attempt to implement a better interface for the classic UO client. I've been coding this up for the past month and a half, and now I'm releasing the code as open source.

I've used code from xWinFormsLib, UltimaSDK, and Chase.XNA's map renderer in this client. Being able to use this code so I didn't have to start entirely from scratch saved me a lot of time, so thanks to Chase.XNA and the developers of UltimaSDK and xWinFormsLib.

Visit UltimaXNA @ Google Code to download the latest revisions from the SVN and upload your edits
UltimaXNA @ Google Code

So, what can you do?
You can log in to a server on a local machine, walk around, see NPC's walking around and animating... and that's about it. Considering how much is going on beneath the hood, that's pretty impressive.
If you want to add on to the engine, extend it or optimize it, you're welcome to do so! I only ask that you share your additions so that I don't end up recoding what someone else has already done.

A word of warning!
This is my first C#/XNA project ever, so the code may not follow best conventions for the language. It is also somewhat messy and poorly commented in places. I'll try to amend this in future releases. But don't let this stop you from diving in and having fun with it!

The client does not handle every single message that the server might send - so beware using this in a production environment, it might drop crucial packets. It works just fine on a fresh-out-of-the-zip-folder distribution of RunUO 2.0.

An issue which might crop up is a missing reference to the xWinFormsLib dll. If this happens to you, simply add the /bin/Debug/xWinFormsLib.dll library as a reference in the solution explorer.

You will need to change the Username and Password variables in the Engine.cs file to log in to your server. The client currently attempts to log in to a server on Localhost, so if you're attempting to log in to a remote server, you'll need to change the appropriate string further down in Engine.cs.

Have fun and let me know what you think!
 

Kons.snoK

Sorceror
just an hint:
why don't you create a google code project?
Other hint: a nice thing would be supporting KR graphics files!
 

Sythen

Sorceror
Rofl

Awesome work man!

Only 1 request/suggestion though... could you make it so that players can have the 5 original maps and then give us the ability to add 10-20 (the higher the amount the more customizable a server will become) additional trammel/felucca size custom worlds? If I'm correct, at this point, there is a client-side code, or lack of, that prevents players from adding more than 5 maps. In addition, 'Map32, Map33, Map34...etc.', which are reserved for "additional maps" exceeding the 5 original maps by players can only clone the maps already on the server; so while they are completely different facets and read as such... the terrain will look like one of the 5 maps already on the server. What I'm thinking is that maybe you can reserve a series of map numbers (depending on how many custom maps one wishes to add), 'Map32, Map33, Map34...etc.', and make it so we can add new custom worlds instead of them being clones of a pre-existing facet. I hope this makes sense, and I can't speak for anyone else on these forums, but his will be the deciding factor on whether or not I would use a custom client; even as good as yours looks.


Since the KR graphics are being scrapped by EA in the next expansion Stigian Abyss... No need to create a KR client except to appease the few who use KR on their servers. :p

Technically they are taking the KR GUI and keeping the UO 2d graphics and combining them. So everything will look like KR except the game window which will look like 2d looks now. I think they will give the option to use the classic GUI settings, but not sure about that one.

KR is doomed my friend, doomed! :eek: lol
 
Sythen;802967 said:
Since the KR graphics are being scrapped by EA in the next expansion Stigian Abyss... No need to create a KR client except to appease the few who use KR on their servers.
first smart decision they've made in the last 10 years. Those graphics were absolutely horrid.
Sythen;802967 said:
Technically they are taking the KR GUI and keeping the UO 2d graphics and combining them. So everything will look like KR except the game window which will look like 2d looks now. I think they will give the option to use the classic GUI settings, but not sure about that one.
Followed by the dumbest.

Sythen;802967 said:
KR is doomed my friend, doomed! :eek: lol

Doom is negative, KR going bye bye is a very positive step forward.
 
The code looks nice, albeit unusually structured in parts. One thing that I noticed was that the client crashes if you don't have a verdata.mul, which isn't a necessary asset.
 

Jeff

Lord
I didn't test this, but ideally this should provide better lighting (per pixel lighting instead of per vertex)

Code:
float4x4 world : WorldViewProjection;
float3 lightDirection;
bool DrawLighting;

sampler textureSampler;

struct VS_INPUT
{
	float4 Position : POSITION;
	float3 Normal	: NORMAL;
	float2 TexCoord : TEXCOORD;
};

struct PS_INPUT
{
	float4 Position : POSITION;
	float2 TexCoord : TEXCOORD0;
	float3 Normal	: TEXCOORD1;
};

PS_INPUT VertexShader(VS_INPUT IN)
{
	PS_INPUT OUT;
	
    OUT.Position = mul(IN.Position, world);
	OUT.TexCoord = IN.TexCoord; 
	OUT.Normal = IN.Normal;
	
    return OUT;
}

float4 PixelShader(PS_INPUT IN) : COLOR0
{		
	float NDotL = saturate(dot(lightDirection, IN.Normal));
	float4 color = tex2D(textureSampler, IN.TexCoord);
	
	if(DrawLighting)
		color *= NDotL;
	
	return color;
}

technique StandardEffect
{
	pass p0
	{
		VertexShader = compile vs_2_0 VertexShader();
		PixelShader = compile ps_2_0 PixelShader();
	}
}
 
Also crashes without a bodyconv.def, which a number of players remove when they don't want to look at UO3D graphics like ki-rins, etc. Otherwise, this is looking fantastic.
 

Kons.snoK

Sorceror
Sythen;802967 said:
Since the KR graphics are being scrapped by EA in the next expansion Stigian Abyss... No need to create a KR client except to appease the few who use KR on their servers. :p

Technically they are taking the KR GUI and keeping the UO 2d graphics and combining them. So everything will look like KR except the game window which will look like 2d looks now. I think they will give the option to use the classic GUI settings, but not sure about that one.

KR is doomed my friend, doomed! :eek: lol

with KR graphics files i meant ".uop" support, 'cause EA will be using uop for each new client it's gonna to release, and structure is always same ;)
Internal structure of files, like animations, instead has been changed, cause they are more definite and have more frames.. I'm studing those HEX files right in this period.
I think also 2d client will have some very big change with SA, because they full rewrite the Patch system.
 

Thilgon

Sorceror
well, this looks nice :)

important things for a good client actually i think that are:
- ability to read more than 5 map files
- ability to read maps of different sizes than the standard ones
- possibility to read custom animX, art, gump, etc, so to be able to create larger files, or totally custom-made files
- separate the weapons from theyr weaponabilities by default
- make it possible to define chairs

mh, can't think of anything else right now...
probably those things can't be managed simply (well, a settings file in the core, that would need recompiling the .exe might be enough), but reaching these would be a great goal...
 

Poplicola

Sorceror
@Kons.snoK — I'll look into that tomorrow, that sounds like a good idea. Here is my stance on KR compatibility: I definitely want to see support for KR graphics included, but I won't personally work on that until the client is more or less feature complete using the old client graphics. Even if/when KR graphics support is added, I would not change any of the net code, so the client would still act 100% like the old client when communicating with the server. If you want to try to add this yourself, give it a shot!

@Sythen — Thanks for the suggestions. I like the idea of extending the client to support features that the original client does not have. Support for features like unlimited maps would have to be added to the server as well, wouldn't it? As I imagine it, this client would send a message identifying itself as an extended client, and a properly set-up RunUO server would then enable an 'extended' feature set for that client. This extended feature set could include just about anything you might want to see added to the client: automatic downloads of patches from the server, improved chat, different object interactivity... can you think of anything else you would want to see in an extended featureset?

@Suil Ban — Those files are used by UltimaSDK. I don't know how necessary they are for proper operation of the SDK. You know more about what they're used for than I do, can you tell if the files are vital? Speaking of the bodydef file, how does that work? I noticed in InsideUO that models from expansions have the same body code as models from the original art set.

@Jeff — I had no idea how to do that. Your code is perfect; not only does it smoothly shade the terrain, but it also has brightened up the color palette to levels comparable to the official client. Thanks for the contribution! Since you're good with shaders, can you think of a way that I could use them to hue objects (either full hue or partial hue).

@Thilgon —*This client will definitely have the ability to load custom resources. Furthermore I'd like to see the client be also to patch itself on a server-by-server basis, so that a RunUO server could direct the client to download custom patches. What do you mean by "separate weapons from weapon abilities" and "define chairs"?

If anyone wants to try their hand at expanding the client, I encourage them to do so. Possible ideas for additions that you could work on might include - adding support for hueing textures (I would add a 'hue' variable to IMapObject, and then add support for huing in TileEngine.cs, SpriteBatch3D.cs, and shader.fx), figuring out the correct order for drawing layers (this is in Unit.cs; currently the layers do not draw in the correct order), and adding support for more messages from the server (you will need to add the size of the packet in SocketClient.cs, and then add the code that extracts the data from the packet in GameClient.cs). Or anything else. Have at it!
 

Thilgon

Sorceror
What do you mean by "separate weapons from weapon abilities" and "define chairs"?

Actually the weapon abilities of any weapon are hard-coded in the client.
A kind of weapon can only have its original weapon abilities, so, except if you use a script by Garguille, that interrupts the communication between client and server regarding weapon abilities, you cannot give to a weapon the abilities you want. Another thing this script do is expanding the number of abilities you can give to a weapon, so you can have a weap with like 5 abilities, not possible with the normal client...

Chairs, also, are defined in the client. The chairs actually warps and bends the character animation, since a "sitting animation" does not exist, but what is a chair and what is not a chair is hardcoded in the client, making it difficult to insert custom chairs (there is a script that helps with this too, but requires some extra patching)

I like the idea of an integrated patch download :)

Body.def is the file that makes it so animation are copied to new slots with different hues (or the same hue), so if you want to duplicate an animation, you don't have to phisically patch it... it works in conjunction with equipconv.def (that changes the gump, animation etc, of a wearable based on the bodyid), and bodyconv.def (wich is the def file for the client for looking into the different animX.mul and getting the animations from there, since the client reads directly only anim.mul).

Another improvement would be make it possible to define any (or anyway, a large number) of custom Body Id for races, since actually it is only possible to have 2 race body (adding any other body animation will not be recognized as a body and give some problems)
 

Kons.snoK

Sorceror
Poplicola;803018 said:
@Kons.snoK — I'll look into that tomorrow, that sounds like a good idea. Here is my stance on KR compatibility: I definitely want to see support for KR graphics included, but I won't personally work on that until the client is more or less feature complete using the old client graphics. Even if/when KR graphics support is added, I would not change any of the net code, so the client would still act 100% like the old client when communicating with the server.
That's absolutely correct :)
Poplicola;803018 said:
If you want to try to add this yourself, give it a shot!

I don't have much time, i'll be busy already supporting/analyzing SA client ;)
 

Jeff

Lord
Poplicola;803018 said:
I had no idea how to do that. Your code is perfect; not only does it smoothly shade the terrain, but it also has brightened up the color palette to levels comparable to the official client. Thanks for the contribution! Since you're good with shaders, can you think of a way that I could use them to hue objects (either full hue or partial hue).
Glad to hear, When you shade things based on the code in the vertex shader it only does shading in 4 points (each vertex) and then lerps the shading between each of the points being drawn... this is fast, but unfortunately not that great of a look. Moving that same code to the pixel shader does based on pixel location rather than vertex :)

For hues you would need to create 1d textures (width only) of the hue being used and pass them to the shader, I would have to play with the shader to figure out what is needed to properly hue them, but it should be to hard.
 

Halciet

Sorceror
Well now, here's a project that might be interesting enough to pull me out of retirement. I haven't spent much time in the community since heading off for the master's and taking a job, but it's really nice to see someone getting behind an open-source 2D client. The pairing of this and RunUO could lead to some of the greatest UO advancements freesharding has ever seen.
 

Poplicola

Sorceror
I've set up a google code project for this code. I've uploaded a test commit to the repository. This is the first time I've used SVN, so could someone with more experience in this area take a look at the source code as currently uploaded and let me know if I have the format/directory tree set up correctly? Or any other suggestions before I open the thing up to anyone who wants to add code?

The initial test commit is here:
ultimaxna - Google Code

Thanks! I really appreciate it!
 

Jeff

Lord
Poplicola;803142 said:
I've set up a google code project for this code. I've uploaded a test commit to the repository. This is the first time I've used SVN, so could someone with more experience in this area take a look at the source code as currently uploaded and let me know if I have the format/directory tree set up correctly? Or any other suggestions before I open the thing up to anyone who wants to add code?

The initial test commit is here:
ultimaxna - Google Code

Thanks! I really appreciate it!

It's fine. check your pm.
 
i'll get to answering your questions in a bit--i'm posting mobile at the moment. just wanted to say 'cool' to the google code project. i'll probably be playing with this a lot :)
 

Poplicola

Sorceror
This being my first SVN project, I had some trouble getting the project uploaded correctly. As far as I can tell, as of right now (r13), it's working perfectly. Have at it!

I've set it so that anyone can suggest code changes without joining the project, but if you want to change so you can automatically merge your code changes, let me know and I'll add you as a member.
 

Attachments

  • login.JPG
    login.JPG
    55.5 KB · Views: 438

Smjert

Sorceror
Good work, but i have a problem, not really related with your project.
Anyway i tried to compile and it says:

Error 1 The font family "Arial Narrow" could not be found. Please ensure the requested font is installed, and is a TrueType or OpenType font. D:\Active Project\ultimaxna\UltimaXNA\UltimaXNA\Content\Fonts\ArialNarrow10.spritefont UltimaXNA

I have TrueType active and i can't find Arial Narrow free (i think is not), so.. i have to deactivate TrueType font?
Anyone has this issue and has solved it?.
 
Top