|
You last visited: Today at 20:13
Advertisement
ProjectXV4 - Custom Source
Discussion on ProjectXV4 - Custom Source within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.
01/12/2015, 22:02
|
#1
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
|
ProjectXV4 - Custom Source
About ProjectX
ProjectX was the name I used for one of my first "successful" server.
It has now been 4 years since I created the first version of ProjectX in which has become a custom C# source over the years (Since V3.)
ProjectX V4 is the latest version and is a complete custom source written from scratch using the D programming language.
It's not build upon a specific model, but rather my own structure similar to the one used in ProjectX V3.
Why D?
D has an excellent implementation of conditional compilation and templates, making dynamic code so much easier and flexible.
D compiles to asm thus able to have an excellent performance and speed.
D gives you the freedom to produce OOP when needed and not forced to wrap everything in classes/namespaces.
D comes with a GC which manages the memory great and a game server can easily leak memory places where you wouldn't expect it,
problems like that are avoided because of the GC.
Source Information
Patch: 5017 (This may change through time, although original patch supports will always be available still.)
Language(s): D
Database: Flatfile (Will be MySql later on.)
About The Source:
This is my first Conquer source in D to ever be written past the auth server. I chose flat file for the database as a start,
because I've never used any real database management systems along with D. However I plan to implement MySql once I finish the base.
I started this source 01-10-2015.
Features: (This will be updated over time.)
Installment / Compilation:
Source:
Wiki/Guides:
News/Update Log/TODO:
I will update this thread with news about the source and what development has been done.
Thank you!
|
|
|
01/14/2015, 09:07
|
#2
|
elite*gold: 0
Join Date: Mar 2008
Posts: 309
Received Thanks: 208
|
Looks really cool.
Compilation was painless with dmd for ubuntu. Didn't log in, though, after launching both services the proverbial lights definitely seem to be on
Good work. I'm interested in seeing your D project vs. a couple thousand clientless bots down the road.
|
|
|
01/14/2015, 10:03
|
#3
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
|
Quote:
Originally Posted by .Ocularis
Looks really cool.
Compilation was painless with dmd for ubuntu. Didn't log in, though, after launching both services the proverbial lights definitely seem to be on
|
Yeah the compilation should be pretty straight forward. Wrote my own tool to just compile the thing myself by dropping an ini file with settings into it. It's really handy for this kind of projects as I'm not using any IDE, but just Notepad++ due to that I don't have a computer of my own and just borrowing one, else I'd probably have went with Visual-D. It's a bit of a pain in the ass to not be able to debug properly, but luckily I'm able to navigate my source with ease.
Ex.
Code:
out=ProjectXV4_Game.exe
cmd={0} -m32 -unittest {1}
extensions=*.d
exclude=out,auth
And yeah same, I wonder how it would seem in a real world usage.
Quote:
Originally Posted by .Ocularis
Good work. I'm interested in seeing your D project vs. a couple thousand clientless bots down the road.
|
Same, might need some more optimizing too. It's my first server done in D where I've come past the auth server, so I'd say I've done a pretty good job so far as it works smoothly with everything implemented so far.
|
|
|
01/14/2015, 15:59
|
#4
|
elite*gold: 130
Join Date: Oct 2007
Posts: 1,652
Received Thanks: 701
|
It is unlike you to willingly use MySQL. Perhaps it is because of the support for multi-platform ?
|
|
|
01/14/2015, 17:08
|
#5
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
|
Quote:
Originally Posted by turk55
It is unlike you to willingly use MySQL. Perhaps it is because of the support for multi-platform ?
|
Yeah pretty much.
#Update
Added a wiki page to the GitHub which contains pretty much any information about the source, installation and features. (More to come!)
|
|
|
01/14/2015, 23:11
|
#6
|
elite*gold: 0
Join Date: May 2009
Posts: 10
Received Thanks: 1
|
looks awesome cant wait !btw when its the release date?
|
|
|
01/15/2015, 03:22
|
#7
|
elite*gold: 130
Join Date: Oct 2007
Posts: 1,652
Received Thanks: 701
|
Quote:
Originally Posted by Super Aids
Yeah pretty much.
#Update
Added a wiki page to the GitHub which contains pretty much any information about the source, installation and features. (More to come!)
|
If you need some help with database designing, you know where to find me
|
|
|
01/15/2015, 08:03
|
#8
|
elite*gold: 20
Join Date: Jan 2008
Posts: 2,012
Received Thanks: 2,882
|
Quote:
Originally Posted by Super Aids
Why D?
just cuz
|
ftfy
|
|
|
01/15/2015, 15:20
|
#9
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
|
Quote:
Originally Posted by turk55
If you need some help with database designing, you know where to find me
|
Uhmm nope. That's the least of my problems, considering the database design will pretty much follow the existing one, but just tweaked to use mysql and not ini files. I won't have to edit a lot to implement it tbh.
Quote:
Originally Posted by InfamousNoone
ftfy
|
Pretty much
|
|
|
01/15/2015, 17:19
|
#10
|
elite*gold: 130
Join Date: Oct 2007
Posts: 1,652
Received Thanks: 701
|
Quote:
Originally Posted by Super Aids
Uhmm nope. That's the least of my problems, considering the database design will pretty much follow the existing one, but just tweaked to use mysql and not ini files. I won't have to edit a lot to implement it tbh.
|
There are some features that you could use though, get online at skype and we can talk.
|
|
|
01/15/2015, 18:23
|
#11
|
elite*gold: 0
Join Date: Dec 2010
Posts: 35
Received Thanks: 1
|
i need video man
|
|
|
01/15/2015, 18:28
|
#12
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
|
Quote:
Originally Posted by ScorpioN[Timur]
i need video man
|
No you don't.
|
|
|
01/15/2015, 20:09
|
#13
|
elite*gold: 0
Join Date: Feb 2010
Posts: 43
Received Thanks: 43
|
You seem to like the D.
Jokes aside, not sure why you would choose it though, it has no benefits over C#. Sure, cross-platform is nice... but you can already do it with Mono (with very little penalty to performance). The only reason that comes to mind is you just wanted to **** with a new language and see what comes out which is pretty insane. Then again, I've done **** like that too because why not.
|
|
|
01/15/2015, 20:33
|
#14
|
elite*gold: 0
Join Date: Dec 2012
Posts: 1,761
Received Thanks: 946
|
Quote:
Originally Posted by .John
You seem to like the D.
Jokes aside, not sure why you would choose it though, it has no benefits over C#. Sure, cross-platform is nice... but you can already do it with Mono (with very little penalty to performance). The only reason that comes to mind is you just wanted to fuck with a new language and see what comes out which is pretty insane. Then again, I've done shit like that too because why not.
|
I chose it for the template and generic programming implementation, the conditional compilation, fast compile time, not too platform specific within its library such as relying on OS apis and having to write a tons different methods for each platform (The standard library already handles this pretty well with the conditonal compilation / version implementation.) Also because C# requires you to encapsulate everything, which is meh because everything doesn't need to be wrapped in classes etc. with D I only have to use OOP when I really need it, which helps me produce code way faster. I didn't choose it because it might have a slightly better performance, but because I could produce more elegant code faster.
Let me give you an example.
Code:
bool inRange(T)(T x1, T y1, T x2, T y2, T distance) {
return (getDistance!T(x1, y1, x2, y2) <= distance);
}
Code:
auto findEntitiesInRange(ushort x, ushort y, ushort distance) {
synchronized {
MapObject[] res;
foreach (e; entities.values) {
if (inRange!ushort(e.x, e.y, x, y, distance))
res ~= e;
}
return res;
}
}
If I had to do something like that. First of all I couldn't just have inRange() stored alone for itself in a module like I currently have. I'd have to actually encapsulate it in a class and most likely a static one. That's already a waste of encapsulation, typing and unwanted indent.
Secondly arrays are not dynamic in C# and I'd have to copy arrays for resizing or appending, which I won't need to in D hence why I can just append using "res ~= e". A list does that under the hood too.
This is what the code would look like in C#.
Code:
namespace ConquerSource
{
public static class Space
{
// GetDistance() etc.
public static bool InRange<T>(T x1, T y1, T x2, T y2, ushort distance) // distance can't be as dynamic in C# as it can be in D...
{
return (GetDistance<T>(x1, y1, x2, y2) <= distance);
}
}
}
Code:
MapObject[] FindEntitiesInRange(ushort x, ushort y, ushort distance)
{
lock // If using concurrent dictionaries for entities, not necessary ...
{
List<MapObject> res = new List<MapObject>();
foreach (var e in entities.Values)
{
if (Space.InRange<ushort>(e.X, e.Y, x, y, distance))
res.Add(e); // Copies all the data into a new array with a new capacity, since C# doesn't have dynamic arrays; as below what a waste.
}
return res.ToArray(); // Copies all the data rather than just returning the underlying array... lol what a waste
}
}
Just to find entities in the screen and returning them ex. for 10 players in the screen. It would take 11 array copies. 10 for adding them and 1 for returning the array.
Of course you can just return the list, but still a copy of the array every time you search for players in the screen.
Let's say 10 players in the screen moves 1 space at the same time. That means over a 100 array copies just for that. In D there would be no copies and only 10 arrays returned.
I know it's not something noticable or whatever, but the point remains. I'd write more code for useless operations, no thanks.
|
|
|
01/15/2015, 23:17
|
#15
|
elite*gold: 0
Join Date: Feb 2010
Posts: 43
Received Thanks: 43
|
That is ONE way it could look like in c#. It's very poorly done.
Here is another c# source, with a completely different syntax/style that works fast and looks good.
It's not 2000 anymore - most devs should take advantage of LINQ and Enuerables. It's a core part of high level logic.
Edit: And to clarify how that code works - a map is split into quandrants (ex: 32x32). Players are split into these quadrants based on their position. When enumerating, this allows us to enumerate over a far smaller range of enitities versus the whole map.
The flatten well... flattens the quadrants so I can select from multiple quadrants at once (as many as i want based on x/y). SelectMany simply selects all the objects based on the given entity types in that quadrant (and once again flattens it), then fiters it down to the radius I need.
No need for synchronization , less looping, and more abstract in terms of what it returns.
Here's an example of usage - very simple, straight forward and easy to understand. It's fast, don't worry.
Code:
var candidates = Map
.Around(Position, ViewRange, MapObjectType.Player)
.Cast<IEntity>()
.Where(x => !x.Dead)
.ToArray();
if (candidates.Length > 0)
{
Target = candidates.ElementAt(_rand.Next(candidates.Length));
LastAttacked = DateTime.UtcNow;
}
|
|
|
|
|
Similar Threads
|
[Selling] Custom Source
09/13/2014 - Flyff Trading - 2 Replies
Preview
Auto Fooder : https://www.facebook.com/video.php?v=6024555765335 50
Resize Character : https://www.facebook.com/video.php?v=6020283232429 42
CTRL Wing System : https://www.facebook.com/video.php?v=6019933932464 35
Auto Fooder : 40euro
Resize Character : 25euro
Flying Wing System : 50euro
Vip System + User Custom Title : 100euro
|
[Selling] V19/Custom Source
08/28/2013 - Flyff Trading - 18 Replies
Da MM meine FP gerettet hat verkaufe ich hier nun meine ganze source + datenbank.
Was ist drin?
V19 Interface
-mit v19navi komplett offi actionslot etc.
-V19 Coupon System
-Madrigal Gift System(official)
-V19 Consignment Market
-Wing System
-Glow System
-Pet System
|
Custom source
04/03/2012 - CO2 Private Server - 4 Replies
#Never mind, solved.
To those who replied, thanks.
|
problem with custom source
11/11/2011 - CO2 Private Server - 0 Replies
based on these 2 guides
http://www.elitepvpers.com/forum/co2-pserver-guid es-releases/1531960-guide-coding-your-own-source.h tml
http://www.elitepvpers.com/forum/co2-pserver-guid es-releases/776370-guide-faq-lets-make-custom-sour ce.html
i coded a base but for some reason i get login freeze what could be causing that
|
All times are GMT +2. The time now is 20:13.
|
|