How to create a MOBA in 24h

[New Moba Project]:

Take a look at our new free game demo M.O.B.A – Mech Online Battle Arena. It’s being developed as a complete project/tutorial pack for the Unity Asset Store (released planned for April 2016). Besides the demo, all documentation will be free at the time of release (PDFs and videos).

[Original post]:

Last week, some friends gave us a challenge: to develop a MOBA (Multiplayer Online Battle Arena, such as Dota, LoL and HoN) to show at a gamers event the day after, and release it for free, with source code included. We’re happy to inform that we completed the challenge, and here’s the promised demo and source code:

Screenshots:

24h MiniMOBA. Hero and a creep wave following the middle lane.

24h MiniMOBA. Hero and a creep wave following the middle lane.

For the version we’re sharing, the above graphics (which are from another game of ours) were replaced with free ones, and this is the final result:

screen01 - initial screen
screen02 screen03 screen04 screen05

Instructions:

  • For the binaries: start a server with the desired number of players (1 for testing alone), and wait for the remaining players to connect. For the clients: type the IP of the server machine and hit “Connect as client”;

    Instructions for running the game

    Follow the instructions above to run the game

  • For the Unity sources: clone the repository and open as a Unity 3D project (must have Unity game engine installed). Hit Play to run the game (or create a build and share for running on client/server mode);
    PS.: Remember to add this to your local .gitignore:
    .DS_Store
    Library
    Temp
    *.csproj
    *.pidb
    *.unityproj
    *.sln
    *.userprefs

We kindly acknowledge the following people who indirectly contributed to this result:

  • Carlos (Pazuzu) Henrique – he’s the composer of the awesome music that we’re including in the project;
  • Edmilson Frank – testing and basic balancing were possible because of him;
  • Jefferson Henrique – kindly helped testing in a saturday afternoon, and coded a random music player for us;
  • User xiaolianhuastudio in the Unity Asset Store – we used his Make Your Own Fantasy Game – LITE free asset pack in our shared project. He has another complete asset pack that is very good and affordable;

How it was done:

Given we’ve never developed an RTS game before, it was quite an accomplishment indeed. Immediately after accepting the challenge, two of us (programmer and designer) discussed an approach and started to work towards completing a demo with the following features:

  • Single Lane;
  • Creep waves with waypoint-based pathfinding an AI;
  • Towers and bases (ancients);
  • LAN play only (no internet);
  • Hero leveling (increasing damage and armor, but no items or abilities);

We started at 9:30pm, and finished at around 4:30pm the next day (so it was actually 17h only). We also kept a LOG of the development process, and here’s a detailed account of how we evolved from studying network code to the finished project:

9:32pm – Init

  • First things first: searching Google about how to develop a LAN multiplayer game in Unity;
  • Reviewing MOBA concepts, so we can choose the fundamental features better;
Searching for references

Searching for references

9:51pm – Announcement

  • Publicizing that we accepted the challenge by posting in our facebook page;
  • Decision about minimum features: single lane, simple animated graphics, one tower per team, creeps, single hero type with no abilities, but with leveling based on farming and denials;

10:03pm – Unity Project

  • Created a new Unity project, and started by following a networking tutorial on how to program a client/server game;
Creating a new Unity Project

Creating a new Unity Project

10:19pm – Basic client-server code running

  • Already moving a simple Cube in the server, and visualizing the movement in the client;
Basic client server

Basic client server

10:29pm – Client-server control objects

  • 10min later, we were experimenting with game object control modes (distributed vs. authoritative server – haven’t decided which one to use);

10:38pm – 15min Pause for a snack…

11:11pm – Authoritative server

  • We decided to have an authoritative server, client will send input for heros (clicks), all processing happens in the server, and then is sent back to all clients;
  • Creeps AI will run solely in the server as well;
  • Created a “level” with a simple map (a plane for start);

11:32pm – Waypoints

  • Basic creep code done, running server only (view at the clients);
  • Coded the basic waypoint system, so we don’t need a complete pathfinding solution;
  • Tested everything with proper client-sever status and physics extrapolation (dead reckoning);
Waypoints system

Waypoints system

0:21am – Clicks

  • Hero movement based on clicks and ray casting. Physics runs on server, clients only send the clicks. There’s still a bug and the client is not updating correctly;

0:27am – One more pause…

1:34pm – Prefabs and movement

  • Created prefabs for creeps and heros;
  • Corrected the movement bug in the hero code;
Creeps and heros

Creeps and heros

2:36am – Attack

  • Now creeps choose targets and attack;
  • And heros can click on targets as well (attacks have a configurable range);
  • Feeling very tired, and not sure if we’ll be able to finish everything in time;

2:52am – Basic GUI

  • Health bars, YEAH!
  • Now we believe it’s really working (synchronized health bars on both client and server);
Health bars

Health bars

4:22am – Scores, terrain and name

  • Keeping and showing the score;
  • Created a basic Unity terrain, with a “river” in he middle;
  • Some adjustments in the physics parameters;
  • Decided a name for the game: Mini MOBRHA (Multiplayer Online BrBr/HueHUe Arena);
Scores and a simple terrain

Scores and a simple terrain

4:38am – Pause for SLEEP…

9:22am – Back to work

  • Decided to make it fully multiplayer (not only two players);
Client server with almost all features on

Client server with almost all features on

10:36am – Leveling

  • Our friend Edmilson joined the party and helped a lot with some basic balancing ideas and numbers;
  • Leveling, damage, all working now… YEAH!

11:05am – Towers

  • Towers working, with same creep AI, but no movement (added damage and range);
  • We’re almost there (in terms of code);
Towerezzz

Towerezzz

11:46am – Annoying bugs

  • Suffering with stupid bugs (becoming tired);
  • Started more frequent gameplay tests (builds put in local network file-sharing, so friends can independently take care of the testing);

12:27pm – No more bugs

  • Solved all bugs: auto-kill hero not happening anymore, involuntary movements, etc;
  • Better range handling;
  • Bases added (same code as towers and creeps, but with no movement or attack);

12:40pm – Pause for lunch…

2:42pm – Characters

  • Received the animated character prefabs from the designer (he was adapting them from another of our games);
  • Walk, idle, hit cicles, etc;
  • Blood particle system (with prefab and network instantiation);
Fancy character models from our Cangaço RPG game

Fancy character models from our Cangaço RPG game

4:36pm – Shots

  • Line renderer for shots;
  • Better detailed terrain;
  • Tested multiplayer (more than 2 – we tested with up to 4 clients)

4:47pm – Scenery

  • Props, towers, shadows, etc;
  • Random Music Player script by Jefferson Henrique (another programmer at Sertão Games);
  • All done (in less than 24h actually);
Finished game (17h work)

Finished game (17h work)

We hope you all can make good use of this free project. We kindly ask you to let us know if our code is being used in one of your projects (we’d love to showcase your work here as well).

8 thoughts on “How to create a MOBA in 24h

  1. eum I wanted to know if we can use this and import skins from Maya/Blender/Milkshap other programs like that?? hope you can answer me thank you

    • Yes,

      You can use this project sources any way you want. Just replace our character and environment models for the ones you have, and make sure you know how to set them up in Unity.

  2. Hi, really love your good work and i want to know if you can you help me???
    I got a little bug, when i start a server, only the server creator can see the level and the health of the others, if you can help me i would appreciate that🙂

    Greetings,

  3. Ok
    First let me introduce myself,,,
    I’m a designer, artist and initial developer. etc. … and a man with too much skill to recite and diploma ….

    Need help if possible regarding this kit …

    from love to love DOTA …

    I now make three rows Krips DOTA like map ….
    What I failed to make the option to choose diferent player to spwn .

    please integrate in basic kit the additional option choice of hero
    I need only three heroes to choose I’ll expand the script to 90 heroes and do modeling, etc. … and PUT IN GAME team select option….

    If possible I would like to send me this basic kit with the additional option ….

    when I’m done with the graphics part, etc. .. INVENTORY SYSTEM, SHOP SYSTEM, MAGIC SYSTEM, HEROES , etc. ..

    I send you my version of the kit ….

    Basic kit is great and thanks for sharing the basic kit …
    The aim is to create an alternative to dota and lol related to earnings from the sale of items offer my 50% 50 in earnings from sale … I need your code skils and
    I’ll solve the rest … graphics, gameplay, Marketing and Advertising, etc. …. Game will be free but profits will come from objects, accompanying promo shops, etc. …
    If you are interested in further development of the project contact …

    I need your set of available skills because the programming is too time-consuming learning process
    And I would need a lot of time to get to your level …
    So to save time I make my Skil set on the table and your Skil set to make finish product froum this kit ..

    Best regards
    P.S I know there is a ton of work to do to get closer to dota or lol game but it’s worth …
    DUBRAVKO

  4. Well, interesting❤ It is legal to use it to non-commercial project? (for example, showing to friends that you created moba ^^(

    • Yep. Feel free to do it. It’d be nice to receive some credit for it, but that’s actually the purpose… Have fun.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s