I had previously blogged about the Snakes & Ladder Game I had created. That was a multiplayer game but was not an online game – i.e. multiple people could not play the game together remotely. I had planned to make a true online and multi-player version of the game since I created the earlier version. In the last few days, I have made sufficient progress on the online version of the game, that I can share it with you. Please watch the demo of the game below.
Since I am using the same server for the backend of the game as the one hosting my blog, I have limited the number of simultaneous sessions. There is also the session timeout of 10 minutes, if there is no activity in the session.
Creating the online version was certainly more complicated than the standalone version – I had to implement the backend logic to create and manage sessions and implement a broker to facilitate messages/events to and from multiple players. But I have done sufficient server-side programming in the past and was able to implement that part of the game fairly quickly. However, implementing the game client in Unity took some time. Implementing messaging protocol, making sure the UI is updated from multiple event handlers in the UI thread and in general synchronizing parallel event handling took some time. But overall, it was a great learning experience.
I have implemented another game using Unity, after my first Unity game, Single Wicket Cricket. The new game is Snakes & Ladders. You can watch demo of the game in the following video.
You can play the game at http://ramkulkarni.com/Games/SNL. Though the game is multi-player, it is not truly online multi-player game. I do intend to work on that in future. Also, the game is not optimized for Mobile. It does not display correctly in portrait mode in the mobile browser and text input field does not trigger virtual keyboard. But it should work fine in non-mobile browsers, so give it a try.
I managed Adobe Animate team for a couple of years and during that time wrote a few blog articles and created feature videos. These articles and and videos were published on Adobe blog and Animate YouTube channels. Here I am just providing links to them –
I tried my hand at a low-poly 3D game development with ‘Single Wicket Cricket’ game. This is not a typical Cricket where two teams play against each other. In this game you are the main player – the batsman, playing against a team.
Tap/click Bowl to start bowling action. You will be able to ‘Hit’ the ball once it is released by the bowler. You will be able take a ‘Run’ only if bat touches the bat, so there are no byes or leg-byes.
By moving different sliders you can control position, rotation of the batsman, strength and direction (up/down) of the stroke. Tap/click ‘Help’ button for more details.
The game is available to run in Web Browser or as a standalone application on Android devices.
I had completely re-written the previous edition of this book. The third (current) edition has three new chapters –
Chapter 12, Microservices, describes how to develop and deploy microservices. It also covers the deployment of microservices in Docker container.
Chapter 13, Deploying JEE Applications in the Cloud, describes how to deploy JEE applications in Amazon and Google Cloud platforms. Specifically, it describes the deployment of applications in AWS EC2, Beanstalk, Google Compute Engine, and Google App Engine. It also describes Eclipse tools that can be used for deployment to the Cloud.
Chapter 14, Securing JEE Applications, describes how to secure JEE applications using authentication and authorization features of JEE containers. It also covers some of the JEE 8 security enhancements.
After spending a couple of hours trying to debug this issue, I thought I would write about the solution that worked for me. Here are some of the possible solutions I found on the web –
Make sure 8081 port is free and not taken by any application. On Mac you can check this by running command lsof -i :8081. If any process is running then kill it – kill -9 <pid>
Remove spaces from the folder path of the project
Run react-native upgrade in the project folder
In my case the problem was #1. However simple lsof command did not show any process. But sudo lsof -i :8081did show the process. It turned out that McAfee agent was running on the same port. Killing the agent is not an option for me. So the next thing to do was find a way to change the port of Ract-Native packager.
Following steps worked for me –
Opne node_modules/react-native/local-cli/server/server.js and change port 8081 to the port you want to run the packager on. In the version of React-Native I am using, it is in the following code –
Before developing applications in any new language/platform I make sure that the debugger works in the set up. I had been working on some projects in Python and PHP recently and I have already shared my notes on setting up and debugging Python (Django) application in Docker and how to debug the application.
In this post I will describe how to setup PHP7 in Docker and debug the application. You can checkout the project from this Github repo.
Here is the Docker file for this setup –
FROMphp:7.0.17-apacheRUNapt-getupdateRUNapt-getinstall-yapt-utilsvimcurlsqlite3RUNpeclinstallxdebug# copy test db fileADD./db/employee.db/employee.db# The base image does not have php.ini. # Copy our own, with xdebug settingsADD./php.ini/usr/local/etc/php/EXPOSE80
In the last post I described how to setup Django and Apache in Docker container. In this post I will describe how to remote debug the Django application running in the same setup. If you look at the Dockerfile of the project (in the last post), you would see that it installs ptvsd package – this package helps to debug Django applications running remotely using Visual Studio Code.
Install Visual Studio Code, if you haven’t installed it already. Then install VS Code extension for Python. I have installed this extension by Don Jayamanne, and it supports debugging of Python applications. If you don’t know how to install extensions in VS Code, this video might help you.
To enable remote debugging of Django application, or Python applications in general, you need to run ptvsd server on the machine where Django is configure, which in our case is a Docker container. You need to embed following code snippet in your Django app, and it needs to run only once, because it listens to a port.
The above snippet starts ptsvd server, that listens on port 3500. We configured Python to run in Apache2 using mod-wsgi in the Docker container, but I haven’t found a way to embed the above code in a Django application in this setup, where it would run only once (if it is run multiple times, it will try to attach to the same port and that would fail). So far the best way I have found to debug Django application remotely in Docker is to start Django development server on a different port (than one where Apache is listening) and embed the debugger code in manage.py. You run the development server by running manage.py, for example – Continue reading “Remote Debugging Django Project in Docker”
I was working on a Django project and it took me some time to make Django work with Apache2. So I thought I would create a Docker project for this setup. You can find the project at https://github.com/ramkulkarni1/django-apache2-docker. It sets up Python3, Django, Apache2 and a sample Django site too.
All configurations for making Django work with Apache2 are created when you create a Docker container using this project. Simply run following command from the project folder.
(See my post Docker Notes on information about setting up Docker and docker commands). One the container is up, browse to http://localhost:8005.
I recently started using Docker and am very impressed with how easily you can set up environment to develop, test and deploy applications. It provides a virtualization environment, but unlike some of the other virtualization solution, Docker container (runtime environment for your application) is a process instead of a complete OS. It runs natively on Linux and uses a single virtual machine on Windows and Mac in which Docker containers run.
Using Docker you can easily create containers required for your application to run, for example containers for database, application server etc and easily deploy them to test or production environment. You can create images of your set-up and re-create the same setup constantly from those images. When you create a Docker image, it has to be based on some variant of Linux base image. You can browse Docker images at Docker Hub.
This post is not meant to be tutorial or detailed information about Docker. You can refer to Docker web site for that. As many of my other posts, this post is meant to be reference for me – about some of the Docker commands I have used so far. Continue reading “Docker Notes”