dirichi / simplesoccermanager Goto Github PK
View Code? Open in Web Editor NEWSoccer manager game written in javascript with p5.js
Soccer manager game written in javascript with p5.js
keeper sometimes moves like regular outfieldplayers and sometimes players in the "shooter" state keep moving. should be fixed by using statemeachines that determine player movements and are controlled by Game and Team objects.
if(teaminAttackState){
outfieldplayers.setState(makingAttackingRuns)
keeper.setState(neutral)
focusPlayer.setState(roaming)
}
if(teamInDefenseState){
outfieldplayers.setState(makeDefensiveRuns)
keeper.setState(keepermovement)
focusPlayer.setState(chaseBall)
}
if(teamInNeutralState){
allPlayers.setState(neutral)
}
if(teamInKickOffState){
outfieldplayers.setState(preparingForKickOff)
keeper.setState(preparingForKickOff)
if(gameIsReadyForKickOff){
focusPlayer.setState(chaseBall)
}
}
and so on and so forth
ideally this should come during the game events. Perhaps preface them with a key word so that annyang knows to refuse this keyword. Perhaps also use nlp api to generate commentary
player should shoot if nearestToPost and WithinShootingRange 100% of the time
players only move forward when dribbling
instead let's have them actually respond to markers
if(state==dribble){
if(noPlayerInFrontWithinXRadius){
moveForward();
}
else{
moveAwayFromPlayers(ArrayOfPlayersinXRadius)
}
}
moveAwayFromPlayers(playersArr){
var allAnglesOfMotion=[-180,-150,-130....180]
var escapeAngle;
for(player:playersArr){
var centralAngle=getAngleToPlayer();
var leftMostAngle=getLeftMostAngleToPlayer() //get angle to player.x/ypos-player._width
var rightMostAngle=getRightMostAngleToPlayer() //get angle to player.x/ypos+player._width
allAnglesOfMotion.remove(central,leftmost,rightmost)
}
escapeAngle=pickAngleAtRandomFrom(allAnglesOfMotion)
this.moveAtAngle(escapleAngle)
}
options include arduino, keyboard, or surface taps.
some algorithms may be affected, e.g. pass/shoot/dribble
an additional attribute for player perhaps, e.g. "isControlled"
user input buttons: longPass, shortPass, shoot, up, down, left, right
should be fixed sort of like
io.on('disconnect',function(socket){
if(socket==host){
socket.broadcast.emit(" host exit");
allUsers.remove(socket);
setAsHost(allUsers[random(allUsers.length)]);
}
})
function setAsHost(socket){
socket.broadcast.emit("setAsHost",0);
}
------------client side----------------------------------------------------------
socket.on("setAsHost", function(data){
game.isHost=true;
})
socket.on("host exit" function(data)){
game.allPlayers.moveWithStoredVelocity()
game.ball.moveWithStoredVelocity()
}
perhaps give a full time state for teams, and players. in this time, there is no drain of morale of team players. there ought to be crowd cheering, and the players stand still
as above
also, current sentiment analysis library doesn't use https, so it's a bit of a problem for heroku
the players get negative velocity and start fooling around and running off the field.
quite buggy. needs to either go side to side more quickly or chase ball when within a certain radius
socket already permits users to see other users playing different games at the same time. let's get multiple users to play the same game
ie if the team has ball, let the human controlled player send a message to the current player in possession,
if the focus player is computer controlled, it looks through his/her "messages" and for those players in its messages that have called for the ball, it artificially increases their attackingPositionrating, so as to give a better chance of passing to them
if the focus player is human controlled, the messages (from other human controlled players?) pop up on the respective sockets screen
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.