For$
<!-- begin site header -->
<div id=

Author Topic: What does Mineserver need to get off the ground quickly?  (Read 40660 times)

louisdx

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: What does Mineserver need to get off the ground quickly?
« Reply #15 on: April 01, 2011, 02:47:38 pm »
As for compatibility with 1.4 it should be enough to change the Protocol version from 9 to 10. No new client side packets have been added as far as i can tell.

My thoughts exactly, which is why I wanted to find out how the protocol works and where the networking code is. I hope to get this working soon!

Ligustah

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: What does Mineserver need to get off the ground quickly?
« Reply #16 on: April 01, 2011, 03:31:36 pm »
I've only had a few looks at the source code and to me it looked like there was
no central place at which protocol handling takes place. At least not for server->client
packets.
It might be a good idea to somehow write classes or functions to generically
send data to clients. That might ease optimizations and makes finding/fixing bugs easier.

Oh, btw:
In constants.h:156
Code: [Select]
const int PROTOCOL_VERSION = 9;
Changing that to 10 should allow 1.4 clients to connect.

louisdx

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: What does Mineserver need to get off the ground quickly?
« Reply #17 on: April 02, 2011, 07:47:18 pm »
Cheers, I discovered that too and it's all working now. I've started a fork in which I'm working on some mild but satisfying stylistic improvements while getting to know the code -- most importantly, I've set the gcc compiler flags to "-W -Wall -Wno-unused -pedantic" and compile without warnings now.

Would anyone like to test if my fork builds on MSVS and MacOSX? :-)

There are some general issues I would like to suggest which don't require deep understanding of the code; what's the best way of discussing those? (E.g. using "++i" rather than "i++", and the state of the current coding style and enforcing it.)

A tempting question is whether we could switch to C++0x to use variadic templates, which would clean up "hook.h"  a lot :-) But that's not at all urgent.

Ligustah

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: What does Mineserver need to get off the ground quickly?
« Reply #18 on: April 02, 2011, 08:27:35 pm »
A little offtopic:
Is there a difference between ++i and i++ except for when the incrementation is done?

louisdx

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: What does Mineserver need to get off the ground quickly?
« Reply #19 on: April 02, 2011, 08:42:25 pm »
A little offtopic:
Is there a difference between ++i and i++ except for when the incrementation is done?
Yes! Think about the return value -- "i++" is an rvalue, and theoretically there needs to be a copy, involving a constructor and all that. Perhaps if you're lucky the compiler will realise that the return value isn't needed in something like a for loop, but you might as well write it explicitly and demonstrate that your code is fully intentional. (The same applies to iterators.)

Ligustah

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: What does Mineserver need to get off the ground quickly?
« Reply #20 on: April 03, 2011, 12:10:39 pm »
If i am not mistaken ++i is an rvalue as well.
I have never written code in C++ but in most languages i know you can write something like
Code: [Select]
int i = 0;
int j = ++i;

It's just about whether i is incremented before setting j or afterwards, isn't it?

louisdx

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: What does Mineserver need to get off the ground quickly?
« Reply #21 on: April 03, 2011, 11:33:33 pm »
If i am not mistaken ++i is an rvalue as well.

Every lvalue can also be used as an rvalue.

Quote
It's just about whether i is incremented before setting j or afterwards, isn't it?

The post-increment has to - at least in principle - keep a copy of the original value, then update the variable, and then return the original copy. If copying is expensive, this had better be avoided, but it's just good practice to use the best expression that represents what you mean, rather than just any old expression that happens to work. Sure, in the for-loop case the compiler probably knows how to optimise this away (compare the assembly if you're not sure), but why not just use the right thing from the start...

Ligustah

  • Newbie
  • *
  • Posts: 42
    • View Profile
Re: What does Mineserver need to get off the ground quickly?
« Reply #22 on: April 04, 2011, 02:56:29 am »
I see, thanks for your explanation.
[/offtopic] :P

MechWarrior001

  • Newbie
  • *
  • Posts: 31
    • View Profile
Re: What does Mineserver need to get off the ground quickly?
« Reply #23 on: April 06, 2011, 03:22:26 am »
If only i even knew what that was without using google...  :o

You and me both.

But concerning testing, I'm in the process of setting up a Fedora 14 file server on a HP Proliant ML370 G3 w/ Dual Xeon 2.8Ghz CPUs, so if you need some testing I'd be willing to help.

ojjy

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: What does Mineserver need to get off the ground quickly?
« Reply #24 on: April 20, 2011, 07:25:58 pm »
You can help me calculate some integrals.

Which integrals? And do you mean numerically or are you looking for an analytical solution?