Giter Site home page Giter Site logo

sethballantyne / plexis Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 20.69 MB

A Breakout clone written in C++/CLI using DirectX 8, complete with level editor written in C#.

License: MIT License

C# 13.93% C++ 85.61% C 0.32% Perl 0.13%
game directx directx8 directdraw directsound directinput dotnet cpp cppcli breakout

plexis's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m @sethballantyne
  • ๐Ÿ‘€ Iโ€™m interested in games and game engines; primarily engines, these days. I love making games, but making the tech that power games is stupidly fun to make and that's what matters, right? It's important to me that I create not only enjoyable experiences for players and users, but also good programs. I'm also interested in general assembly language programming, graphics demos, hacker culture and computing history (particularly the 80s and early 90s). I'm the person who learns a new programming language purely for fun.
  • ๐ŸŒฑ Iโ€™m currently learning Python (ew :p), DOS graphics programming (HACK THE PLANET!!!!) and playing around with different game engine architectures. I have a project I've always wanted to do but never did anything with until now. I figure if I don't start it now, when do I? That's where the DOS shit comes in; I have a penchant for punisment obviously. I'm always learning something new, we belong to a very wide field. I collect programming books too, so that's a thing.
  • ๐Ÿ“ซ How to reach me: [email protected]

plexis's People

Contributors

sethballantyne avatar

Stargazers

 avatar  avatar

Watchers

 avatar

plexis's Issues

Replace caller with something more descriptive

MenuItem's can specify caller as an navigateTo argument in the XML file, which specifies they should cause a transition back to the previous scene. Rename this to something more descriptive, such as "previous" or "back".

Ensure error messages are consistent

Make sure the same message is used consistently for each exception, for example everywhere DirectDrawInvalidObjectException is thrown, make sure the error message reads "DirectDraw received a pointer that was an invalid DirectDraw object."

of course, each exception is going to need a standard message assigned to it first. (see issue #20)

KeyConfigLabel doesn't handle keys not in Input's lookup table properly.

When prompted for a key, pressing a key that's not in the look up table causes the control to release the cursor as if the new key has been set, but the caption doesn't change. I was able to move the cursor to the "Console" key binding after trying to change "Screenshot" and pressing right ctrl when prompted to press a key; also does it when pressing the print screen key.

keyconfigbug

Video documentation doesn't document all exceptions

The documentation for the Video class methods only documents the exceptions thrown by any DirectDraw functions called within that method. If a method in Video calls another Video method, the exceptions thrown by the callee aren't documented.

Remove magic numbers

Convert all magic numbers into constants, pictureBox_MouseMove is a good example of magic numbers being sprinkled everywhere.

Cancelling the save operation results in an ArgumentNullException being thrown

When editing a level that hasn't previously been saved (doesn't exist on disk), clicking File->Save then cancelling the save file dialog results in an ArgumentNullException being thrown with the following stack trace:

at Level_Editor.Level.Save(String path) in c:\projects\project ball buster\src\PBB\Level Editor\Level.cs:line 91
at Level_Editor.MainForm.SaveLevel() in c:\projects\project ball buster\src\PBB\Level Editor\MainForm.cs:line 150
at Level_Editor.MainForm.saveToolStripMenuItem_Click(Object sender, EventArgs e) in c:\projects\project ball buster\src\PBB\Level Editor\MainForm.cs:line 380
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Level_Editor.Program.Main() in c:\projects\project ball buster\src\PBB\Level Editor\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

HighScores::GetPlayerName() throws ArgumentOutOfRangeException when highscores.dat is empty.

When the highscores.dat is empty, it'd probably be a good idea to populate the list highScores with defaults to avoid this.

[08/05/18 20:56:39] Fatal Error: System.ArgumentOutOfRangeException thrown. Specified argument was out of the range of valid values.
Parameter name: row
Stack trace:
at HighScores.GetPlayerName(UInt32 row) in c:\projects\project ball buster\src\pbb\game\highscores.h:line 105
at HighScoreTable..ctor(Int32 x, Int32 y, Int32 numberOfRows, Int32 vertialSpacing, Int32 indexXPosition, String rowNumberFont, Int32 PlayerNameXPosition, String playerNameFont, Int32 scoreXPosition, String scoreFont) in c:\projects\project ball buster\src\pbb\game\highscoretable.cpp:line 106
at SceneFactory.ParseHighScoreTable(XElement element) in c:\projects\project ball buster\src\pbb\game\scenefactory.cpp:line 212
at SceneFactory.Read(XElement sceneXML) in c:\projects\project ball buster\src\pbb\game\scenefactory.cpp:line 365
at SceneManager.Initialise(XElement scenesXML) in c:\projects\project ball buster\src\pbb\game\scenemanager.cpp:line 40
at Game.Initialise(HINSTANCE__* hInstance, HWND__* hWnd) in c:\projects\project ball buster\src\pbb\game\game.cpp:line 106
at WinMain(HINSTANCE__* hInstance, HINSTANCE__* hPrevInstance, SByte* lpCmdLine, Int32 nCmdShow) in c:\projects\project ball buster\src\pbb\game\main.cpp:line 175

Refer to the index in HighScoreRow as 'rank'.

It confuses even me and I wrote the friggin thing. Rename rowIndexLabel to rankLabel, update documentation etc. It is a rank after all, so that's what it should be called. You'll need to revise SceneFactory and HighScoreTable, too.

Handle exceptions

There's no exception handling in the existing code, so.. do something about it.

Handle garbage values in XML parser

The parser doesn't handle empty strings etc read from the XML file. If an asset defined in assets.xml contains bad data, it should be ignored.

Slider doesn't sanitize currentValue before use

It's possible to read a garbage value from GameOptions, which is assigned to currentValue in the slider's constructor. This value can be outside the bounds of the min and max values, which subsequently fucks with the line drawing code.

Restoring DirectX interfaces is broken

Currently, DirectSoundBuffer and DirectDrawSurface objects will Restore(), but they're not being re-filled with the appropritate bitmap or audio data which makes restoring them somewhat pointless.

'new level' operation isn't aborted when it should be.

When choosing to create a new level, if the user chooses to save the level from the resulting prompt and then clicks cancel on the save file dialog, instead of cancelling the operation the editor proceeds to create a blank map. What should happen is when the user clicks cancel on the save file dialog, the user is returned to the map as if he'd clicked cancel on the save prompt.

Implement XmlHelper::GetAttributeValueAsUInt32()

Needed when parsing the slider's XML. SceneFactory::ParseSlider() is currently using XmlHelper::GetAttributeValueAsInt32() to read the sliders length, which of course means it's possible for it to interpret negative values which I don't want in this case.

Mouse speed slider displays the track box at the incorrect position

When setting the track box all the way to the left, it'll render it one step to the right (as if it's been incremented once) the next time the game loads.
slider1

Likewise, setting it all the way to the right will cause the track box to the rendered off the track the next time the game is run.
slider2

the track box can still be used in both instances. On the event it's rendered off the track, you can slide it back onto the track by pressing the left arrow key and it'll then function correctly, respecting the lower and upper bounds (but still render in the wrong place the next time the control is displayed).

DirectDrawInvalidParametersException thrown when alt-tabbing and then navigating to a new scene.

In the main menu, alt-tab so the game is minimized. Maximize the game, then navigate to another scene; a DirectDrawInvalidParametersException will be thrown. Here's the stack trace:

Fatal Error: DirectDrawInvalidParametersException thrown. IDirectDrawSurface7::Blt: one or more of the parameters passed to the method are incorrect.

Stack trace: at Video.Blit(Rectangle sourceRect, Rectangle destinationRect, Surface surface) in c:\projects\project ball buster\src\pbb\game\video.cpp:line 1352
at Font.Render(Int32 x, Int32 y, String text, Object[] args) in c:\projects\project ball buster\src\pbb\game\font.cpp:line 94
at Label.Render() in c:\projects\project ball buster\src\pbb\game\label.h:line 79
at MenuItem.Render() in c:\projects\project ball buster\src\pbb\game\menuitem.h:line 136
at MenuItemContainer.Render() in c:\projects\project ball buster\src\pbb\game\menuitemcontainer.h:line 172
at Scene.Render() in c:\projects\project ball buster\src\pbb\game\scene.h:line 149
at Game.Render() in c:\projects\project ball buster\src\pbb\game\game.cpp:line 135
at Game.Update() in c:\projects\project ball buster\src\pbb\game\game.cpp:line 175
at WinMain(HINSTANCE__* hInstance, HINSTANCE__* hPrevInstance, SByte* lpCmdLine, Int32 nCmdShow) in c:\projects\project ball buster\src\pbb\game\main.cpp:line 195

Input::ReadMouse() throws a DirectInputInvalidParameterException

[01/05/18 09:03:56] Fatal Error: DirectInputInvalidParameterException thrown. IDirectInputDevice8::GetDeviceState: an invalid parameter was passed to the function, or the object is an invalid state.

Stack trace:
at Input.ReadMouse() in c:\projects\project ball buster\src\pbb\game\input.cpp:line 347
at Game.Update() in c:\projects\project ball buster\src\pbb\game\game.cpp:line 169
at WinMain(HINSTANCE__* hInstance, HINSTANCE__* hPrevInstance, SByte* lpCmdLine, Int32 nCmdShow) in c:\projects\project ball buster\src\pbb\game\main.cpp:line 195

Refactor ResourceManager::Load* methods

LoadSoundBuffers(), LoadSurfaces() and LoadXML() all have shared code that can be refactored into a single method and called as needed. The two calls to Directory::GetFiles() can be reduced to one, as well.

Cursor object

It might be a good idea to encapsulate the menu cursor in its own object. In the pseudocode for MenuItemContainer::Render(), there's the line
int cursorXPos := items[i]->Position->X - menuItemCursor->Width - sizeOfGapBetweenCursorAndMenuItems

it could be replaced with something like
int cursorXPos := items[i]->Position->X - menuItemCursor->Offset

it makes it a little bit cleaner. Also, it might be a good idea to stick the value stored in sizeOfGapBetweenCursorAndMenuItems in XML so it can be changed during development without rebuilding the binary. If cursor is implemented as its own class, it'd be a good idea to stick its configuration in XML anyway. It could look something like this:

<asset type="cursor" name="menu_cursor" distanceFromMenuItem="8" />

the name refers to the bitmap stored in the resource manager. You'd keep it in the same XML file as all the other assets (obviously).

Toolstrip button captions

Update the toolstrip buttons so they display caption when the user mouses over them. Include the keyboard shortcut in the description, where relevant.

Terminate the game when there's no resource elements in paths.xml

Currently, an error message is displayed if paths.xml doesn't have any resource elements, but continues to execute, leaving the user with a blank screen. It's probably better just throw an exception and terminate; the relevant changes need to be made within ResourceManager::Initialise().

Implement delete tool

Implement the tool that allows the user to delete bricks. Use the mouse cursor used by the BCC map editor so the user can differentiate between states.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.