Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 21.03.2006, 18:50   #26
karioth
Архивный участник
 
Join Date: Mar 2006
Posts: 21
Default

Quote:
Originally Posted by navy
Of cource ^_^
Think about SonicNet, cause .Net ThreadPool is low level priority threads
Can you give a link please, I couldn't find
karioth is offline  
Old 22.03.2006, 02:01   #27
theRAGE
Архивный участник
 
Join Date: Feb 2005
Posts: 82
Default

Quote:
Originally Posted by karioth
You can download current compilable sources from web page
http://antonr.zakamsk.net/l2csharp/
This domain is parked, pending renewal, or has expired.
Please contact the domain provider with questions.

:shock:

Sup with that?
theRAGE is offline  
Old 22.03.2006, 02:05   #28
Sindol
Архивный участник
 
Join Date: Oct 2005
Posts: 21
Default

Quote:
Originally Posted by navy
Of cource ^_^
Think about SonicNet, cause .Net ThreadPool is low level priority threads
Not entirely true now in .Net 2.0, it depends on how you use the .Net thread pool.

Using ThreadPool.QueueUserWorkItem will still cause the ThreadPool to use the old .Net 1.0 and 1.1 lower level priority worker thread, which is fine for everything but mission critical operations that could take a long time.

But using the new ThreadPool.UnsafeQueueNativeOverlapped will now use high performance I/O complete port threads, also all .Net asynchronous methods such as those that start with Begin or End (ie BeginReceive, EndDisconnect) now default to using the higher performance I/O CP threads for their workload.

Furthermore .Net 2.0 introduced the SetMaxThreads and SetMinThreads methods to the ThreadPool which let you set the min or max number of both worker threads and I/O CP threads of the ThreadPool, thus breaking the limit of 25 available threads found in .Net 1.0 and 1.1.

Unless for some reason you're using an insanely large amount of QueueUserWorkItem calls, I'd stick to using the default ThreadPool.
Sindol is offline  
Old 22.03.2006, 05:49   #29
navy
Архивный участник
 
Join Date: Nov 2005
Posts: 41
Default

Quote:
Not entirely true now in .Net 2.0, it depends on how you use the .Net thread pool.
Thanx a lot Sindol I just started to learn .Net 2.0 and do no know all new stuff

karioth, here the link
http://www.codeproject.com/csharp/Ma.../Sonic_Net.zip

Here the lib
navy is offline  
Old 22.03.2006, 09:03   #30
Digital
Архивный участник
 
Join Date: Nov 2004
Posts: 1,405
Default

actually... the original database design n stored procedures from l2...
is really well thought out... if we could use it... it could really save us alot of time on designing and testing... since it's already a proven system.
we probably just need to modify it abit to include the new stuff that's all.
as for caching, logging and multi-auth/server handling...
would have to spend time time thinking about it...
but a simple prototype first would probably be very valuable and pull more developers into this area.
(seriously we have alot of great people here, hopefully we could use back whatever we've build on l2off, hopefully by then we have fully working geodata and pathnodes

-out
Digital is offline  
Old 22.03.2006, 12:11   #31
karioth
Архивный участник
 
Join Date: Mar 2006
Posts: 21
Default

Quote:
This domain is parked, pending renewal, or has expired.
Please contact the domain provider with questions.

Sup with that?
I just forgot to pay for domain
I have another place to upload.
karioth is offline  
Old 09.04.2006, 16:25   #32
Digital
Архивный участник
 
Join Date: Nov 2004
Posts: 1,405
Default

well.. seriously didnt have time to design n code this up properly... :S
i'll attach the current file i have n an example of how to use ent lib in different situations... including transactions

i could also provide an alternative logging code if u guys think it's needed.
-out

LINK HERE

[Edit] i've so far only edited DBAdapter n the mssql version is in DBAdapterMSSQL.cs enjoy
Digital is offline  
Old 09.04.2006, 17:35   #33
ramon1
Архивный участник
 
Join Date: Jul 2005
Posts: 50
Default nice

nice work di thanks i go to help i whit for thats
ramon1 is offline  
Old 15.04.2006, 07:46   #34
Digital
Архивный участник
 
Join Date: Nov 2004
Posts: 1,405
Default

ops.. forgot to give examples
here we go... some simple uses of ent lib

using System;
using System.Data;
using System.Globalization;
using System.Text;
using System.Xml;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;

namespace DataAccessQuickStart
{
/// <summary>
/// Encapulsates access to the database.
/// </summary>
public class SalesData
{
public SalesData()
{
}

/// <summary>
/// Retreives a list of customers from the database.
/// </summary>
/// <returns>List of customers in a string.</returns>
/// <remarks>Demonstrates retrieving multiple rows of data using
/// a DataReader</remarks>
public string GetCustomerList()
{
// DataReader that will hold the returned results
// Create the Database object, using the default database service. The
// default database service is determined through configuration.
Database db = DatabaseFactory.CreateDatabase();

string sqlCommand = "Select CustomerID, Name, Address, City, Country, PostalCode " +
"From Customers";
DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);

StringBuilder readerData = new StringBuilder();

// The ExecuteReader call will request the connection to be closed upon
// the closing of the DataReader. The DataReader will be closed
// automatically when it is disposed.
using (IDataReader dataReader = db.ExecuteReader(dbCommand))
{
// Iterate through DataReader and put results to the text box.
// DataReaders cannot be bound to Windows Form controls (e.g. the
// resultsDataGrid), but may be bound to Web Form controls.
while (dataReader.Read())
{
// Get the value of the 'Name' column in the DataReader
readerData.Append(dataReader["Name"]);
readerData.Append(Environment.NewLine);
}
}

return readerData.ToString();
}

/// <summary>
/// Retreives all products in the specified category.
/// </summary>
/// <param name="Category">The category containing the products.</param>
/// <returns>DataSet containing the products.</returns>
/// <remarks>Demonstrates retrieving multiple rows using a DataSet.</remarks>
public DataSet GetProductsInCategory(int Category)
{
// Create the Database object, using the default database service. The
// default database service is determined through configuration.
Database db = DatabaseFactory.CreateDatabase();

string sqlCommand = "GetProductsByCategory";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

// Retrieve products from the specified category.
db.AddInParameter(dbCommand, "CategoryID", DbType.Int32, Category);

// DataSet that will hold the returned results
DataSet productsDataSet = null;

productsDataSet = db.ExecuteDataSet(dbCommand);

// Note: connection was closed by ExecuteDataSet method call

return productsDataSet;
}

/// <summary>
/// Updates the product database.
/// </summary>
/// <returns>The number of rows affected by the update.</returns>
/// <remarks>Demonstrates updating a database using a DataSet.</remarks>
public int UpdateProducts()
{
// Create the Database object, using the default database service. The
// default database service is determined through configuration.
Database db = DatabaseFactory.CreateDatabase();

DataSet productsDataSet = new DataSet();

string sqlCommand = "Select ProductID, ProductName, CategoryID, UnitPrice, LastUpdate " +
"From Products";
DbCommand dbCommand = db.GetSqlStringCommand(sqlCommand);

string productsTable = "Products";

// Retrieve the initial data
db.LoadDataSet(dbCommand, productsDataSet, productsTable);

// Get the table that will be modified
DataTable table = productsDataSet.Tables[productsTable];

// Add a new product to existing DataSet
DataRow addedRow = table.Rows.Add(new object[] {DBNull.Value, "New product", 11, 25});

// Modify an existing product
table.Rows[0]["ProductName"] = "Modified product";

// Establish our Insert, Delete, and Update commands
DbCommand insertCommand = db.GetStoredProcCommand("AddProduct");
db.AddInParameter(insertCommand, "ProductName", DbType.String, "ProductName", DataRowVersion.Current);
db.AddInParameter(insertCommand, "CategoryID", DbType.Int32, "CategoryID", DataRowVersion.Current);
db.AddInParameter(insertCommand, "UnitPrice", DbType.Currency, "UnitPrice", DataRowVersion.Current);

DbCommand deleteCommand = db.GetStoredProcCommand("DeleteProduct");
db.AddInParameter(deleteCommand, "ProductID", DbType.Int32, "ProductID", DataRowVersion.Current);

DbCommand updateCommand = db.GetStoredProcCommand("UpdateProduct");
db.AddInParameter(updateCommand, "ProductID", DbType.Int32, "ProductID", DataRowVersion.Current);
db.AddInParameter(updateCommand, "ProductName", DbType.String, "ProductName", DataRowVersion.Current);
db.AddInParameter(updateCommand, "LastUpdate", DbType.DateTime, "LastUpdate", DataRowVersion.Current);

// Submit the DataSet, capturing the number of rows that were affected
int rowsAffected = db.UpdateDataSet(productsDataSet, "Products", insertCommand, updateCommand,
deleteCommand, UpdateBehavior.Standard);

return rowsAffected;

}

/// <summary>
/// Retrieves details about the specified product.
/// </summary>
/// <param name="productID">The ID of the product used to retrieve details.</param>
/// <returns>The product details as a string.</returns>
/// <remarks>Demonstrates retrieving a single row of data using output parameters.</remarks>
public string GetProductDetails(int productID)
{
// Create the Database object, using the default database service. The
// default database service is determined through configuration.
Database db = DatabaseFactory.CreateDatabase();

string sqlCommand = "GetProductDetails";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand);

// Add paramters
// Input parameters can specify the input value
db.AddInParameter(dbCommand, "ProductID", DbType.Int32, productID);
// Output parameters specify the size of the return data
db.AddOutParameter(dbCommand, "ProductName", DbType.String, 50);
db.AddOutParameter(dbCommand, "UnitPrice", DbType.Currency, 8);

db.ExecuteNonQuery(dbCommand);

// Row of data is captured via output parameters
string results = string.Format(CultureInfo.CurrentCulture, "{0}, {1}, {2:C} ",
db.GetParameterValue(dbCommand, "ProductID"),
db.GetParameterValue(dbCommand, "ProductName"),
db.GetParameterValue(dbCommand, "UnitPrice"));

return results;
}

/// <summary>
/// Retrieves the specified product's name.
/// </summary>
/// <param name="productID">The ID of the product.</param>
/// <returns>The name of the product.</returns>
/// <remarks>Demonstrates retrieving a single item. Parameter discovery
/// is used for determining the properties of the productID parameter.</remarks>
public string GetProductName(int productID)
{
// Create the Database object, using the default database service. The
// default database service is determined through configuration.
Database db = DatabaseFactory.CreateDatabase();

// Passing the productID value to the GetStoredProcCommand
// results in parameter discovery being used to correctly establish the parameter
// information for the productID. Subsequent calls to this method will
// cause the block to retrieve the parameter information from the
// cache, and not require rediscovery.
string sqlCommand = "GetProductName";
DbCommand dbCommand = db.GetStoredProcCommand(sqlCommand, productID);

// Retrieve ProdcutName. ExecuteScalar returns an object, so
// we cast to the correct type (string).
string productName = (string) db.ExecuteScalar(dbCommand);

return productName;
}

/// <summary>
/// Retrieves a list of products.
/// </summary>
/// <returns>A list of products as an XML string.</returns>
/// <remarks>Demonstrates retrieving multiple rows of data as XML. This
/// method is not portable across database providers, but is
/// specific to the SqlDatabase.</remarks>
public string GetProductList()
{
// Use a named database instance that refers to a SQL Server database.
SqlDatabase dbSQL = DatabaseFactory.CreateDatabase() as SqlDatabase;

// Use "FOR XML AUTO" to have SQL return XML data
string sqlCommand = "Select ProductID, ProductName, CategoryID, UnitPrice, LastUpdate " +
"From Products FOR XML AUTO";
DbCommand dbCommand = dbSQL.GetSqlStringCommand(sqlCommand);

XmlReader productsReader = null;
StringBuilder productList = new StringBuilder();

try
{
productsReader = dbSQL.ExecuteXmlReader(dbCommand);

// Iterate through the XmlReader and put the data into our results.
while (!productsReader.EOF)
{
if (productsReader.IsStartElement())
{
productList.Append(productsReader.ReadOuterXml());
productList.Append(Environment.NewLine);
}
}
}
finally
{
// Close the Reader.
if (productsReader != null)
{
productsReader.Close();
}

// Explicitly close the connection. The connection is not closed
// when the XmlReader is closed.
if (dbCommand.Connection != null)
{
dbCommand.Connection.Close();
}
}

return productList.ToString();
}

/// <summary>
/// Transfers an amount between two accounts.
/// </summary>
/// <param name="transactionAmount">Amount to transfer.</param>
/// <param name="sourceAccount">Account to be credited.</param>
/// <param name="destinationAccount">Account to be debited.</param>
/// <returns>true if sucessful; otherwise false.</returns>
/// <remarks>Demonstrates executing multiple updates within the
/// context of a transaction.</remarks>
public bool Transfer(int transactionAmount, int sourceAccount, int destinationAccount)
{
bool result = false;

// Create the Database object, using the default database service. The
// default database service is determined through configuration.
Database db = DatabaseFactory.CreateDatabase();

// Two operations, one to credit an account, and one to debit another
// account.
string sqlCommand = "CreditAccount";
DbCommand creditCommand = db.GetStoredProcCommand(sqlCommand);

db.AddInParameter(creditCommand, "AccountID", DbType.Int32, sourceAccount);
db.AddInParameter(creditCommand, "Amount", DbType.Int32, transactionAmount);

sqlCommand = "DebitAccount";
DbCommand debitCommand = db.GetStoredProcCommand(sqlCommand);

db.AddInParameter(debitCommand, "AccountID", DbType.Int32, destinationAccount);
db.AddInParameter(debitCommand, "Amount", DbType.Int32, transactionAmount);

using (DbConnection connection = db.CreateConnection())
{
connection.Open();
DbTransaction transaction = connection.BeginTransaction();

try
{
// Credit the first account
db.ExecuteNonQuery(creditCommand, transaction);
// Debit the second account
db.ExecuteNonQuery(debitCommand, transaction);

// Commit the transaction
transaction.Commit();

result = true;
}
catch
{
// Rollback transaction
transaction.Rollback();
}
connection.Close();

return result;
}
}
}
}
Digital is offline  
Old 15.04.2006, 13:43   #35
drzoom
Архивный участник
 
Join Date: Aug 2005
Posts: 428
Default

Digital, will be better if u attach your file
drzoom is offline  
Old 16.04.2006, 10:23   #36
Digital
Архивный участник
 
Join Date: Nov 2004
Posts: 1,405
Default

i've my codes attached in the link above..
as for the example, it's taken from enterprise library jan 2006
quick start block -> data access block -> c#

good luck to all
Digital is offline  
Old 03.05.2006, 19:27   #37
karioth
Архивный участник
 
Join Date: Mar 2006
Posts: 21
Default

Hi, every1,
server in process,

need any help how to use geodata from client files.
karioth is offline  
Old 03.05.2006, 19:31   #38
toolpunk
Архивный участник
 
Join Date: May 2005
Posts: 2,033
Default

hmm...
something like l2j's system?
toolpunk is offline  
Old 03.05.2006, 20:11   #39
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default

I think, using client geo is bad idea... I know how this work in l2j, blocked movement with keyboard arrow keys are bad a lot! And now some peoples starts making geodata for l2j for fix it.
Not need to repeat another's mistakes...
hel is offline  
Old 04.05.2006, 04:11   #40
Digital
Архивный участник
 
Join Date: Nov 2004
Posts: 1,405
Default

if possible it'd be good to use back whatever we have for l2 off...
geodata, scripts, etc?
as this will all could well be reused when we move on to c6
(massive reducation of redoing work that's already done?)

and this will be where our jumping board would be...
(at least that's what i hoped)

karioth's already doing with the basic gameserver?
(at least that's what i think? lol)
Digital is offline  
Old 09.05.2006, 09:16   #41
Bacek
Архивный участник
 
Join Date: Apr 2006
Posts: 110
Default

Why do you think that is not possible to use geo from client files? IMHO it will be better to create small parser from client geo to use in L2C#, than fix and hex everything.. Better to star new, than try to fix a lot of mistakes..

/rus/ а почему нельзя использовать гео из клиентской части? помоему если написать нормальный парсер с нуля который создаст свой формат для L2C#, то отпадет большинство нестыковок и вообще помоему одно дело исправлять и совсем другое писать по новой уже без ошибок и с учетом всего! /rus/
Bacek is offline  
Old 09.05.2006, 11:17   #42
Digital
Архивный участник
 
Join Date: Nov 2004
Posts: 1,405
Default

speed is the essence.
u have to understand y there's geodata in the first place
and what it is for...
ncsoft didnt make geodata out for fun
Digital is offline  
Old 11.05.2006, 13:15   #43
Stormi
Архивный участник
 
Join Date: Nov 2005
Posts: 15
Default

Yup. Geo is the first MUST HAVE requirements for any new L2 server emu. The second MUST HAVE is OFF-like formulas, if you understand me - the one that I have no idea where to get... BTW, i do not think that any dev team will use any of existent file format. It is easyer to write converter than support NC files sometimes And if you have sources you can hardcode a lot of stuff into the server, for example, it does not matter (for small team I mean) what to do - change AI in C# or in the pseudo-asm like NC did. It is just processor and nemory usage question.
Stormi is offline  
Old 11.05.2006, 14:26   #44
Digital
Архивный участник
 
Join Date: Nov 2004
Posts: 1,405
Default

:S well... part right and wrong (imo)
l2 off geodata is probably the most efficient by far.
and that is if u really understand the structure of geodata

just to save ppl from repeated post i'll write a simple explaination as to y
1. client geodata is used to build the "world"
2. to let the server "use" the client geodata...
2.1 the server has to build the world using the client geodata first
2.2 then it has to regenerate all the movable axis and heights and layers, blah blah blah
2.3 then it'll have to compare it to the current mob location, player, etc, blah blah
2.4 multiply this by the number of 1k++ users and 4k++ mob u have.. hohoho

final sum = lag festival
Digital is offline  
Old 11.05.2006, 16:24   #45
Hackfaq
Архивный участник
 
Join Date: Feb 2006
Posts: 6
Default

karioth, what client do you use to test your server?
Clean C4 Client From lineage2.com ?
Hackfaq is offline  
Old 11.05.2006, 17:12   #46
Stormi
Архивный участник
 
Join Date: Nov 2005
Posts: 15
Default

Quote:
1. client geodata is used to build the "world"
With nice tool from HD it is just question of time
Quote:
2.1 the server has to build the world using the client geodata first
Sure. As you said format is efficient. Just use memory layout as in file - make big square (2d arrays), in each element make arrays of smaller squares and so on until you get 3D array of 8x8 plates with heights. This way will give you exact square where item located with few iterations. No huge cycles - less cpu usage and faster answer from server.
Quote:
2.2 then it has to regenerate all the movable axis and heights and layers, blah blah blah
Just make pointers between squares from NSEW bits? It will use at least 4 times more ram than file size but will significantly speed up path finding...
Quote:
2.3 then it'll have to compare it to the current mob location, player, etc, blah blah
Just having fast method to locate square where item located will make this compare fast, isnt it?
Quote:
2.4 multiply this by the number of 1k++ users and 4k++ mob u have.. hohoho
Heh.... Maybe you want to say 40K++ mob? I belive we have 4K+ classes but each class have at least 10 (just got this number from /dev/random) instanses in the word or i'm wrong? Who can tell how many creatures in the world server should support? I have no idea, just a lot... So 1K++ users is not a big problem
Quote:
final sum = lag festival
If NC did this, we also can... Or can not?
Stormi is offline  
Old 12.05.2006, 02:35   #47
Digital
Архивный участник
 
Join Date: Nov 2004
Posts: 1,405
Default

jesus...
how fast would it be if u are to recompile the whole world using the client geodata then regenerate them into geodata before getting the correct position for the mob every time?

geodata is a pre-compiled version of the the processed client geodata.
after which it is loaded into memory during server loading.
thus the locating of the cell during runtime is efficient.

the example in the previous post is what might happen if they actually use client geodata directly.
unlike what i've explained above which is what ncsoft is doing.
of cause there's the pathnode.bin file as well for mob ai... but well..
that's another story of cause.
Digital is offline  
Old 19.05.2006, 19:28   #48
karioth
Архивный участник
 
Join Date: Mar 2006
Posts: 21
Default

Quote:
Originally Posted by Digital
l2 off geodata is probably the most efficient by far.
have you last geo from C4 off server?
but client has
this is the only and the most important reason to use client geo

as for efficient, Nikolas Virt said "Programs are algoritms and data structures".
so speed === geo representation in mem
karioth is offline  
Old 19.05.2006, 19:31   #49
karioth
Архивный участник
 
Join Date: Mar 2006
Posts: 21
Default

Quote:
Originally Posted by Hackfaq
karioth, what client do you use to test your server?
Clean C4 Client From lineage2.com ?
now all test code works with C3, protocol 560
i'll add protocol 656 soon
karioth is offline  
Old 20.05.2006, 11:08   #50
Digital
Архивный участник
 
Join Date: Nov 2004
Posts: 1,405
Default

yes the client has the file... and of cause we dun have the geodata,
but it could be made... just like l2j's datapack... everything could be made... teams could be formed, people could be found, even more people could contribute to the works, since this is just simple but tedious work.

but i'm debating logically, do u really want to compile and compute the geodata during runtime for every player, mob, npc, etc? (this is the case if u use client files)

and really, thank god u are still working on this project karioth
hope to see some new working sources soon
Digital is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 19:05.