基于它的日历和事件建模
几年前,我已经为足球经理游戏编程了很多功能(将其发送给Gamestar以获取免费出版,但由于版权而被拒绝)。
我在游戏中有一个部分,我并不真正满意,因为我不知道最适合对其进行建模。
我有一个日历年的所有天的对矢量:
std :: vector< std :: pair<竞赛*,tdate>> Year_plan;
,
例如,指向竞争类实例和日期的内部可能会有以下条目:
campers_league_draw,12.03.2022
Champions_league,15.03.2022
first_league,19.03.2022
second_league,19.03.2022
- >如您所见,可以在同一天进行几场比赛!
程序逻辑只是处理year_plan
按日期进行日期,并采取在模拟结果或模拟抽签的特定竞争中所需的措施。这完全有效,但是以某种方式感觉不正确。
因此,我对此有两个问题:
在其中每次竞争中有一年的日历课和实例,这是没有意义的吗? (由于每天有不止一次的比赛,每天一个实例还不够)。这也将允许在实例中存储其他信息,例如比赛日的计数器,回合等。
我目前参加的比赛是leagueCompetions,cupcompetitions draws。所有这三种比赛类型都有一些共同点,但还需要特殊的班级成员和方法。绘制竞赛需要少得多的信息才能存储。由于我需要将竞赛存储在日历向量 /班级中,因此我需要以某种方式forr所有三种竞赛类型。我是否应该在这里使用继承方法,即使除了公共部件之外我还需要专业化?
预先感谢任何建议 毛罗
I have already programmed a football manager game some years ago with a lot functionality (Sent it to Gamestar for free publishing but was rejected because of copyrights).
I have one section in the game on that I am not really satisfied because I have no clue what would be the best fit to model it.
I have a vector of pairs for all days of one calendar year:
std::vector<std::pair<Competition*, TDate>> year_plan;
E.g. there can be following entries inside pointing to a Competion class instance and a date:
CHAMPIONS_LEAGUE_DRAW, 12.03.2022
CHAMPIONS_LEAGUE, 15.03.2022
FIRST_LEAGUE, 19.03.2022
SECOND_LEAGUE, 19.03.2022
--> As you can see, there can be several competitions at the same day!
The program logic is just processing the year_plan
date by date and takes the action required on the specific competition on simulating results or simulating the draws. This perfectly works, but somehow it does not feel right this way.
For that reason I have two questions on that:
Would it not make more sense to have a one year Calendar class and instances for every Competion occurence in it? (One instance per day is not enough because of having soemtimes more than one competitions per day). This would also allow to store additional information in the instance like counter for the matchday, round etc.
The Competitions I currently have are LeagueCompetions, CupCompetitions, Draws. All these three competitions types have some parts in common but need also special class members and methods. Draw competitions need much less information to be stored. As I need to store the Competition in the Calendar vector / class, I need somehow one class forr all three competition types. Should I use here inheritance approach even I need a specialization of the classes in addition to the common parts?
Thanks in advance for any suggestions
Mauro
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论