Comments (3)
Regarding battle:
- Could be handled by a
Battle
class, for example, which contains abattle
function (two inputs: player, opponent). As the user is affected, the database is updated to reflect changes in health, etc.User::save
should be further fleshed out for these purposes to effectively dump a snapshot of the user account to the database. - As to the amount of damage done, this would be based on the user's statistics, and for damage received the monster's stats.
- For the purposes of an initial loop, a very simple random damage calculation is suitable (#7 should enable this to be more complex).
- #6 will enable further development of the battle stage.
Regarding exploration:
- The user is presented with a number of options, likely a N/S/E/W-type option.
- This requires some sort of spatial representation of land masses, such as via boundaries in a grid.
- As are the possible user attributes (ex. class), these could also be driven through config files, specific to maps.
- Monsters would be associated with certain areas, so that exploration into more difficult areas, for example, yields more difficult opponents.
- For the purposes of an initial loop, a non-functional N/S/E/W, and a handful of monsters associated with the entire map, is suitable.
- #8 will enable further development of the exploration stage. For now, the world can be a single, endless area.
from crystal-skull.
Location
I think a perfect place for the initial game loop is GameSession::run
; as currently written, GameSession
represents a single user's interaction with the server, and run
is effectively the "main" method for that session.
Algorithm
- Get or create user account (already implemented).
- Enter loop on
GameSocket::get
(note reference viaself.socket
inGameSession
). - If input from user is
exit
, then save the user's state and kill the connection. - Else, there should be a set of additional possibilities which the user is either presented with or tossed into.
- As part of this initial implementation, there will only be two possibilities, battle or explore.
- It seems suitable for this initial implementation to not present a menu of options, though it should be
extensible enough to accommodate that at a later point.
- If battle, carry out battle. Choose from the available list of monsters randomly.
- It seems suitable at this point to create a
battle
method in theUser
class, which accepts an input monster.
- It seems suitable at this point to create a
- If not battle, then explore. Choose a direction.
- It seems suitable at this point to create a
move
method in theUser
class, which accepts a direction. - When legitimate region boundaries are implemented, logic should be in place to determine whether a certain move is allowed or not.
- It seems suitable at this point to create a
- Continue to next iteration.
from crystal-skull.
⬆️ is being implemented here: https://github.com/matthewjwhite/crystal-skull/tree/initial-game-loop.
from crystal-skull.
Related Issues (9)
- Implement initial battle system
- Implement initial user stats HOT 2
- Implement initial exploration system HOT 5
- General enhancements HOT 2
- Fix up CI HOT 1
- Consider mongoengine HOT 2
- Add YAML validation HOT 3
- Add unit tests HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from crystal-skull.