-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'tubes' of github.com:Tomatower/openage into tubes
- Loading branch information
Showing
51 changed files
with
2,159 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
|
||
add_sources(libopenage | ||
internal/keyframe_container.cpp | ||
internal/value_container.cpp | ||
queue.cpp | ||
continuous.cpp | ||
discrete.cpp | ||
curve.cpp | ||
discrete.cpp | ||
iterator.cpp | ||
map.cpp | ||
map_filter_iterator.cpp | ||
queue.cpp | ||
queue.cpp | ||
queue_filter_iterator.cpp | ||
) | ||
|
||
add_subdirectory(test) | ||
add_subdirectory(demo) | ||
add_subdirectory(internal) | ||
add_subdirectory(test) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,8 @@ | |
|
||
#pragma once | ||
|
||
#include <limits> | ||
|
||
namespace openage { | ||
namespace curve { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
add_sources (libopenage | ||
aicontroller.cpp | ||
gamestate.cpp | ||
gui.cpp | ||
main.cpp | ||
physics.cpp | ||
gui.cpp | ||
aicontroller.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Copyright 2017-2017 the openage authors. See copying.md for legal info. | ||
|
||
#include "gamestate.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
add_sources(libopenage | ||
keyframe_container.cpp | ||
value_container.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Copyright 2017-2017 the openage authors. See copying.md for legal info. | ||
|
||
#include "iterator.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Copyright 2017-2017 the openage authors. See copying.md for legal info. | ||
|
||
#include "map.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
|
||
#pragma once | ||
|
||
#include <iostream> | ||
#include <unordered_map> | ||
|
||
#include "curve.h" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Copyright 2017-2017 the openage authors. See copying.md for legal info. | ||
|
||
#include "map_filter_iterator.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Copyright 2017-2017 the openage authors. See copying.md for legal info. | ||
|
||
#include "queue_filter_iterator.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
*.smod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
|
||
*build* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
add_sources(libopenage | ||
keyframe_container.cpp | ||
#tube_container_iterator.cpp | ||
tube_event.cpp | ||
tube_queue.cpp | ||
tube_object.cpp | ||
tube_objectlist.cpp | ||
tube_continuous.cpp | ||
tube_discrete.cpp | ||
tube.cpp | ||
value_container.cpp | ||
) | ||
|
||
add_subdirectory(test) | ||
add_subdirectory(demo) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
TUBE DATATYPES | ||
================= | ||
|
||
This document describes the datatypes that should be available within the tubes library. | ||
They consists of simple, single dimensinal types and list types. | ||
|
||
This document is intended for brainstorming on needed datatypes. | ||
|
||
Simple Types | ||
------------ | ||
|
||
Simple types only have one distinct value at a specific point in time. | ||
|
||
Discrete Interpolation | ||
---------------------- | ||
|
||
"Step function" style values. These types adopt the new value exactly at the point in time changed. | ||
They are useful for example for values like unit capacity, hitpoints, resource count, ... | ||
|
||
Linear Interpolation | ||
-------------------- | ||
|
||
Linear connections between two points. These types have to overload the operators + and *, since these | ||
are used to interpolate between t\_n and t\_n+1. These values change consistently over time, if t\_n+1 exists. | ||
These are useful for example for unit position, building progress, ... | ||
|
||
Nyan Values | ||
-------------- | ||
|
||
This container keeps track of nyan objects over time and their respective properties. | ||
|
||
Container Types | ||
=============== | ||
|
||
Container types hold lists of items at any given time. They store a creation and a deletion timestamp for each item, and offer iteration logic to traverse the active elements in the container. | ||
|
||
Map Container | ||
------------- | ||
|
||
The map container stores items based on an unique identifier mapped to an item. It keeps track of the existence of the item. No guaranteed order of items within this container is given (similar to std::unordered_map). | ||
This container is useful for example for unit lists ... | ||
|
||
Set Container | ||
---------------- | ||
|
||
The set container stores items, just as a normal array would. It keeps track of the existence of the items, but does not guarentee any particular ordering (similar to std::unordered_set). | ||
This Container is useful for any non-indexed data structures, for example projectiles. | ||
|
||
Queue Container | ||
--------------- | ||
|
||
The queue container represents a random access queue while keeping the ordering of the queue. | ||
It is usually used for pushing in the back and popping at the front (FIFO-Stlye) but offers random access insertion and deletion as well. | ||
This container is useful for example for action queues and buildung queues. | ||
|
||
TUBE FILES | ||
============ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
add_sources (libopenage | ||
main.cpp | ||
physics.cpp | ||
gui.cpp | ||
aicontroller.cpp | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Copyright 2015-2017 the openage authors. See copying.md for legal info. | ||
|
||
#include "aicontroller.h" | ||
|
||
namespace openage { | ||
namespace tubepong { | ||
|
||
std::vector<event> &AIInput::getInputs( | ||
const PongPlayer &player, | ||
const PongBall &ball, | ||
const tube::tube_time_t &now) { | ||
this->event_cache.clear(); | ||
|
||
auto position = player.position.get(now); | ||
|
||
// Yes i know, there is /3 used - instead of the logical /2 - this is to | ||
// create a small safety boundary of 1/3 for enhanced fancyness | ||
|
||
// Ball is below position | ||
if (ball.position.get(now)[1] > position + player.size.get(now) / 3) { | ||
event_cache.push_back(event(player.id, event::DOWN)); | ||
} else if (ball.position.get(now)[1] < position - player.size.get(now) / 3) { | ||
// Ball is above position | ||
event_cache.push_back(event(player.id, event::UP)); | ||
} | ||
|
||
return this->event_cache; | ||
} | ||
|
||
}} // openage::tubepong |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 2017-2017 the openage authors. See copying.md for legal info. | ||
|
||
#pragma once | ||
|
||
#include <vector> | ||
|
||
#include "gamestate.h" | ||
|
||
namespace openage { | ||
namespace tubepong { | ||
|
||
class AIInput { | ||
public: | ||
std::vector<event> &getInputs( | ||
const PongPlayer &player, | ||
const PongBall &ball, | ||
const tube::tube_time_t &now); | ||
|
||
private: | ||
std::vector<event> event_cache; | ||
}; | ||
|
||
}} // openage::tubepong |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// Copyright 2015-2017 the openage authors. See copying.md for legal info. | ||
|
||
#pragma once | ||
|
||
#include "../tube_continuous.h" | ||
#include "../tube_discrete.h" | ||
#include "../tube_object.h" | ||
#include "../../util/vector.h" | ||
|
||
namespace openage { | ||
namespace tubepong { | ||
|
||
struct event { | ||
int player; | ||
enum state_e { | ||
UP, DOWN, START, IDLE, LOST | ||
} state; | ||
event(int id, state_e s) : player(id), state(s) {} | ||
event() : player(0), state(IDLE) {} | ||
}; | ||
|
||
class PongPlayer : public tube::TubeObject { | ||
public: | ||
PongPlayer() { | ||
speed.set_drop(0, 1); | ||
position.set_drop(0, 0.5); | ||
lives.set_drop(0, 1); | ||
state.set_drop(0, event(0, event::IDLE)); | ||
size.set_drop(0, 0.1); | ||
y = 0; | ||
id = 0; | ||
} | ||
|
||
tube::Discrete<float> speed; | ||
tube::Continuous<float> position; | ||
tube::Discrete<int> lives; | ||
tube::Discrete<event> state; | ||
tube::Discrete<float> size; | ||
float y; | ||
int id; | ||
}; | ||
|
||
class PongBall : public tube::TubeObject { | ||
public: | ||
tube::Discrete<util::Vector<2>> speed; | ||
tube::Continuous<util::Vector<2>> position; | ||
}; | ||
|
||
class PongState { | ||
public: | ||
PongPlayer p1; | ||
PongPlayer p2; | ||
|
||
PongBall ball; | ||
|
||
util::Vector<2> resolution; | ||
}; | ||
|
||
}} // openage::tubepong |
Oops, something went wrong.