# Project Settings

## 1. Set up your project

Set up projects for each environment.

### :black\_small\_square: [C++](/proudnet.eng/proudnet/2.setting/c++.md)&#x20;

### :black\_small\_square: [C#](/proudnet.eng/proudnet/2.setting/c.md)

### :black\_small\_square: [Mac Xcode](/proudnet.eng/proudnet/2.setting/mac-xcode.md)

### :black\_small\_square: [Linux](/proudnet.eng/proudnet/2.setting/linux.md)

### :black\_small\_square: [Unity3D](/proudnet.eng/proudnet/2.setting/unity3d.md)

### :black\_small\_square: [Unreal Engine 4](/proudnet.eng/proudnet/2.setting/unreal-engine-4.md)

## 2. Creating a PIDL file

To use <mark style="color:orange;">Remote Method Invocation(RMI)</mark> in ProudNet, you must first create a file with the PIDL extension.

The PIDL file is the source file that defines the messages that will be sent and received between the hosts. Compiling the PIDL file will create a <mark style="color:orange;">proxy</mark> and a <mark style="color:orange;">stub</mark>, which will be included in the host program.

{% hint style="danger" %}
Do not specify a message first ID value of 60,000 or higher.\
Values above 60,000 are already specified as message ID values in ProudNet's internal PIDL. Overlapping message IDs will cause an exception in the <mark style="color:orange;">AttachProxy</mark> and <mark style="color:orange;">AttachStub</mark> functions.
{% endhint %}

The following are the basic usage formats for PIDL files.

{% tabs %}
{% tab title="PIDL" %}

```cpp
global <Namespace> <The first ID value in the message>
{
    ([Declaring attributes]) <Declaring functions> ( [in] Function parameters, ... );
}
```

{% endtab %}
{% endtabs %}

{% hint style="info" %} <mark style="color:orange;">**Namespace**</mark>\
The C++ namespace name of the proxy, stub module that is generated when the PIDL file is compiled.\
A namespace is essential because ProudNet can use more than one proxy, stub, or stubs at once, but the ambiguity must be resolved with a namespace. \
For example, if you declare "LobbyC2S", it means "Declare a client -> server call RMI in the game lobby".\
\ <mark style="color:orange;">**The first ID value in the message**</mark>\
When invoked, each RMI is converted to a network message, which will have an ID value in the message header.\
It is important to note that it is common to have multiple proxies and stubs for inter-process communication, and they should not have overlapping message ID ranges.\
\ <mark style="color:orange;">**Declaring attributes**</mark>\
\[in] declaration is required.\
\ <mark style="color:orange;">**Declaring functions**</mark>\
The name of the RMI function.\
\ <mark style="color:orange;">**Function parameters**</mark>\
It is similar to a C++ function declaration. Parameters are allowed to be declared as follows, but pointer types are not.

```cpp
int a 
std::vector<int> b
CString c
```

{% endhint %}

An example PIDL file is shown below.

{% tabs %}
{% tab title="PIDL" %}

```cpp
rename cs(Proud::String, System.String);

global LobbyC2S 5000  // Message ID starts at 5000
{
    // ID=5001
    Logon([in] Proud::String name,[in] Proud::String password);
    RequestRoomList([in] int pageNumber); // ID=5002
    Chat([in] Proud::String name); // ID=5003
}
```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
**Reference**

[**RMI**](/proudnet.eng/proudnet-note/dictionary.md#rmi)

[**RMI message scope**](/proudnet.eng/proudnet/using_pn/rmi.md#rmi-message-scope)
{% endhint %}

## 3. [Running the PIDL compiler](/proudnet.eng/proudnet/2.setting/running-the-pidl-compiler.md)

Run the PIDL compiler

## 4. [Starting a server and a client](/proudnet.eng/proudnet/using_pn/server_client.md#undefined)

Start a server and client to prepare of using ProudNet.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.proudnet.com/proudnet.eng/proudnet/2.setting.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
