GithubHelp home page GithubHelp logo

robopy's Introduction

Robopy

This is a programming game, where the goal is to develop a battle tank robot to battle against other tanks in Python. The robot battles run in real-time and on-screen.

Robopy is a translation of Robocode (Java to Python) aimed to be a version with few upgrades.

Getting Started

This project isn't feature complete yet. Even so, it's possible to create robots, handle events, run battles and visualize it.

Requirements

The requirements are listed in requirements.txt.

A virtual environment (using python-venv) can be generated by running:

source ./bin/venv python3

Example

from robopy.core.battle import Battle
from robopy.sample.target import Target
from robopy.sample.track_fire import TrackFire
from robopy.sample.walls import Walls
from robopy.ui.gui import GUI


if __name__ == "__main__":
    battle = Battle((800, 600), [Target, TrackFire, Walls])
    gui = GUI(battle)

    battle.start()
    gui.start()

    battle.join()
    gui.join()

Images

Target vs Walls Target vs Track Fire vs Walls
Target vs Walls Target vs Track Fire vs Walls

Contributing

We welcome contributions! See CONTRIBUTING.md to learn how to contribute.

License

Robopy is licensed under the Eclipse Public License 1.0 license (the same as Robocode). See LICENSE file for details.

robopy's People

Contributors

tysm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

robopy's Issues

Unusual trigonometry

The unusual trigonometry implemented (clockwise with 0ΒΊ on top) may cause user misunderstanding and stress. It should be replaced by the normal trigonometry so they can use functions such as cos, sin, atan as they usually learn to.

The scan arc is not implemented as an arc

The scan arc was not implemented as an arc. It's actually a polygon with 3 points (triangle or line) because the module shapely doesn't have an arc object.

Any help in implementing a real arc using shapely or searching for a module that provides it and can be integrated into the current code would be appreciated.

Distinction between AdvancedRobots and normal Robots has not been implemented

The current implementation allows the robot to choose whether to set a call of execute an action by passing the keyword argument execute = True. Since AdvancedRobots were allowed to fight normal Robots, I didn't see the necessity of developing both classes.

I might be wrong but the biggest implication of this design decision is that the Robots won't have aiming aid as the following code provides:

if (currentTopEvent != null && currentTopEvent.getTime() == status.getTime() && !statics.isAdvancedRobot()
		&& status.getGunHeadingRadians() == status.getRadarHeadingRadians()
		&& ScannedRobotEvent.class.isAssignableFrom(currentTopEvent.getClass())) {
	// this is angle assisted bullet
	ScannedRobotEvent e = (ScannedRobotEvent) currentTopEvent;
	double fireAssistAngle = Utils.normalAbsoluteAngle(status.getHeadingRadians() + e.getBearingRadians());

	bullet = new Bullet(fireAssistAngle, getX(), getY(), power, statics.getName(), null, true, nextBulletId);
	wrapper = new BulletCommand(power, true, fireAssistAngle, nextBulletId);
} else {
	// this is normal bullet
	bullet = new Bullet(status.getGunHeadingRadians(), getX(), getY(), power, statics.getName(), null, true,
			nextBulletId);
	wrapper = new BulletCommand(power, false, 0, nextBulletId);
}

I'm opening this issue in order to discuss if this aiming aid is something that Robopy should provide.

Low performance during turns

I noticed that Robocode allows game speeds from 1 to 1000 turns/second which leads to 1000-1 ms/turn. I ran some battles in Robopy setting the game speed between 1000 and 1 ms/turn and I noticed that the smaller the number of ms the more robots skip turns, which is not good because running the same battles in Robocode didn't generate any SkippedTurnEvent.

I didn't perform any profiling yet but I intend to check if this is caused by code inefficiency or the difference in runtime in Python and Java.

There's no UI

OpenCV has been used to render battle samples during the core development, but it is not intended to continue using it

I'm currently out of time but I would start designing and developing the real UI using pygame or some OpenGL module.

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.