Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Postie

Member Since 28 Nov 2010
Offline Last Active Yesterday, 09:12 PM

#5222839 Stream Leaks in SharpDX

Posted by Postie on 12 April 2015 - 07:22 PM

I'm using SlimDX targeting Dx9 (your mileage may vary), and an example of how I use the DataStream object is as follows:

 

            using (var dataStream = _indexBuffer.Lock(0, sizeInBytes, LockFlags.Discard))
            {
                dataStream.WriteRange(_indices);
                _indexBuffer.Unlock();
            }

My understanding of DataStreams is that they are temporary objects that are used to get data in and out of the D3D objects. 

 

So with that in mind, I keep an in-memory copy of the raw data in an array (_indices in the above code), and when that is updated, I call the above code to commit those changes to the actual index buffer.

 




#5221215 How should systems pick which entities to process? (Entity Component Systems)

Posted by Postie on 03 April 2015 - 05:05 PM

In my ECS, the systems themselves know which components they need to work with. I'm working with C#, so I've implemented that through Attributes. 

 

When an entity is created, the EntityManager notifies each system that a new entity was created, and the systems decide if they should care about it. If they do, they add the entity to their internal membership list. Similarly, whenever a component is dynamically added or removed from an entity, the same process is performed, and in some cases results in the entity being removed from the membership list of the system.

 

Finally, I have two different lists to specify the relationship between the component and the system. "AllOf" or "AnyOf". "AllOf" means the entity has to have all of the components in the list to be processed by the system. If any are missing, it is ignored. "AnyOf" means the entity will be included if any of the components are present on the entity.




#5195322 Where It all begins

Posted by Postie on 29 November 2014 - 04:12 AM

I'm a Software Development student at the University Of South Australia *Waves*.

 

 

Whoa.. a local on gamedev? *Waves back* 

 

If you are competent in 3 languages, its time to pick one of those and start a small game project. A lot of people on these forums recommend pong or something similarly simple, and though it sounds patronising, pong introduces you to most of the core concepts you'll encounter in any game. Eg: taking input from the player, drawing to the screen and the all important game loop.

 

Robert Nystrom's recent book "Game Programming Patterns" has some great stuff in it if you're transitioning from traditional software development to games. There's a free version hosted on his site at: http://gameprogrammingpatterns.com/contents.html but it is also available in various eBook formats as well as print.




#5194388 Funniest line of code ever ?

Posted by Postie on 24 November 2014 - 06:12 AM

This snippet comes courtesy of some healthcare related development I'm involved in: 

 

if (staff.StaffType != null && !staff.Staff.StaffTypes.Any(st => st.StaffType.Id == staff.StaffType.Id))

staff.Staff.StaffTypes.Add(new StaffStaffType(staff.Staff, staff.StaffType));

 

StaffBO.Save(staff.Staff);

 

Reminded me of the "Spam Spam Spam..." Monty Python skit.




#5194223 Game Maker v1.3 Code Crashes Game

Posted by Postie on 22 November 2014 - 10:46 PM

A program becoming unresponsive is quite different to crashing. What you've described sounds more like an infinite loop. From the code snippet you provided, I can see two while loops that - depending on the return value of place_meeting()  - could loop endlessly. I'd start by looking in there.




#5192930 is there a better way top refer to assets in a game?

Posted by Postie on 14 November 2014 - 07:16 PM


playwav("some_sound.wav"); 
 
is high on readability, but runs slow.

 

Do you have evidence to back up that claim? How is passing a string to a sound playing function noticeably slower than passing an integer?

 

Are you trying to say that loading the sound asset from disk by filename is slow when compared to pulling the sound asset from a cache by its integer id? If so, then yes that would be noticeably slower.

 

You can get the best of both worlds however by using an associative array (or dictionary) to allow you to look up the assets by some unique string... such as the filename.




#5190029 Game Development with Delphi: "Yes or No?"

Posted by Postie on 29 October 2014 - 03:36 PM

I'm a software developer working in the healthcare industry. I've been using Delphi professionally for 12 years, and C# for about 5. Over the years I've created a few small game projects in Delphi (using OpenGL), and more recently I've embarked on a much bigger game project in C# (using SlimDX).

 

For me, the writing was on the wall regarding Delphi, so back in 2008/2009 I decided I needed more job skills to stay competitive, and started learning C#. When it came to the decision about which language to build my new game idea in, C# was an easy choice. There's nothing better than a nice meaty project to grow your programming/language skills.

 

Your original post is a little ambiguous on intent. Ie, are you just trying to ascertain Delphi's popularity as a game development language or are you genuinely trying to come to a decision regarding what to use for your next project?

 

If its the former, I'd say, "No". I wouldn't recommend Delphi as a platform. There's too few of us that know Delphi compared to something like C#. It's hard enough to get other people to collaborate on game projects, I wouldn't want to reduce the pool further. Similarly, there are less games tutorials or examples of games written in Delphi, which limits the learning resources you can draw on.

 

On the other hand, if its the second option then I'd figure out how good your Delphi skills are versus other languages, or if you're interested in learning something new.

 

There's a lot more to games development than just picking the language to use. There's game loops, resource management, rendering, efficient data structures etc.. and all those can be implemented in ANY language.

 

My advice: pick the language you're most comfortable with, and go nuts.




#5189293 "Click to start the game"

Posted by Postie on 26 October 2014 - 05:30 PM

In most cases I think its a console requirement. In order for a game to be certified for a consoles, the games developers have to abide by the console's conditions, such as the "click to play" screen. Another I've seen is the "this icon means the game is saving, don't turn off the device" notification.




#5187934 Percentage Health (100%) vs. Numbered Health (100/100)? Which ones better?

Posted by Postie on 18 October 2014 - 11:50 PM


You already have a percentage showing - the visual bar is your percentage (if the bar is half light-red and half-darkred, then you know you are roughly 50%). Showing a textual percentage (such as "53%") is somewhat redundant. 

 

This is the exact conclusion I came to when tackling the same question for my own game. I'd definitely go with something like "234/500" and let the visual bar represent the percentages. 




#5186642 shadow shader

Posted by Postie on 13 October 2014 - 01:54 AM

This technique would only work with solid objects with a convex profile, right? It seems like something as simple as a torus wouldn't shadow correctly.




#5183266 Optimization philosophy and what to do when performance doesn't cut it?

Posted by Postie on 27 September 2014 - 03:57 AM

I dislike the way the "premature optimisation.." quote is misused, and quoted without the benefit of its original context. 

 

I take the quote to have 2 meanings:

  1. Get the code working first then worry about optimising.
  2. Don't rush into optimisation without profiling the code first.

The benefit of #1 is that you can keep your working, reference implementation and ensure the output of your optimised version is still working correctly. And #2 gives you the best bang for buck, since as developers, our time is precious. 




#5177539 Did I begin learning late?

Posted by Postie on 01 September 2014 - 06:32 PM

In many respects you're lucky you can start so early! Python only came to my attention in the last few years, and I'm in my 30's.




#5172556 Getting started

Posted by Postie on 09 August 2014 - 11:30 PM

The best advice I can offer is to start simple and practise often. There's no quick way to gain the knowledge you need, the reality is that you'll have to put in the time and build up your skills by trying projects of increasing complexity.

 

The choice of game engine is far less important.




#5157279 2D physics in a game.

Posted by Postie on 01 June 2014 - 02:36 AM

Game physics is something that only works correctly if you update it at a constant, predictable rate, independent of the rate you're rendering to the screen. The way this is commonly achieved is to define how often you want to update your physics, eg, 20 times a second, and then calculate the elapsed time between each rendering frame. Accumulate that over several frames until you reach 1/20th of a second, then do a physics update, using 1/20th of a second as your time parameter in all your physics equations. This means that your physics updates are all done with the same time difference (or delta), and they happen predictably, which means the motion of your objects will be smooth.

 

I highly recommend you check out "Fix your timestep!", the seminal work on the topic.




#5157098 2D physics in a game.

Posted by Postie on 30 May 2014 - 10:50 PM

Typically, you'd apply a force to an object, which would cause that object to accelerate. Over time, acceleration alters the object's velocity. Over time, velocity alters the object's position.

 

Force, Acceleration, Velocity, Position and Time. Those are the 5 things you need to worry about. If however, you also want your object to rotate, then you have Torque, Angular acceleration, Angular velocity and Orientation to worry about.

 

Though it seems like 2D physics should be pretty easy compared to 3D physics, the concepts are actually the same, but some of the formulae are simpler since they involve one less dimension. 

 

I wrote a simple 2D physics engine in C# about 4 years ago, and Chris Hecker's articles on rigid body dynamics were an invaluable resource.

 






PARTNERS