hoeencoder / cities Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
The first user to connect to the server after it starts will not be removed from the users array, and their tents (and most likely workers and soldiers when they are added) do not disappear from the canvas. I've looked into this and the code seems correct
socket.on('disconnect', function() {
if(searchUsers(currentPlayer.id)) {
users.splice(searchUsers(currentPlayer.id), 1);
}
console.log('[INFO] User ' + currentPlayer.name + ' disconnected.');
});
function searchUsers(id) {
for(let i = 0; i < users.length; i++) {
if(users[i].id === id) return i;
}
return false;
}
This should work, but for some reason its not. Can you take a look at it @Dubstepper?
Thanks in advance.
This is not desired, I would prefer each tent not be inside any other, and if they do they should automatically correct themselves.
The current code for correcting this is:
for(var j=0; j<player.tents.length; j++) {
if(j != i && player.tents[i] !== undefined) {
var distance = Math.sqrt(Math.pow(player.tents[j].y-player.tents[i].y,2) + Math.pow(player.tents[j].x-player.tents[i].x,2));
var radiusTotal = (player.tents[i].radius + player.tents[j].radius);
if(distance < radiusTotal) {
//if(player.lastSplit > new Date().getTime() - 1000 * c.mergeTimer) { //Not merging.
if(player.tents[i].x < player.tents[j].x) {
player.tents[i].x--;
} else if(player.tents[i].x > player.tents[j].x) {
player.tents[i].x++;
}
if(player.tents[i].y < player.tents[j].y) {
player.tents[i].y--;
} else if((player.tents[i].y > player.tents[j].y)) {
player.tents[i].y++;
}
//}
/*else if(distance < radiusTotal / 1.75) { //Merge into one.
player.tents[i].mass += player.tents[j].mass;
player.tents[i].radius = util.massToRadius(player.tents[i].mass);
player.tents.splice(j, 1);
}*/
}
}
}
From my tests I believe they ARE correcting themselves, but this is being undone somehow.
Any help would be appreciated. Thanks!
The bug was invoked by this commit: Alter the laws of physics
The header <header><h1>Cities.io</h1></header>
sometimes disappears from view when playing. This happens to me whenever I hit the ready button. The header will be used to show the players stock of resources so it needs to be visible.
Summery of Convo. With Hoeen + More
Possible name for Clans/Classes/? being "Type" (I personally prefer Class the most though)
For the current Fourth class, Call it something talking about it being efficient (gonna look into this a bit more)
The second class name suggestion of Endemic. (quick reason why) Since They tend to be more confined by the less movement compared to others, they become more endemic to where they are.
Each Class should have something they are - in compared to normal (maybe half of what you would do for its + stat so it isn't a huge change, but still lacking a bit compared to others in that category)
Nomadic - Slower Respawn speed since they are move for moving around its harder to have children and take care of them.
Both of these below fit elsewhere as well, as placed there as well
Slower HP recovery (tent & unit) works as well... as they move its harder to repair things on the move.
The other option that I think would work is Lower Max Health (tents). as they are moving around, they won't be worrying about building tents to be standing to long as it would be hard to take down/move since they would be heavier & more parts to deal with.
Endemic(?) (maybe something dealing with tanks as they are a + health group)- Slow tent speed as they don't move as often so less experience first off, and they might (no different look or anything) have build things a bit stronger, due to it not being on the move as much (explaining the HP boost too, but this doesn't need to be told to people, but if there wanted to be different looks to different classes, make them look a bit stronger)
Superfluous(?)- Slower repair speeds. They have so many more repair to deal with that people are a bit overwhelmed (even if there isn't a higher rate, lets just pretend ok?!?!)
Efficient (name to change, this is trash tbh & I said it. Maybe a name relating to its glass cannon (saying below ends up happening)) - Slower HP recovery (unit health) as they are good at doing things quickly but at a cost to there bodies being abused and hard to get back to 100%
Lower health in general as they beat up their bodies, they can't have as much HP as other
for the efficient (ugh dis name I gotta think of a better one before I send this, but if you see this, I didn't) class, a + for them could be damage up as their solders are more efficient in fighting (which then the lower HP fits better for 'em, but both still work, just the low HP I like better)
These notes are looking at them as of 9/9/2016. These classes may change as time goes on Don't Expect them to be 100% matching as the game changes
Sorry for any Grammar errors & spelling. Yell at me at SG (Kraken Mare) or at [email protected]
Gl with everything!!!
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.