Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3437470
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:04:09+00:00 2026-05-18T08:04:09+00:00

I am working on a client/server game (C#.NET) where I do not want to

  • 0

I am working on a client/server game (C#.NET) where I do not want to trust the client to hold any of my server side application code, but want to share objects.

For example imagine you have a right hand weapon slot and a backpack that can carry additional items. Now there’s a lot of server side code that will control which items can go in which slots and when you swing your right hand what happens. I don’t want to put this code in my client for various reasons, but I am finding often times that if I generate a client side class and server side class for each of these that I see a lot of duplication in data and some duplication in methods. I also have to convert 1 class into the other.

Another example is For Items in the game. Item’s have ‘Use’ abilities (like Use a key, or Use a torch) and properties like Name and Weight. So When I create the Item Class I would prefer to make 1 class like this:

Public Class Item  
{

  int Weight; 

  string Name;

  void Use() { //Do something interesting but not public to the client } 

}

Eventually copies of this object are serialized and sent to the client or server from each other as changes are made. If a Partial Class could span projects that would be very promising (to bad they don’t). I don’t think sub-classing feels right here (like ServerItem : Item) considering Serialization/Deserialization. I will play around some with Extension methods and see what implications there are for sub-classing but if anyone has any ideas or if I’m just missing something obvious please let me know.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T08:04:10+00:00Added an answer on May 18, 2026 at 8:04 am

    You really want to separate Data from Behaviour, and have just lightweight share-able data classes, and then (on the server) have server-centric classes that use data to determine behaviour. (try looking at a few design patters – maybe ‘Decorator’)

    One lightweight example of what you may want is:

     // lightweight data class thats shared
    public class Item
    {
        public int Weight { get; set;  }
        public string Name { get; set; }
    }
    
    // decorator pattern class that adds behaviour
    public class ServerItem
    {
        private Item item;
        public ServerItem(Item item)
        {
            this.item = item;
        }
    
        public void Use()
        {
            // do something with item;
        }
    }
    
    ServerItem currentServerItem = new ServerItem(currentItem);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am working on a client-server application that uses boost::serialization library for it's serialization
I've got a working SOAP::Lite client. It works against an established server, but so
i'm working on a Client-Server Game with a tilebased map. If the user changes
My asp.net site has to run on several client servers. It's working fine on
I'm working with a client that needs to generate millions of the alphanumeric codes
I'm working with a client to plan the topology for a public facing SharePoint
I am working on a client proposal and they will need to upgrade their
I am currently working for a client who are petrified of changing lousy un-testable
Hiya I am working on an FTP client, can someone tell me the difference
We are working on a website for a client that (for once) is expected

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.