Giter VIP home page Giter VIP logo

cocos2dx_socket_example's Introduction

Example of usage Socket at Cocos2d-x >= v3.8.1

About

I create an online multiplayer game, but in network programming i am not so good. Long time searching around the Internet for example usage sockets at mobile devices, i tried many different solutions that does not work until i met a good man named Odison ( I hope that's your real name :) ) he sent me a good example of source code, i little bit refactored it and now i share it here, i have added implementation of the server and you can use it as you wish.

Setup

  1. download and install Java JDK >= 1.8 http://www.oracle.com/technetwork/java/javase/downloads/index.html
  2. download and install Maven https://maven.apache.org/
  3. download and install Gradle http://gradle.org/
  4. clone Cocos2dx https://github.com/cocos2d/cocos2d-x and then just copy it into client folder as cocos2d
  5. clone Protobuf https://github.com/google/protobuf
  6. (optional) build Protobuf protoc compiler copy build-protobuf-iphonesim.sh into Protobuf directory and run it, this file builds static library for iOS, in my case it is placed at '/usr/local/platform/i386-sim/lib/' create symbolic link to Protoc compiler from '/usr/local/platform/i386-sim/bin/protoc' into '/usr/local/bin/protoc'
  7. build Protobuf for Java (it is because at socket server we use Protobuf Java) goto Protobuf/java/lite and run 'mvn install'
  8. goto server and run 'gradle installDist' this builds socket server
  9. run socket server from 'server/build/install/socket_server/bin/socket_server'
  10. run socket client from 'client/proj.ios_mac/SocketClient.xcodeproj'

Sockets is crossplatform and works fine on Apple iOS and Google Android.

cocos2dx_socket_example's People

Contributors

alexanderbykin avatar

Watchers

James Cloos avatar Aseem Gupta avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.