Vjoe Multiplayer Reengineering

From The Battle for Wesnoth Wiki

This page is related to Summer of Code 2011
See the list of Summer of Code 2011 Ideas

This is a Summer of Code 2011 student page
Project: SoC_Ideas_Multiplayer_Improvements_2011



vjoe - Multiplayer Reengineering

The aim of this project is to unify the single and multiplayer modes with the intend of making the game engine more modular, more efficient and easier to extend.


20:04:13 vjoe | Crab_: and fendrin, im ready when u are
20:04:53 fendrin | vjoe: Just one more minute.
20:05:10 fendrin | vjoe, Crab_: Shall we join a new dedicated channel?
20:05:17 vjoe | fendrin: no worries
20:05:21 Crab_ | fendrin: no, here is ok
20:05:45 vjoe | i dont really mind
20:07:02 Crab_ | vjoe: do you have any particular questions about the project or about our selection process ?
20:07:38 vjoe | nop, I still have to familiarize myself with the project (no what to do in general, but the specifics)
20:07:41 vjoe | i will do it this weekend
20:07:51 vjoe | i am sure i will enjoy it thoug
20:08:29 vjoe | nonetheless, i would like to know what you guys have in mind
20:08:37 vjoe | in terms of the reengineering
20:08:57 vjoe | for eg, what is bad at the moment, what needs to be improved, new functionalit
20:09:00 vjoe | I have read the page
20:09:09 vjoe | there is such like the difficulty level and etc
20:09:17 vjoe | but I am sure you guys have additional things in mind
20:09:28 fendrin | I am currently working on the gsoc proposal page for the multiplayer changes.
20:09:47 Crab_ | vjoe: basically, our current multiplayer mode is the extension of our singleplayer mode, with some hacks added in to sync games by transmiting replays over the network
20:10:02 vjoe | yep
20:10:31 fendrin | It is mentioned as a long term goal to get rid of the fact.
20:10:51 vjoe | fendrin: what do you mean? are single and multiplayer treated seperately?
20:10:53 Crab_ | vjoe: our lobby and game creation screens are very basic. lobby is hard to change (in fact, there was an entire gsoc devoted to MP lobby and the results were not good. so , we're forgetting about the lobby for now)
20:11:01 fendrin | Yes.
20:11:07 vjoe | Crab_: yep, i remember when i used to play
20:11:12 vjoe | I haven played since last summer
20:11:19 vjoe | so i dont know if there are some changes
20:11:22 vjoe | will check it out this wkd
20:11:37 Crab_ | vjoe: but, our game creation screen can be improved, especially because now we have new types of multiplayer content such as 'MP campaigns'
20:12:09 Crab_ | vjoe: when creating a new MP campaign, an obvious way to do it is to grab an old SP campaign and make it MP.
20:12:16 vjoe | yep
20:12:17 fendrin | I stop talking until Crab_ is finished with his thoughts.
20:12:23 vjoe | sure
20:12:25 Crab_ | fendrin: thanks
20:12:32 vjoe | Crab_: basically it's all about making it as modular as possible
20:12:47 vjoe | i think it would be good to solve the problem that fendrin mentioned
20:12:50 Crab_ | vjoe: but, this raises questions that the old design is not ready to answer
20:13:05 Crab_ | vjoe: such as the mentioned difficulty level problem
20:13:07 vjoe | it doesnt make sense to have single and mp mode being in seperate streams
20:13:49 vjoe | yes
20:14:09 Crab_ | so, what we want to do is : prepare an architecture which will cover both SP and MP needs, and which will allow dynamic pre-scenario setup. i.e. "you start playing you campaign as SP, then join the mp server, continue with next scenario (changing settings,sides, difficulty levels, scenario-specific flags), ... "
20:14:34 vjoe | hm, so "move" a sp campaign to mp?
20:14:53 Crab_ | vjoe: yes, later, this would allow us to move SP to be MP
20:15:00 vjoe | i dont see how that would be a problem, this is from a conceptual point of view
20:15:13 vjoe | in practice things will need more thought
20:15:15 Crab_ | for that, we'll also need to improve our GUI for scenario setup commands (changing settings,sides, difficulty levels, scenario-specific flags, on scenario start and/or in game)
20:15:36 Crab_ | i.e., so instead of using :droid 2, the player would do some mouse-clicking.
20:15:37 vjoe | yep
20:15:44 vjoe | yup
20:15:59 vjoe | Crab_: does this task involve some UI design then?
20:16:29 Crab_ | vjoe: yes, but mainly we want an engine and some rough prototypes 'hey, we can use our new cool architecture to do things like this'
20:16:38 vjoe | yeah
20:16:43 vjoe | so you want a strong foundation
20:16:47 Crab_ | yes.
20:16:49 Crab_ | exactly
20:16:51 vjoe | that will allow you to extend functionality
20:16:57 vjoe | i think that sounds great and a fantastic challenge
20:17:03 Crab_ | yeah ) basically, that is all from me. note http://wiki.wesnoth.org/Fosdem2011#Multiplayer_.28campaign.29_UI - some random thoughts from Fosdem2011 meeting.
20:17:40 vjoe | oh, there you are!
20:17:41 vjoe | eheh
20:18:05 Crab_ | vjoe: for extra fun, allow the new engine to be used to participate in global multiplayer campaigns (where many people play at different regions which influence the state of the 'game world')
20:18:09 vjoe | ideally we could even have modular UI
20:18:14 vjoe | as in, easy to plug in another UI
20:18:23 vjoe | i'm a bit OCD with modular architectures :P
20:18:34 Crab_ | vjoe: yes, i.e. allow the scenario to specify the UI it wants for the setup screen.
20:18:39 vjoe | Crab_: like in huge terns?
20:18:45 vjoe | turns
20:19:03 Crab_ | vjoe: no, each map is small, but the victory/defeat affects a 'global' state
20:19:09 vjoe | right
20:19:15 vjoe | but that global state needs to be saved somewhere
20:19:20 vjoe | u do already have that?
20:19:24 vjoe | i mean, the infrastructure
20:19:25 vjoe | not the code
20:19:31 vjoe | do u
20:20:01 Crab_ | no, but we have some stuff from 2010: a network library which can be used to connect to wesnoth MP and speak wesnoth MP protocol in high-level terms, and a framework for MP sync of variables in wesnoth.
20:20:16 vjoe | hm
20:20:30 vjoe | so but will be global state be stored client side?
20:20:33 Crab_ | the new engine should need to allow writing that 'global' thing possible in the future (maybe it'll be the topic for new gsoc somewhen :) )
20:20:37 vjoe | we need to be careful with the syncing then
20:20:49 Crab_ | vjoe: I was thinking about a separate 'gamemaster' instance, like a coordinator
20:20:58 vjoe | which will run constantly
20:21:12 Crab_ | yes, by sitting around on wesnoth's mp server and spawning games on demand
20:21:24 vjoe | yeah
20:21:27 vjoe | sounds good
20:21:31 Crab_ | basically 'spawn-observe-note results' routine
20:21:48 vjoe | yup
20:21:55 Crab_ | but we want our MP engine to be cool enough to support that stuff.
20:21:58 vjoe | Crab_: we can even have that idle player in everygame
20:22:02 vjoe | we might think of new things
20:22:05 vjoe | to add
20:22:10 vjoe | its just a different player class
20:22:21 Crab_ | yes, 'we might think of new things' is a essential point there.
20:22:25 vjoe | yup
20:22:28 Crab_ | the amount of fun we can do with current system is limited
20:22:49 vjoe | i totally agree with the "planing for the future" mentality
20:22:51 Crab_ | (not in the DwarfFortress meaning of 'fun', that is)
20:23:07 vjoe | i'm a bit spontaneous in everything in life, except oding
20:23:08 vjoe | coding
20:23:10 vjoe | i have to admit
20:23:11 vjoe | :D
20:23:25 Crab_ | fendrin: I'll let you continue to tell more about the sides of the project that I've missed or not highlighted enough.
20:24:53 Crab_ | (and, about the required skills: there'll be *lots* of fun c++ code to read and write)
20:25:38 vjoe | yeah Crab_ i was telling fendrin yesterday, I dont really have much c++ experience, but that is why I want to do something in c++ for the GSoC
20:25:44 vjoe | it was the same when I started my internship
20:25:47 vjoe | i asked to do perl
20:25:52 vjoe | cause i knew nothing about it
20:25:59 vjoe | i have strong skills in c and java though
20:26:06 vjoe | so I am fine with pointers and oop
20:26:16 vjoe | i'm a fast learner :D
20:27:31 fendrin | The "const" keyword is my biggest problem when comparing c to c++.
20:28:01shadowmas | const also exists in C
20:28:11 vjoe | yar
20:28:11 fendrin | My bad.
20:28:31 fendrin | Never used it in c.
20:28:54shadowmas | ever called printf()? you are passing a const char * argument in the first position ;)
20:29:12 fendrin | Okay, I will continue to talk about unifying multi and single player code paths.
20:29:33 vjoe | cool
20:30:06 fendrin | This task was marked as "long term" because it was considered very hard to archive.
20:30:52 fendrin | But my experiences with converting "The Legend of Wesmere" in both a single and a multiplayer campaign may suggest that this is not actually true.
20:31:13 vjoe | fendrin: I'm a "glass half full" kind of guy
20:31:18 vjoe | nothing is too hard :D
20:31:39 vjoe | nevertheless, hard is good, I mean, it's a 3 month project, I want to have something to do
20:31:49 vjoe | this is literally my job for the summer
20:31:50 vjoe | :)
20:32:04 fendrin | Fine, the world needs more people with that attitude these days.
20:32:51 fendrin | In fact I would start with unifying the paths and do the rest with a clean codebase/solution later.
20:34:09 vjoe | well fendrin, if the idea is to unify both sp and mp, we need to literally start from scratch
20:34:17 vjoe | it's a whole new architecture, right?
20:34:27 fendrin | If you replace every [scenario] with a [multiplayer] tag of a campaign and modify the include hierarchy so that the scenarios are going to be processed when entering the multiplayer lobby you can basicaly play a singleplayer campaign on the server or via a local multiplayer game.
20:34:36 fendrin | Sorry for the long sentence.
20:34:39 vjoe | np
20:34:48 vjoe | yeah
20:34:49 vjoe | i get it
20:34:53 vjoe | as modular as possible
20:35:02 vjoe | with all the "content" being provided externally
20:35:07 vjoe | absolutely
20:35:09-!- eoc is now known as the_gammler
20:35:14 vjoe | 1 sec, brb, need to get something from downstairs
20:35:29 fendrin | Wait, I don't get what you mean right now :-)
20:36:01-!- the_gammler is now known as eoc|afraid
20:36:16 fendrin | eoc|afraid: Why are you afraid?
20:36:33-!- eoc|afraid is now known as eoc
20:36:36 eoc | :)
20:36:45 vjoe | back
20:37:19 vjoe | fendrin: arent the campaigns modules?
20:37:23 vjoe | as in, external to the engine
20:37:40 fendrin | Well, they are all coded in WML which is not part of the engine.
20:37:42 vjoe | i just meant that a single engine should be able to process/interpret different kinds of campaigns
20:37:55 vjoe | but doesnt the engine parse the markup lang?
20:38:28 fendrin | Right, the engine preprocesses, parses and processes the WML.
20:38:33 vjoe | yeah
20:38:38 fendrin | Basically Wesnoth is just a WML processor.
20:38:43 vjoe | yeah exactly
20:39:02 vjoe | i was just reiterating that the same engine should parse all the possible WML
20:39:15 vjoe | either mp or sp
20:39:29 fendrin | You can call a campaign a module since each is guarded with its own preprocessor symbol meaning that you only parse the campaign the moment it gets selected.
20:40:14 vjoe | yeah
20:40:16 fendrin | The fact that this is not true for the multiplayer content is the core of the gsoc project.
20:40:24 vjoe | yep
20:40:50 vjoe | that's what Crab was telling me, that the goal is to take down that barrier between sp and mp
20:41:19 fendrin | Yepp, that is another view to the problem, equaly valid.
20:41:23 Crab_ | vjoe: note that wesnoth as a 'wml engine, is stateful - at each moment of time, it has preprocessed certain things in a certain way and cached the results.
20:42:32 vjoe | yeah
20:42:49 vjoe | that is good though, it makes the engine as light and micro as possible
20:42:53 vjoe | caching is good :D
20:43:10 fendrin | Crab_ is telling that Wesnoth is going to repreprocess and parse the wml tree with different defined preprocessor symbols during runtime.
20:43:17 fendrin | Right?
20:43:55 Crab_ | fendrin: yes, it's basically the same thing as you were telling about the campaign 'guards', but from a different PoV
20:44:03 fendrin | :-)
20:45:26 fendrin | Assume you modify the single player campaign setup dialogs to call for a local multiplayer game when finished instead of the current procedure you can have a working prototype that no longer needs the single player code in a days work.
20:45:57 fendrin | You just need to shortcut the game creation dialog of a multiplayer setup.
20:46:46 vjoe | yea
20:47:32 fendrin | From that base the rest of the project might be easier.
20:47:50-!- _jay [~jay@cpe-67-240-147-107.rochester.res.rr.com] has joined #wesnoth-dev
20:48:20 fendrin | Crab_: Do you agree?
20:48:36 vjoe | the hard bit will be the architecture, bc we can reutilize most of the code and there will be no need to redo the super complex algorithms and stuff like that
20:49:01 vjoe | I am pretty confident about it :D
20:49:13 fendrin | It is an exciting project :-)




1) Basics

1.1) Write a small introduction to yourself.


My name is Hugo I am currently doing an internship in Morgan Stanley's Technology Department which is part of the Computer Science degree I am doing in the University of Manchester.

I have been interested in programing since I was thirteen because of a course I took in an IT learning centre. It only covered basic aspects of C and Visual Basic, but it was enough to make me passionate about what would be my major area of interest.

1.2) State your preferred email address.

hfmduarte at gmail dot com

1.3) If you have chosen a nick for IRC and Wesnoth forums, what is it?


1.4) Why do you want to participate in summer of code?

I think it would be a fantastic experience to develop my coding skills and to contribute to the community. I am sure it will make be a better computer scientist.

1.5) What are you studying, subject, level and school?

Computer Science at the University of Manchester. I will do my my 3rd and final year next year.

1.6) What country are you from, at what time are you most likely to be able to join IRC?

I am from Portugal. Despite living in the UK most of the time, I am spending the summer in Portugal. I can be in IRC pretty much all the time. This will be my main summer ocupation.

1.7) Do you have other commitments for the summer period ? Do you plan to take any vacations ? If yes, when.

Not at the moment, but I may take a holiday around my birthday (12th of July).

2) Experience

2.1) What programs/software have you worked on before?

I have contributed to the SMF forum CMS in the past as I used to run a web forum.

2.2) Have you developed software in a team environment before? (As opposed to hacking on something on your own)

Yes, in my coure and internship.

2.3) Have you participated to the Google Summer of Code before? As a mentor or a student? In what project? Were you successful? If not, why?

No, this would be my first year.

2.4) Are you already involved with any open source development projects? If yes, please describe the project and the scope of your involvement.


2.5) Gaming experience - Are you a gamer?

Yes, even though recently I haven't had much time.

2.5.1) What type of gamer are you?

I am a very competitive gamer. I prefer to play online.

2.5.2) What type of games?

Mostly FPS and strategy.

2.5.3) What type of opponents do you prefer?

I prefer opponents who are better than me, so I can improve and grow.

2.5.4) Are you more interested in story or gameplay?


2.5.5) Have you played Wesnoth? If so, tell us roughly for how long and whether you lean towards single player or multiplayer.

Yes, I used to play a lot, specially in the summer holidays. I played mostly multiplayer even though I have played some of the campaigns.

2.6) If you have contributed any patches to Wesnoth, please list them below. You can also list patches that have been submitted but not committed yet and patches that have not been specifically written for GSoC. If you have gained commit access to our S­­V­­N (during the evaluation period or earlier) please state so.

I have not.

3) Communication skills

3.1) Though most of our developers are not native English speakers, English is the project's working language. Describe your fluency level in written English.

I am fluent in English, both written and spoken.

3.2) What spoken languages are you fluent in?

Portuguese, English and French.

3.3) Are you good at interacting with other players? Our developer community is friendly, but the player community can be a bit rough.

Yes I believe I have good communication skills. Despite doing a very technical degree, I have always tried to take part in extra-curricular activities to enhance my transferable skills.

3.4) Do you give constructive advice?

Yes. It is highly important to motivate people when advising them.

3.5) Do you receive advice well?

Yes. Advice is helpful for me to improve and grow as a person and a professional. I consider all advice that is given to me.

3.6) Are you good at sorting useful criticisms from useless ones?

Well, every criticism has a reason and a root cause. The wording of the criticism or the way it was expressed might not have been the best, but perhaps there is an underlying intention and purpose which is valuable for me.

3.7) How autonomous are you when developing ? Would you rather discuss intensively changes and not start coding until you know what you want to do or would you rather code a proof of concept to "see how it turn out", taking the risk of having it thrown away if it doesn't match what the project want

I think it is important to share the same view and direction across the team, so I would say that constant updates and direction checks are important.

4) Project

4.1) Did you select a project from our list? If that is the case, what project did you select?

What do you want to especially concentrate on?

Yes, I would be interested in reengineering the multiplayer engine.

4.2) If you have invented your own project, please describe the project and the scope.

4.3) Why did you choose this project?

After speaking to fendrin and Crab_, it was clear this is a massive issue in Wesnoth at the moment and it sets a strong limitation in the development of the project. I cannot think of a most interesting project and one that will have such a tremendous impact on Wesnoth.

4.4) Include an estimated timeline for your work on the project. Don't forget to mention special things like "I booked holidays between A and B" and "I got an exam at ABC and won't be doing much then".

I will be working whenever possible.

4.5) Include as much technical detail about your implementation as you can

As I discussed with fendrin and Crab_, it is crucial to guarantee that the new architecture is as modular as possible and that as much code as possible is reused. We discussed about UI integration, global state multiplayer games, etc. Nonetheless, I still need to get myself properly familiarized with the code.

4.6) What do you expect to gain from this project?

Increased self-confidence in my abilities, a huge feeling of self-realization and hopefully some new friends!

4.7) What would make you stay in the Wesnoth community after the conclusion of SOC?

Well, I play Wesnoth whenever possible, so I would say I am already part of the community!

5) Practical considerations

5.1) Are you familiar with any of the following tools or languages?

Sub­­version (used for all commits) yes C++ (language used for all the normal source code) yes, basically. STL, Boost, Sdl (C++ libraries used by Wesnoth) slightly Python (optional, mainly used for tools) yes build environments (eg cmake/scons) yes WML (the wesnoth specific scenario language) no Lua (used in combination with WML to create scenarios) no

5.2) Which tools do you normally use for development? Why do you use them?

When I can get away with just using a plain editor, I use vim. I find the keybindings very efficient and productive. However, I am happy to use an IDE when I have to. I have used Eclipse and Netbeans in the past.

5.3) What programming languages are you fluent in?

At the moment, at work, I only code in Perl. However, I am still fresh in Java, C and Python from university, as well as PHP.

5.4) Would you mind talking with your mentor on telephone / internet phone? We would like to have a backup way for communications for the case that somehow emails and IRC do fail. If you are willing to do so, please do list a phone number (including international code) so that we are able to contact you. You should probably *only* add this number in the application for you submit to google since the info in the wiki is available in public. We will *not* make any use of your number unless some case of "there is no way to contact you" does arise!

Sure, I am available.

SoC Application

Vjoe SoC Application

This page was last edited on 21 March 2013, at 01:38.