Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Running Stream of Questions...

Status
Not open for further replies.

Tdata

Sponsor

*Note this is being programmed in C#.

My first thing is: What is the best way to do a Research Tree type setup.

Currently I am thinking of using 2 lists. One for the what the player has researched and one for the tree. The problem I see developing soon after the player starts researching things, the game will start to lag while it searches thought the lists to see if the player has the requirements.

EX:

Basic Research has no requirements (Other than the cost that is already in place)
Intermediate Research Requires Basic Research
ETC...

Basic Missiles require Intermediate Explosives, Intermediate Research, Basic Propulsion.
Intermediate Missiles Require Basic Missiles, Intermediate Propulsion.

You get the picture... It will lag like hell after a few levels... I want a good Idea on how to do this better...

(I will have more Game Related Questions... I'll post them in here.)
 

Tdata

Sponsor

Binary/Non-Binary Trees? To be honest, I have never worked with them before. And, since you brought it up, I haven't seen any good examples on how to use it for my situation.
Code:
 

    A

   / \

  B   C

 / \ / \

D   E   F

 \  |  /

  \ | /

    G

 
 

e

Sponsor

What you say sounds more like a directed graph structure, where each node (or upgrade) can be connected to any other, but with a given direction (A -> B, B doesn't go to A). Something like a Directed Acyclic Word Graph. Although I might be wrong, and you'd just need a regular directed acyclic graph, but the DAWG (eh) sounds more like your thing.

250px-Trie-dawg.svg.png
 

Tdata

Sponsor

To be honest, in my example:

B and C need A
D Needs B
E Needs B and C
F Needs C
G Needs D, E, and F...


Now for my second question.

Using WCF how exactly do I setup a Client/Server Application?
I have been told that I have to have a Service that the Server connects to. I have been programming under the assumption that you do not need to have a separate Service to run the server, so I have no clue how to actually do it. Also, what do I set the URI to in the server.

Here is what I am Currently working with:
Code:
 

 ServiceHost host = new ServiceHost(

                    typeof(Actions),

                    new Uri[]{

                    new Uri("net.[url=pipe://localhost]pipe://localhost[/url]"),

                    new Uri("http://localhost:48921")

                });

                

                    

                    host.AddServiceEndpoint(typeof(IActions),

                        new BasicHttpBinding(),

                        "UC");

                     

 

                    host.AddServiceEndpoint(typeof(IActions),

                        new NetNamedPipeBinding(),

                        "PipeUC");

                    ServiceBehaviorAttribute atr = new ServiceBehaviorAttribute();

                    atr.IncludeExceptionDetailInFaults = true;

 

                    host.Open();

 

                    Console.WriteLine("Service is available. " +

                      "Press <ENTER> to exit.");

                    Console.ReadLine();

 

                    host.Close();

 

And For the Client:
Code:
 

pipeFactory =

                new ChannelFactory<IActions>(

                    new NetNamedPipeBinding(),

                    new EndpointAddress(

                        "net.[url=pipe://localhost/PipeUC]pipe://localhost/PipeUC[/url]"));

            pipeProxy = pipeFactory.CreateChannel();

 

            httpFactory =

                new ChannelFactory<IActions>(

                    new BasicHttpBinding(),

                    new EndpointAddress(

                        "http://localhost:48921/UC"));

            httpProxy = httpFactory.CreateChannel();

            

 

It works until I try to use anything but localhost...
 
Status
Not open for further replies.

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top