这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@MaanooAk
Copy link
Contributor

@MaanooAk MaanooAk commented May 17, 2017

Classes

  • ResearchType immutable (contains the name, cost, patch ...)
    • will be extented by NyanResearchType
  • Research muttable (is active, is completed ...)
  • ResearchAbility and ResearchAction

Note: Support for repeating research

@TheJJ TheJJ added lang: c++ Done in C++ code area: simulation Involved in the game mechanics and simulation improvement Enhancement of an existing component labels May 20, 2017
if (type->category() == research_category::age_advance) {
type->owner.advance_age();

} else if (type->category() == research_category::age_advance) {
Copy link
Member

@TheJJ TheJJ May 20, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can do the research type-specific directly with nyan by testing the patch hierarchy:

// this procedure may of course change, but the principle will most likely remain.

nyan::Object research = ...;  // the research nyan object that now shall apply
// apply the research patch
nyan::Transaction tx = database.transaction();
for (auto &patch : research.get<nyan::Patch>("patches")) {
    tx.add(research);
}
tx.apply();

if (research.extends("openage.research.AgeAdvance")) {
    // do things for age advancements that nyan didn't patch (i don't know what that would be, maybe gui updates?)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I'm back)

EDIT: This was actually a typo: advance_age is handled at the first if, this was supposed to be generic, thinks that couldn't be handled just with nyan (eg. research that allows to see the enemy line of sight).
However my following explanation for the advance_age still stands

The code you posted will be
inside NyanResearchType::apply ->
which ovverides ResearchType::apply ->
which is called inside Reaseach::apply ->
which is called from the ReaseachAction::update

Notes:
ResearchType immutable (contains the name, cost, patch ...)
Reaseach muttable (is active, is completed ...)

Based on that when the gui will have to draw the progress bar at the top of the screen it need only action.research.get_categroy() == advance_age and action.timer.get_progress()

No need for the gui to dive into the nyan hierarchy...

Copy link
Member

@TheJJ TheJJ Aug 29, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Welcome back :)
Ah now I get it. Yes, we need to implement some research types in the engine, e.g. the line of sight. This would be done by specifying an object layout in nyan, which is then used by the c++-part to evaluate the data changes, e.g. the line of sight or whatever is needed. The switching of which c++-part to use still has to be done with a nyan-query, though.

The call hierarchy is correct I'd say. It would be a nice abstraction over the nyan backend.
I also like the difference between Research and ResearchType (i.e. ongoing vs its type).

To make the gui nyan-independent should be a high goal :D

This wrapping of nyan-types is a great idea to write the interface to nyan: Then we'd have C++-classes that do the intended access to nyan objects (=> they're tightly coupled) and the rest-code can just use the C++-interface. The way it should be done.

@MaanooAk MaanooAk force-pushed the tech branch 2 times, most recently from 9877c05 to 7a332c9 Compare August 29, 2017 21:30
@MaanooAk MaanooAk changed the title [WIP] Research (aka Technologies) Research (aka Technologies) Aug 29, 2017
Copy link
Member

@TheJJ TheJJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good improvements :)

We should really think about how we reorganize the gamelogic for the event-based engine.

We wrote down some ideas here:
https://pad.stusta.de/p/openage-architecture-v2

For discussing ideas etc, please come join our chatroom :)


int triggers;

};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should go into a separate file. All those monster files deserve to be split up, actually :)

This timer triggering should be synched with @Tomatower's event triggers, where such a timer would be registered and you'd get a function call for the right time. Might be a very good start for integrating into the event-architecture.

Copy link
Contributor Author

@MaanooAk MaanooAk Aug 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tomatower code is far away and huge changes will have to be made in order to be able to move into curves (I will write more at his pr)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TheJJ I'm not making a new file because the timer is a stepping stone to transition better to Events or Curves (I prefer Curves, more at #744)
(no problem if you insist)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The events are actually designed for that, and the only thing that is missing is a nice Api in the game engine - hopefully without major changes to the existing codebase - so inspire me for the best possbile api 😃

Attribute(UnitType *type, coord::phys_t r, coord::phys_t h, typeamount_map d)
Attribute(UnitType *type, coord::phys_t r, coord::phys_t h, typeamount_map d,
coord::phys_t min_range = 0, bool friendly_fire = false,
coord::phys_t area_of_effect = 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent, and default value assignments don't have spaces around the = please

Copy link
Member

@TheJJ TheJJ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me.

interval{interval},
max_triggers{max_triggers},
time_left{interval},
triggers{triggers} {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where does triggers come from? currently its the uninitialized member.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can this even compile? It must obviously be zero

@TheJJ TheJJ merged commit 6f47471 into SFTtech:master Sep 1, 2017
@MaanooAk MaanooAk deleted the tech branch September 1, 2017 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: simulation Involved in the game mechanics and simulation improvement Enhancement of an existing component lang: c++ Done in C++ code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants