Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


bauer

Member Since 03 Dec 2001
Offline Last Active Jan 12 2014 05:21 AM

Posts I've Made

In Topic: Trouble understanding Enet tutorial

11 August 2013 - 05:17 AM

One thing that I can recommend btw is to use one channel for reliable msgs and at least one for non-reliable.

Some non-100%-sure answers:
Afaik Enet is a very thin layer on top of UDP, which means that youll have to do a lotofstuff yourself, such as calculating the data rate, ping, etc.

I think it maintains its own copies of the data.

About your example with lost packets when sent unreliably on the same channel, I guess this can/will happen evey now and then but in the general case they should both arrive in order. I wouldnt recommend a channel per msg type though, but it could be an idea to use different channels based on update rate. Ie you might send positions and rotations each frame on one channel, and send something like powerup status or time played updates every 100ms on a different channel.

This gotme excited to dev another mp game. :)

In Topic: Trouble understanding Enet tutorial

09 August 2013 - 06:17 AM

Hm I'm afraid I can't answer most of your questions right now, they are probably more suited for the ENet developers. I haven't used ENet much in the last year and I've never checked through the source. I need to dig up some source code from old projects to get a better grip on how I used to do things. :)


In Topic: Trouble understanding Enet tutorial

25 June 2013 - 01:09 PM

ENET_HOST_ANY means that the server will accept incoming connections from any address. The other way would be to specify a specific IP, but then you'd only be able to receive traffic from that specific IP. So this address parameter is only used for specifying the address of allowed incoming connections.

 

A client won't be listening for new connections so it uses NULL in that case (it will only connect to other servers, it won't receive connections).

 

It's true that both server and client needs the ENetHost/enet_host_create() in order to function, I view this as the network system backend basically.

 

In addition to the ENetHost, the client also needs an ENetPeer as described in the Connecting to an ENet Host section at the bottom. In this section you specify the address and port to the server and then initiate the connection with enet_host_connect().

 

An ENetPeer is essentially a connection, the client has a single ENetPeer which is the connection to the server. 

The server however receives a new ENetPeer in the ENET_EVENT_TYPE_CONNECT, i.e when a new client connects. So when this event happens, it makes sense to save the peer in a list (and somehow associate it with a player id in your game).

 

These ENetPeer structures are used as recipients/targets when sending packets.

 

The documention is a bit lacking and the way things are named makes it a bit confusing, but after you get used to it and have managed to get a decent framework around it the small and simple interface is really nice to work with! 


In Topic: Calculating In-Game map positions

05 December 2012 - 06:21 AM

If you already have a top-down overview image of your map, you could just convert your object's position into "minimap coords".

To convert between real coordinates and minimap coordinates:
normalized_coordinate = object_position / map_bounds
minimap_coordinate = normalized_coordinate * minimap_bounds

For example:
Real map is 100 units X and 100 units Y
Minimap is 256 pixels wide and 256 pixels high
Object is positioned at 50,50 (center of map)

50 / 100 = 0.5 so the normalized object position would be 0.5, 0.5
0.5 * 256 = 128 so the unit should be positioned at pixel 128,128 in the minimap

Hope that makes sense, this was written while eating a donut :)

Cheers

In Topic: What are some songs that tell stories?

19 March 2011 - 11:32 AM

Songs by Springsteen usually contain some kind of story. :)

PARTNERS