Commit Graph

199 Commits

Author SHA1 Message Date
fc6f6e086f Add child entity to projectiles 2016-09-13 13:35:16 +10:00
1f799302c1 Fix sign multiplication error for projectile 2016-09-13 12:57:17 +10:00
8ddac9c110 Add projectile attack skill 2016-09-13 00:53:25 +10:00
5b682ddcf6 Add draft better string library implementation 2016-09-07 23:33:01 +10:00
da07ce3f75 Fix memory leak not freeing stb_decode ptr 2016-09-01 02:53:17 +10:00
4c38abc672 Integrate sfx audio into battle 2016-09-01 02:18:43 +10:00
5cccd3ebe8 Switch audio to hash table implementation 2016-08-31 19:59:56 +10:00
f6943e5efb Const asset and entity functions, minor clean up 2016-08-31 16:40:41 +10:00
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
8b0f2f93e3 Use better generic hashtable implement. for assets 2016-08-30 14:19:18 +10:00
c93e6ca37c Pull out xml loading to assetmanager code 2016-08-30 00:11:00 +10:00
1d09bdfa20 Draft implementation of hash tabled textures 2016-08-27 04:15:13 +10:00
4c0c2808ca Load terrain image into game 2016-08-27 03:37:56 +10:00
aa8590d585 Clean up memory usage of XML loading 2016-08-26 02:59:28 +10:00
17cc6063a3 Restore battle system using hash data structs 2016-08-25 18:29:36 +10:00
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
b43754986f Load sprite sheet into new atlas structure 2016-08-24 18:31:26 +10:00
84a2c5e382 Implement common_atoi and add unit tests 2016-08-24 15:25:58 +10:00
1f2c2082a0 Add framework to parse xml tree into game data 2016-08-23 18:20:20 +10:00
2c1d3f9593 Build XML tree from XML tokeniser, print xml tree 2016-08-23 15:19:03 +10:00
a1ff789485 Basic XML tokeniser for reading spritesheet xml 2016-08-23 02:40:38 +10:00
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
42a004e6e3 Align debug window to corner 2016-08-22 20:18:55 +10:00
ca415619dd Fix window logic to stop stealing scrollbar focus 2016-08-22 18:05:10 +10:00
4e585a4939 Move ui element rendering to window rendering 2016-08-21 15:19:11 +10:00
70a3032155 Add debug window, parent buttons to debug window 2016-08-21 00:21:50 +10:00
aa34bbefc3 Refactor window data to struct 2016-08-20 22:30:02 +10:00
1df75c54fc Add moveable window UI element 2016-08-20 18:41:17 +10:00
cc874888cc Add spacing in debug display stack, center all button text 2016-08-20 14:24:42 +10:00
801107908a Add toggle debug display button and config entry 2016-08-20 14:18:05 +10:00
6ec92358b2 Add audiostate field and audio toggle ui button 2016-08-19 00:56:02 +10:00
90068d2c64 Add string length in pixel func, add button label 2016-08-19 00:25:43 +10:00
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
e90b31de55 Separate UI code into own file 2016-08-17 18:04:51 +10:00
5cd7239c8a Switch rendering to xy bottom left, zw top right 2016-08-17 17:35:31 +10:00
cb857cfaa6 Reassign debug keys, backspace on textfield added 2016-08-17 15:57:42 +10:00
8aa23b7cfc Add delayed key repeat 2016-08-17 15:29:14 +10:00
80b35d404d Add better input parsing with key repeat tracking 2016-08-17 02:21:02 +10:00
22973ef51d Add text field draft implementation 2016-08-10 21:52:05 +10:00
4127542d1d Clean up scroll bar implementation 2016-08-10 18:23:19 +10:00
2d7262aa22 Add basic scrollbar imgui code 2016-08-10 01:43:26 +10:00
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
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
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
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
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
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
b5db6e0e2b Add one-shot audio playback (i.e. buffer all data) 2016-08-04 00:32:13 +10:00
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
190822c1f6 Add entity attack audio cue 2016-07-28 22:17:32 +10:00
9ec87fc8be Remove old tutorial file 2016-07-28 15:58:49 +10:00
85becdfd6c Merge the game to dengine, reduce header coupling
Until engine architecture can clearly be separated from the game, i.e.
notion of entity storage belonging to game and concept of entity belonging
to engine, worlds/scenes belonging to game or engine- the project will
only refer to Dengine.
2016-07-28 15:19:23 +10:00
8a3886a60e Separate entity functions to own file 2016-07-28 14:33:58 +10:00
1427ee3fde Add draft audio change concept on mob proximity 2016-07-28 13:36:16 +10:00
ac775b39c2 Add error checking to Audio API 2016-07-28 13:11:30 +10:00
09972ced6e Add start/stop audio api, fix delete buffer bug
On intermittent stop of OpenAL playback deleting the buffers without
unqueuing the current buffers is an invalid operation, causing invalid
audio states on alGetSource().
2016-07-28 01:55:21 +10:00
630f2eaa5d Add audio looping, simplify audio API
Audio can be played with 1 call, audio_beginVorbisStream which
encapsulates the initialisation of the renderer and release on finish.
OpenAL is quoted to have a limitation of around 32 sources. Audio
renderers hence acquire a source slot on playback and immediately release
on finish. This ensures that sources are held optimally and minimises the
possibility of saturating the available sources.

Renderers hold an index to the source list, which the index reveals the
source ID for their use.
2016-07-27 22:50:14 +10:00
824d8fd8a0 Initial integration of audio to entity structure 2016-07-27 18:39:51 +10:00
54dd5c84fa Enumerate audio devices, add multi-audio rendering 2016-07-27 16:52:10 +10:00
9c3df0c488 Fix console rendering old strings, refactor audio
Removed duplication of audio buffering code in audio update and streaming
vorbis.
2016-07-27 01:40:22 +10:00
84a0f755ea Abstract audio playback into own file 2016-07-27 01:34:26 +10:00
99a700ca13 Add audio-streaming and loop support 2016-07-26 18:47:55 +10:00
6b2e759257 Basic audio with stb_vorbis decoding and openal 2016-07-25 22:10:50 +10:00
71faaa78c4 Add openal-soft dependency, update opengl macro 2016-07-24 22:19:25 +10:00
8fc895e584 Unify entity update to only use state switches
Remove the use of beginAttack and endAttack in the entity update loop and
delegate all changes to entity through state switching. This
consolidates the flow of data in the loop more consistently by going
through one master function. This also minimises the number of
entry-points to functions that will update an entity states- for ease of
comprehension.
2016-07-24 01:22:59 +10:00
a43102ee26 Rotate targetting reticule to mob. Add pivot point
Notion of pivot point now for rotating, i.e. the anchor point at which
rotations are applied. Rotating the reticule is done by using inverse
trigonometry, namely atan2f.
2016-07-23 21:26:15 +10:00
358f850a2c Fixed wrong cross referencing attack to anim data 2016-07-22 19:29:12 +10:00
7b13615614 More corner case checks for battle interaction 2016-07-21 02:04:17 +10:00
2707c46df1 Add better support for multi-entity battles 2016-07-20 21:42:45 +10:00
906d66a12a Inline entityUpdateAndRender, clean up if branches 2016-07-20 20:13:44 +10:00
4f5270881f Add utility scripts for finding todos and statics 2016-07-20 17:15:31 +10:00
3aaad2fba3 Add basic entity death code for singular entity 2016-07-20 02:23:11 +10:00
3e2287e13a Link avatar UI health display to hero health 2016-07-20 01:06:29 +10:00
fd94eb5afd Mobs battle with hero, engine architect. changes
Mobs battle in real-time with the hero when in range. Start encapsulating
logic into entityStateSwitch() to organise entity properties changing
between different states.

Introduce basic concept of memory management in MemoryArena. Begin passing
around a memory object to track memory usage and eventually delegate
memory allocations through. Remove the old memory tracker in the debug
object and incorporate into engine primarily.

Add a debug console for logging information and events to the screen in
a console-like fashion. Debug is now initialised after the game, this is
so that you can pass the game's memory arena and font file to the debug
services. Debug services now properly initialise debug element positions
from this information and not through the update routine.
2016-07-19 21:19:26 +10:00
5fc58ca643 Create notion of state switching for entities
Encapsulate the process required to switch an entity from state to state
using a state switching function. Add extra minor debug markers.
2016-07-19 15:19:08 +10:00
403999b566 Change Animation names, stop input parse on attack 2016-07-19 13:32:31 +10:00
b8b76cecd3 Switch entity anims to use references to assets 2016-07-19 03:47:32 +10:00
fff9e6e5b2 Implement battle time bar attacking within range
The main debug drawing elements have been moved to debug.c to avoid
cluttering up the main game file. The downside is that thus far the debug
values only track values post-update.

We have a notion of begin attack and end attack to allow code to drive the
animation system and apply effects after an attack animation has
completed.
2016-07-18 22:02:47 +10:00
e00ef52f8a Add hitbox size/render size notion 2016-07-18 20:37:14 +10:00
c52d872058 Basic attack queue implemented for hero 2016-07-18 20:16:29 +10:00
129234fbeb Merge update with render section in update loop 2016-07-18 00:54:21 +10:00
4541023396 Basic tackle animation added 2016-07-18 00:45:39 +10:00
7971b10b74 Remove int v2 type, change V2i to cast i32 to f32
Mixing and matching V2 int and float types in the code creates too much
necessary work when an integer implementation has to interact with float
implementation. Let V2i create the cast for us and use floats for all
vector operations since they are mostly mathematic.
2016-07-17 23:45:59 +10:00
2745a8e25a Add simple animation scheduling infrastructure 2016-07-17 20:24:51 +10:00
88108bce19 Delete old assets, remove anim update in renderer
Begin to add notion of a hitbox entity size and the rendering size.
Dynamic entities such as players will have animations that should exceed
the size of the actual player, we should be able to render it at the
desired size even if larger than the actual size.

Collision still occurs on the entity size (i.e. hitbox). Remove the notion
of updating animation in the renderer, we update in WorldTraveller,
removing any concept of passing a "deltatime" to the renderer. The
renderer's purpose is to draw not parse animation logic.
2016-07-17 19:24:19 +10:00
62c5fe0629 Switch animation indexing to enum, toggle anim on spacebar 2016-07-17 17:16:09 +10:00
ca6790cb1c Add entity action timer to schedule commands 2016-07-17 15:27:37 +10:00
a426461dad Fix up include headers, try to reduce dependencies
Ensure that all headers are self-sufficient instead of relying on included
headers to include headers for execution.
2016-07-16 23:27:52 +10:00
6da8eff9b1 Fix hero avatar moving with camera 2016-07-16 21:08:30 +10:00
2d9fded235 Group texture & texture rect together in renderer 2016-07-16 20:21:49 +10:00
0d5725eb97 Entities now have health values associated 2016-07-16 20:06:52 +10:00
6c3ef63a65 Draw hero status on side with profile
Make hero texture rects start using the atlas data structure. Reduce the
number of slots for assets for now to minimise room for error.
2016-07-16 18:51:26 +10:00
d74cabf5c6 Fix rendering of rects, draw debug target reticule 2016-07-16 17:41:17 +10:00
d0b4c99787 Create empty texture idea, change function scopes
Some functions which should not be exposed in the API have been switched
to INTERNAL scope. We have a notion of an empty texture in World Traveller
that we can pass in situations where we just want to render a solid
colour with no associated texture.

The alternative to this was creating a separate shader for rendering
primitives but would require at some point to expose the AssetManager to
the renderer or the user on behalf has to manually switch shaders before
rendering (non-intuitive).
2016-07-16 17:15:03 +10:00
86b4d1e206 Add distance to battle range metric in pixels 2016-07-16 02:34:44 +10:00
12fbc1000e Basic framework for scaling text, unimplemented 2016-07-15 18:34:23 +10:00
0551f05e73 Rotate around entity center, update math notation
Change #define math functions to uppercase for consistency
2016-07-14 23:15:42 +10:00
b1875077b7 Additional debug string rendering infrastructure
Separate notion of rendering a static string, i.e. for debug display that
is absolutely positioned, and rendering of a regular string that moves
with the game camera.
2016-07-12 18:11:31 +10:00
d82afe49d0 Add memory allocation tracking data to debug state 2016-07-09 21:42:36 +10:00
54ecddad2f Add function call counting to debug infrastructure 2016-07-09 20:59:54 +10:00