Sitemap
Mchiloane

Mchiloane

Brownfields(Robot world)

3 min readAug 29, 2024

--

Brownfields development is programming in an existing codebase to change the design of the system or add new functionality. Sometimes, it involves removing functionality, which is usually a lot harder than just deleting a few files.

For this specific project we were working on a Robot world codebase written by student from wethinkcode_ cohort 2021. Robot Worlds is a server-based simulation project where multiple robots interact in a virtual world. The project allows for a variety of commands to control robots, navigate around obstacles, and interact with the environment. The primary focus is on creating a scalable, testable, and reliable system that handles multiple robots and world configurations.

Robot world consist of two programs: the server and the client. The server program is responsible for managing a world with its obstacles, robots and everything in the world. The client program is responsible for launching a robot into the world and controlling the robot in the world by sending messages to the server program and receiving messages back in response.

Server

  • The server launches and establishes multi-client connection.
  • The server initiates a world and its obstacles
  • Server communicates using JSON objects.
  • Server allows administrative commands such as robots, dump, exit, save, and restore to save and retrieve a world and its obstacles for the database

Server commands

  • dump: Displays a representation of the world’s state showing robots, obstacles, and anything else in the world
  • Quit: Disconnects all robot and end the world
  • Robots: Displays the state representation of all robots in the world
  • Save: Saves the current world and its obstacles in a database
  • Restore: o load a World from a database created using the server’s SAVE command.

Client

  • Client connects with the server using the port number
  • Client can launch a robot by typing “launch” and the type of robot they want to launch e.g sniper ,killer etc.
  • If the world has enough space, client will receive a message stating that the robot was successfully launched
  • The application provides convenient way to communicate with the server

client commands

  • Forward/Back: Moves forward or backward by a specified number of steps.
  • Left/Right: Turns the robot anti- or clockwise
  • Repair: Maximizes the shields
  • Reload: Refills the weapon to its maximum capacity
  • Look: Checks the world within the robot’s reach
  • State: Updates the UI with the important information about the robot

Project Presentation

The presentation will detail the process we followed in designing the Robot Worlds project and the documentation for the final design.

Get Mchiloane’s stories in your inbox

Join Medium for free to get updates from this writer.

Design Process: Initially, we had a foundational knowledge of Object-Oriented Programming (OOP), which made project structuring less of a concern. To develop the gaming program, we utilized Google Chrome for research, consulting various websites like Stack Overflow and Javatpoint.

Research Areas:

  • Server Sockets and Concurrency: We explored server sockets and the implementation of multi-threaded applications to handle multiple tasks simultaneously.
  • JSON Serialization: We studied how to serialize and deserialize JSON objects in Java, which was critical for client-server communication.
  • Communication Protocols: We examined the protocols that facilitate communication between the client and server.

Architectural Choices: We determined that a text-based user interface for the client, would be effective. Additionally, we decided on a multi-threaded server design to manage multiple connections efficiently.

Project Demonstration

The demonstration will cover the setup, testing, and functionality of the Robot World project.

Setup and Testing:

  • Project Setup: We’ll start by explaining how to download or clone the project from GitLab and set it up on your local machine.
  • README File: We’ll review the README file, which provides instructions on how to run the Robot World project. This includes steps to test the application’s functionality to ensure it operates as expected.
  • Codebase Structure: We’ll also discuss how the codebase is organized, highlighting the separation of different source code files and their roles in the project.

Conclusion

In conclusion, the Robot World project has provided valuable insights into several key areas of network programming and application development. By utilizing network sockets, we effectively managed communication between the server and client applications, ensuring reliable data exchange. Concurrency was addressed through the use of threads, which allowed us to handle multiple tasks simultaneously and enhance the performance of our multi-client environment.

Overall, this project not only reinforced our understanding of these fundamental concepts but also demonstrated how they come together to create a robust and functional application.

The demonstration clearly showcases the project’s functionality, including both the server and client applications, and highlights the implementation of network sockets and threading. Additionally, the demo presents the test results, illustrating how well the project performs in practice.

--

--