Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Mar 2004
Offline Last Active Oct 20 2016 11:01 AM

Posts I've Made

In Topic: Passing data between states in an FSM

03 October 2016 - 07:59 AM

I dont think that each level here would need its own state, if you simplify this down abit, you can have an intro state - a menu state - a game state and a pause state.


The game state itself is what will actually handle the game side of these, including which level to load and render etc. I think having all these levels on seperate states like you can see adds a lot of bloat and complication to the design.


It could do something like the following


BaseState {

     void Load();

     void Update();

     void Render();



GameState : BaseState::Load()


     if( currentLevel == 0 )

           // Load the levels settings



GameState : BaseState::Update()





GameState : BaseState::Render()





This is obviously a very basic example, maybe someone has more time to better explain this ( or tell me im completly wrong )


Have a look at this tutorial ( Great reference for a lot of things ) http://gameprogrammingpatterns.com/command.html Altough not about states per say - it will show methods of passing and using paramaters like you have mentioned.

Another example on this site are states http://gameprogrammingpatterns.com/state.html :)
Just read it all, its a very imforative website, and explains alot well and in a fun way

In Topic: (VB) Barcode Reading / Scanning for Inventory?

06 September 2016 - 10:48 AM

Id also just recomend researching the scanner for compatability, I have only one experience with this - where i had spent money on a scanner - to find out it didnt run on any of the latest versions of windows for whatever bizarre reason, and as the company had closed down - were given no support for the device / drivers.


Im sure there was someway to make this work, but after being dishearthned at every beep of the scanner I gave up quickly :)

In Topic: Terrible performance on my first game

06 September 2016 - 10:41 AM

Ok, I felt bad about not at least attempting to anwer your question :P - I believe Oberon is correct here; in your update call you seem to be calling your collision detection on both your x and y axis, which is fine - but your collision detection is checking everything in the game each pass. So for each update - you are checking everything twice for collision.

You should try and reduce this down, something like quadtrees or other spacial partitioning maybe the way to go depending on how complex you see your game getting, but for a simpiler quicker way, maybe just keep track of enemys that are on screen / close enough to actually collide with - and test your collisions on this subset of enemies.

You could have a broadphaze / narrowphaze collision - where you first check if an enemy is within 500 pixels of your character - if so then check for all collision types, if not ignore it

In Topic: Terrible performance on my first game

06 September 2016 - 10:33 AM

I didnt look over your code in any detail, so I cant comment on your speed issues, maybe its time to start profilling and debuging :)


But on a design note, I did see you have a few classes that inherrit from your texture class, i.e.


class entity : public texture

class level  : public texture


This isint really correct, if you use the is-a / has-a rule here, I dont think you can correctly say

An Entity is a Texture, or a Level is a texture.

more likely:

An Entity has a Texture, a Level has a texture.


This shows you should be using compisition rather then inherittance in this case, I know this doesnt really answer your question, but just to note!

In Topic: Creating Classic Goldsrc Based Engine

02 August 2016 - 10:58 AM

That is an obnoxiously large font :)


As for why you want to use the engine, its your own choice - but your time would probably just be better spent using Unity or something similar  - I know you mentioned liking old games, but nothing stopping you making an old game in an new engine.


I only did a quick google search, but check out https://developer.valvesoftware.com/wiki/Goldsource at a glance, it appears to have links to what you what