Commit Graph
100 Commits
Author SHA1 Message Date
doylet 2fc3a0a941 Add web assets for readme 2016-11-30 22:37:08 +11:00
doylet 35e0569f8d Add score multiplier into game 2016-11-30 21:21:28 +11:00
doylet fb254b06ec Add sorting of render groups by zdepth 2016-11-30 18:18:36 +11:00
doylet 68976bd6f8 Remove strings.[h|c] files. Combined into common 2016-11-29 01:44:03 +11:00
doylet 10891ab56e Add resolution changer in options menu 2016-11-29 01:41:33 +11:00
doylet eb4b0e1714 Rudimentary resolution changer, window icon 2016-11-28 19:11:38 +11:00
doylet aeeef1a60f Add state data buffer to hold generic configs
Add some system that allows us to automatically define and allocate different
application states at runtime without having to manually make the entries into
our game state structure.

It's basically an array of pointers determined by the app states defined in the
appstate enum. This is necessary since different modes, (start menu, options,
game world) have different data and we'd like to be able to define them
uniquely.
2016-11-28 17:47:15 +11:00
doylet 15b4ff59f7 Change start screen to pre-init the world 2016-11-28 16:11:53 +11:00
doylet 6df92e7aed Change naming convention, merge texture/shaders
Reduce the number of files in project by merging texture and shaders into
assets/renderer file. It's better to keep code local to where it is rather than
splitting them into "self-contained modules". It becomes easier to understand
reading top-to-bottom and there's is less jumping around which can increase the
difficulty of comprehending the code.

Convert names to use more of a <namespace>_<object><Action> format.
2016-11-27 21:16:12 +11:00
doylet 2fb2e6db5b Add basic start screen
Adding a start screen led to cleaning up some initialisation processes. Dengine
now formally initialises subsystems from the respective .h files instead of
ad-hoc from the main game file.
2016-11-27 20:13:33 +11:00
doylet c61b2022ce Add variable font size generation 2016-11-27 18:23:43 +11:00
doylet ad14d6d822 Introduce temp memory to free memory leaks 2016-11-27 17:26:23 +11:00
doylet 3729ddf164 Merge branch 'master' of https://github.com/Doy-lee/Dengine 2016-11-26 21:20:39 +11:00
doylet cdf0ed64bf Add particle emitter on asteroid destroy 2016-11-26 21:06:41 +11:00
doylet 9cfe60fcf8 Set up user interface integration 2016-11-26 14:11:59 +11:00
doylet 91cc891b36 Add guard against null-audio in init playback 2016-11-26 13:34:23 +11:00
doylet d49811358a Fix bullet rendering artifacts
On delete entity, old entries were not being cleared out causing bullets being
the most commonly spawned object to inherit unusual behaviour from "dead"
entities. Fixed by ensuring on entity delete the entity entry is cleared out.

Also add rendering guard against malformed vertex points. The renderer has
a strict requirement that all polygons passed in are CCW. Bullets were being
formed with the mindset of a triangle strip causing it to render incorrectly.

Now renderer checks ordering of polygons points and asserts if incorrect. It
works based off calculating the bounding area polygons, where in CCW order this
will produce a negative result and positive for CW order.
2016-11-25 20:43:43 +11:00
doylet 5bb7fa8c13 Improve input handling using state flags
Fix reading one shot inputs not working due to prematurely clearing out state
data tracking input changes between one frame and another. The transition count
used to track this now stores difference between each frame in the input flags.

This also solves requiring at the end of the frame to update the transition
counts at the end of each update loop.
2016-11-25 18:03:25 +11:00
doylet d878cca8ab Children from destroyed are created with higher dP 2016-11-25 15:56:26 +11:00
doylet 6bc37dbe44 Add Asteroid sizing and asteroid split on destroy 2016-11-25 13:17:24 +11:00
doylet ea6ea02404 Add basic sound effects to game 2016-11-24 22:54:07 +11:00
doylet be1c009dfb Add asteroid collision handling 2016-11-24 21:05:14 +11:00
doylet 42ba86f05a Add ability to shoot and delete entities 2016-11-24 18:57:44 +11:00
doylet 6069ed8415 Fix interval overlap case for collision detection
If one interval were completely contained within another then the logic would
not correctly identify the overlap. Instead check the length of the intervals
and ensure the smaller interval of the two is compared against the larger one.
2016-11-24 00:27:24 +11:00
doylet 614fa53487 Fix broken t-strip rendering logic
Triangle strips were originally by chance were rendering correct for most cases
until collision detection was implemented. Incorrect assumptions about
specifying triangle strip winding order meant that on occasion the last triangle
in a polygon would not be rendered.

This has been amended by strictly ensuring that on rendering of polygon the
order is correct from the vertices that are passed in.
2016-11-23 23:47:23 +11:00
doylet 0c7824bf18 Move rotation step outside of inner rendering loop
We need to generate interim vertex points during the collision detection loop
that includes rotation to check for collision. During collision detection,
vertex points are rotated and positioned in placed for checking.

We also re-create this vertex list in the renderer suggesting that we could
cache the list in the entity or look at coupling rendering and collision
detection.
2016-11-23 13:42:46 +11:00
doylet 20749dd668 Fix entity origin and rotation about origin
Fundamental mismatch between rotation and offset of polygons. Polygons can be arbitrarily ordered in terms of vertices as long as they are in a CCW order.
However there should be no restriction on the starting vertex position.

Since this is the case, the entity offset for a polygon should offset from the
starting vertex to the perceived "entity origin". This entity origin is where
collision detection, rotation and movement is based off.
2016-11-19 16:42:13 +11:00
doylet 01f99dd0ca Add framework for SAT collision detection 2016-11-18 17:42:11 +11:00
doylet a4e5025dd4 Merge triangle rendering code to polygon code 2016-11-18 14:33:11 +11:00
doylet 68c0560b28 Refactor movement code into function 2016-11-18 13:43:50 +11:00
doylet 17dc6cc6fc Fix degenerate tris showing up in certain configs
Occasionally with the right orientation, degenerate triangles will appear as
they are no longer zero-area triangles which OGL can cull during rendering. The
issue comes from having to manually ensure each primitive in the rendering
pipeline sent to the render groups were correctly marked with degenerate
vertexes.

Instead, we can now just pass the vertex points straight through, using
a begin() and end() structure which will append the start and ending degenerate
vertexes for us.
2016-11-17 21:03:55 +11:00
doylet 064d17d34c Asteroid data merged to entity and display
Asteroids move and are a part of the entity sytem. Added some debug markers for
memory usage and fixed a bug in logic causing degenerate triangles to show up
depending on the angle of approach towards the origin.
2016-11-17 18:15:36 +11:00
doylet e49984b3d0 Add arbitrary asteroid polygon rendering 2016-11-17 00:50:49 +11:00
doylet b75d700dd6 Rename rect members from pos, size to min, max 2016-11-16 16:57:24 +11:00
doylet 21bf650298 Fix triangle rendering and wireframe 2016-11-16 13:00:59 +11:00
doylet 339ae38b38 Simplify shaders, enable coloring of primitives 2016-11-12 01:17:30 +11:00
doylet 981d87a2d7 Add proper wireframe mode, rotation to triangle 2016-11-12 00:22:09 +11:00
doylet 6d67485d49 Add primitive triangle rendering code 2016-11-11 21:43:03 +11:00
doylet 4795fe1cb1 Switch developing game to asteroids, start project
Switch to something of smaller scope in aim to be able to finish a project from
start to finish. Also allow refreshed eyes to review the existing API and see
what can be improved on after taking a short break from the project.
2016-11-09 22:36:41 +11:00
doylet ed6b961b61 Update readme to include features of engine 2016-09-24 15:11:34 +10:00
doylet 332888f3b5 Switch mem allocation to custom memory block
No longer repeatedly invoke malloc for retrieving memory. Some operations still
leak memory (notably audio streaming). We introduce notion of Transient and
Permanent storage. Transient memory is used for data in memory that is
temporarily allocated (i.e. graphics for that frame's output), and permanent as
more like game state storage.

We now give out pointers from a pre-allocated block of memory, so we have no
allocation cost and benefits of reduced memory leaks. The transient block gets
reset every frame. Any memory allocated within is cleared at no cost simply by
rearranging the base pointer of the memory block.
2016-09-24 14:43:59 +10:00
doylet 85b757aaa7 Update debug display for render groups 2016-09-23 21:15:22 +10:00
doylet 82421ca64c Improve performance by swapping render groups
Last used render groups are brought to front of render list when searching for
valid group- as per- recently used items are likely to be used again.
2016-09-23 19:36:18 +10:00
doylet 72d30b6320 Restore color modulation in render groups 2016-09-23 19:19:47 +10:00
doylet 3894d33485 Fix rotation on render, change rendering code
Premultiply transformation matrix onto vertices before sending onto GPU to
preserve transformation properties of entities before being batched into
a general group. This removes the model matrix from the shader pipeline- instead
in rendering code we deal in world space (which works out to be more intuitive).
Only in the last step in GLSL we convert back to normalised coordinates.
2016-09-23 18:02:53 +10:00
doylet 88ce511f2b Entity rendering now uses rectangle rendering code 2016-09-22 19:00:44 +10:00
doylet 23720fae19 Fix batch-render of strings, fix group logic
Incorrect assumption that strings only needed degenerate vertexes at the start
and end of each string instead of characters causing render "wings" between
separate strings.

Fix render-group not switching to next group if current group is full.
2016-09-22 18:46:53 +10:00
doylet ebe09bd345 Improved render groups, use degenerate triangles
Degenerate triangles allows a single triangle strip call to be called on
multiple independent triangles without "connecting" strips inbetween the
triangles.
2016-09-22 02:16:14 +10:00
doylet ec7a9e41ff Begin draft imeplementation of batched rendering
Render all entities with the same texture in one call. Currently only
implemented for humanoid entities. Since we are rendering using triangle strips,
between entities there is invalid rastered data between entities. Using
degenerate triangles this may be mitigated, by indicating to OGL which triangles
it can skip in the rendering process.
2016-09-21 19:21:27 +10:00
doylet 7cb13b3cf8 Add additional entity struct data
Attempting to add child weapon data to an entity has revealed the need for an
entity origin to which children start transformations from. Worth exploring
scene graphs in the future.
2016-09-15 03:20:13 +10:00
doylet 5c4f493979 Add support for more attack-animations
Exploratory code to determine how to architect the engine for increasing
requirements in game play.
2016-09-14 01:34:57 +10:00
doylet fc6f6e086f Add child entity to projectiles 2016-09-13 13:35:16 +10:00
doylet 1f799302c1 Fix sign multiplication error for projectile 2016-09-13 12:57:17 +10:00
doylet 8ddac9c110 Add projectile attack skill 2016-09-13 00:53:25 +10:00
doylet 5b682ddcf6 Add draft better string library implementation 2016-09-07 23:33:01 +10:00
doylet da07ce3f75 Fix memory leak not freeing stb_decode ptr 2016-09-01 02:53:17 +10:00
doylet 4c38abc672 Integrate sfx audio into battle 2016-09-01 02:18:43 +10:00
doylet 5cccd3ebe8 Switch audio to hash table implementation 2016-08-31 19:59:56 +10:00
doylet f6943e5efb Const asset and entity functions, minor clean up 2016-08-31 16:40:41 +10:00
doylet e9db7b0570 Convert subtextures to use hash tables
Also clean up and add some block comments to aid code separation mainly in
AssetManager.
2016-08-30 18:42:37 +10:00
doylet 8b0f2f93e3 Use better generic hashtable implement. for assets 2016-08-30 14:19:18 +10:00
doylet c93e6ca37c Pull out xml loading to assetmanager code 2016-08-30 00:11:00 +10:00
doylet 1d09bdfa20 Draft implementation of hash tabled textures 2016-08-27 04:15:13 +10:00
doylet 4c0c2808ca Load terrain image into game 2016-08-27 03:37:56 +10:00
doylet aa8590d585 Clean up memory usage of XML loading 2016-08-26 02:59:28 +10:00
doylet 17cc6063a3 Restore battle system using hash data structs 2016-08-25 18:29:36 +10:00
doylet 7ca42f781a Start merging hash table access into assets
Basic implementation with many pre-existing features disabled untill all
parts of the system that interact with the assets transitions over.
2016-08-25 02:06:32 +10:00
doylet b43754986f Load sprite sheet into new atlas structure 2016-08-24 18:31:26 +10:00
doylet 84a2c5e382 Implement common_atoi and add unit tests 2016-08-24 15:25:58 +10:00
doylet 1f2c2082a0 Add framework to parse xml tree into game data 2016-08-23 18:20:20 +10:00
doylet 2c1d3f9593 Build XML tree from XML tokeniser, print xml tree 2016-08-23 15:19:03 +10:00
doylet a1ff789485 Basic XML tokeniser for reading spritesheet xml 2016-08-23 02:40:38 +10:00
doylet 4d7025876f Reorganise, separate motion from input parsing
Parse input was computing irrelevant data. The function has been inlined
and extraneous computations in the function has been moved to the
appropriate locations.
2016-08-22 23:13:44 +10:00
doylet 42a004e6e3 Align debug window to corner 2016-08-22 20:18:55 +10:00
doylet ca415619dd Fix window logic to stop stealing scrollbar focus 2016-08-22 18:05:10 +10:00
doylet 4e585a4939 Move ui element rendering to window rendering 2016-08-21 15:19:11 +10:00
doylet 70a3032155 Add debug window, parent buttons to debug window 2016-08-21 00:21:50 +10:00
doylet aa34bbefc3 Refactor window data to struct 2016-08-20 22:30:02 +10:00
doylet 1df75c54fc Add moveable window UI element 2016-08-20 18:41:17 +10:00
doylet cc874888cc Add spacing in debug display stack, center all button text 2016-08-20 14:24:42 +10:00
doylet 801107908a Add toggle debug display button and config entry 2016-08-20 14:18:05 +10:00
doylet 6ec92358b2 Add audiostate field and audio toggle ui button 2016-08-19 00:56:02 +10:00
doylet 90068d2c64 Add string length in pixel func, add button label 2016-08-19 00:25:43 +10:00
doylet c33b37b0ea Render battle damage on screen, draft implementation
Crudely done to get an understanding of the kind of storage needed to
store UI on screen that may have a limited life time.
2016-08-17 20:37:56 +10:00
doylet e90b31de55 Separate UI code into own file 2016-08-17 18:04:51 +10:00
doylet 5cd7239c8a Switch rendering to xy bottom left, zw top right 2016-08-17 17:35:31 +10:00
doylet cb857cfaa6 Reassign debug keys, backspace on textfield added 2016-08-17 15:57:42 +10:00
doylet 8aa23b7cfc Add delayed key repeat 2016-08-17 15:29:14 +10:00
doylet 80b35d404d Add better input parsing with key repeat tracking 2016-08-17 02:21:02 +10:00
doylet 22973ef51d Add text field draft implementation 2016-08-10 21:52:05 +10:00
doylet 4127542d1d Clean up scroll bar implementation 2016-08-10 18:23:19 +10:00
doylet 2d7262aa22 Add basic scrollbar imgui code 2016-08-10 01:43:26 +10:00
doylet db1eb7b9f3 Switch over to rect vs v4 where appropriate
Main change is switching the camera to use a rectangle. There is no rect
change in renderer for grouping size and position together. Due to
noticing the use case of rendering- where it's convenient to be able to
offset the rectangle from the position value when passed into the
function explicitly without having to re-create offset Rectangle structs
to pass in.
2016-08-04 22:17:14 +10:00
doylet eb1962e05e IMGUI use data from Gamestate, fix pointInRect bug
Wrong if logic causing point-in-rect to be valid if only x or y is
valid, where correct logic is both x and y need to be within the rect.
2016-08-04 21:17:16 +10:00
doylet 8eb9068093 Add notion of rect struct and button rendering
Begin switching over to using Rect instead of V4s for rectangle operations
for added semantics of pos and size, instead of 2 coordinate points. There
    are more meaningful rectangle operations based on its position and
    size. By providing that upfront it's more intuitive and convenient
    than deducing size from subtracting two vector elements.
2016-08-04 19:42:35 +10:00
doylet adb1aa83f3 Add mouse tracking, add null-texture gen function
Refactor the creation of the null-texture into a function. Used for
blitting rectangles that don't have any texture associated with it.
2016-08-04 18:46:46 +10:00
doylet aa505ed0b3 Remove input dependency on GLFW in game code
Create own platform abstraction for keyboard input for use in game code.
2016-08-04 18:19:02 +10:00
doylet 523fe0f2b1 Introduce notion of attack spec for battles
An attack spec will be used to hold the stats of both the attacker and
defender, grouping the data necessary to determine how much damage the
defender takes and other statuses caused by the attack.
2016-08-04 00:48:43 +10:00
doylet b5db6e0e2b Add one-shot audio playback (i.e. buffer all data) 2016-08-04 00:32:13 +10:00
doylet 1900de6a92 Create event queue and start sorting entity list
Use event queue to decouple audio playback from the battle system. Switch
back to using begin and end attack within the entity update loop for
conciseness.
2016-08-03 23:20:03 +10:00