eschan145 / kingdomsandcastles Goto Github PK
View Code? Open in Web Editor NEWAn advanced battlefield simulator.
License: MIT License
An advanced battlefield simulator.
License: MIT License
The FPS goes below 15 when the random numbers are generated to decide when to fire an arrow for each soldier. If I had 5,000 soldiers, they would need to generate 18,000,000 random numbers each minute.
As stated in README.md, units were to culminate and branch into bigger units. We could make something like a UnitGroup
or UnitList
, which would have a list of units. Another class could be Flank
, which would contain the three flanks of an army. After a flank would be a legion, which could be split into regiments and then battalions and then companies and platoons and squadrons.
Unit | Size | Commander |
---|---|---|
Army | — | General |
Flank | — | Lieutenant General |
Legion | 10,000 men | Commandant |
Regiment | 3,000—4,000 men | Colonel |
Battalion | 1,000 men | Lieutenant Colonel |
Company | 200 men | Captain |
Platoon | 40 men | Lieutenant |
Squadron | 10 men | Noncommisioned officer |
Instead of a soldier doing nothing if an arrow hits him, it would be more realistic if the arrow stayed stuck in him, or if in close range tore right through. In the arrow's update
function, we could add a feature to simulate drag when the arrow hits flesh. You would have to calculate its direction and slow it down incrementally. The faster the arrow is, the more flesh it tears through.
This could also replace the current projectile damage algorithm, checking how many pixels of flesh it passed. Volleys would definitely look really cool with that. Instead of having hundreds of unnecessary complex Arrow
sprites, they would be an instance of an arcade texture.
Multiple improvements can be added to the Entry.
In many wargames similar to this one like Shieldwall, there is a command palette at the bottom of the screen. A palette of common commands can be put on the top right corner of the screen, and directly below the palette a button to access a full inventory of commands.
Common commands:
More GUI widgets need to be added.
These also need to be added to the docs.
The Slider
has multiple problems:
Slider
These are not going to be fixed currently.
Only one side can fire arrows right now. That probably has to have something to do with the soldiers' update functions.
One thing about real battlefields is that soldiers swarm into armies and fight them with swords and spears. It is partially implemented in Armies but the fighting sucks. Many things need to be changed.
pymunk
physics engine could help with pushing and knockback from arrows.In one battle scenario, I had a unit of twenty men and another of four thousand. The twenty men sprayed as many arrows as if there were four thousand of them until all of their arrows were spent. This must be changed in the units, where the number of soldiers in a unit is divided by the rate of fire. This might seem the tiniest bit realistic as if the soldiers are desperate, but after they use up their arrows they are quickly destroyed by the larger unit. Note that the larger army was more than 200 times larger.
Using a pymunk
physics engine has multiple problems.
pymunk.Body.force
pymunk.Space.add_collision_handler()
A new strategy is needed. I've added ShapeFilter
s to specify collision so that arrows don't cause soldiers to move, using32-bitwise integers
.
Currently, when two armies clash, the attacking army always overpowers the other. The other army needs to apply force so they'd actually fight back, instead of just being pushed back.
Links for additional help:
In the future, artillery weapons like ballistae and cannons could be added. Cannons would be used for destroying walls, and ballistae for destroying large numbers of troops in formations. The cannons would need a fire effect, and the cannonball would leave a temporary trail of fire as it wooshed through the air and when it hit its target, explode, cutting through the ground seven feet and scything through seventeen men.
A ballista 3D model has already been created. When the cannonball how the ground, it would have to create fire, which could spread around until extinguished by water. It would only be able to spread in flammable things, like soldiers or dry grass.
After all of the text is deleted in an entry, arcade
crashes. This is because its IncrementalTextLayout
has no glyphs and an AssertionError
is raised. Also, the caret does not show on the line start before the entry receives text input
widgets.py
and color.py
filesfrom arcade import Window
from widgets import Container, Entry
from color import WHITE
class MyWindow(Window):
def __init__(self, title, width, height):
Window.__init__(
self, width, height, title, style=Window.WINDOW_STYLE_DIALOG
)
self.container = Container()
self.entry = Entry(
250,
160)
self.background_color = WHITE
def click(self):
print(self.entry.get())
def on_draw(self):
self.clear()
self.container.draw()
window = MyWindow(" ", 500, 400)
run()
The documentation of the GUI widgets had many flaws and obsolete parameters. Use the GUI in the widgets.py
to update the documentation.
Now the documentation can be found in the widgets.py
file.
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.