Jump to content

  • Log In with Google      Sign In   
  • Create Account


We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.

Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


Member Since 13 Jun 2001
Offline Last Active Dec 25 2014 03:47 PM

#5128181 How do I increment a shared pointer?

Posted by Madhed on 02 February 2014 - 10:27 AM

That's not possible.


What are you trying to accomplish?


Why don't you use a std::vector instead of a plain array? i.e a shared_ptr to a std::vector

#5126125 640x512, is it safe?

Posted by Madhed on 24 January 2014 - 10:15 AM

I use 640x480 as a desktop resolution



#5125846 Database modeling

Posted by Madhed on 23 January 2014 - 06:09 AM

I found that thinking in normalised relational terms has a striking similarity to data oriented coding techniques.

#5124906 Are mutexes really fool-proof?

Posted by Madhed on 19 January 2014 - 03:18 PM

I'm not familiar with SDL but I suppose their codebase is not the problem here. The problem must be within your code. Which parts access the mutex and the shared memory?

#5124897 Are mutexes really fool-proof?

Posted by Madhed on 19 January 2014 - 02:48 PM

I've since replaced it with an SDL mutex. When that didn't work I used Win32 mutexes


In what way did it not work?

#5123137 8-Bit track feedback!

Posted by Madhed on 12 January 2014 - 03:46 PM

Sounds good. Not really 8-bit though? Reminds me more of the style of tracker based music from Unreal and Deus Ex.

#5123085 Animation code, simplify code

Posted by Madhed on 12 January 2014 - 11:43 AM

Hm, the code is really confusing. What exactly is going on here?

If you just want to find out the current animation frame to display, you could just do:


Edit: ...assuming every frame lasts for 1/50th of a second. I'm not sure if I read that correctly in the original post.

double dt; // Time since last update in seconds
double animationTime; // Time since the animation started in seconds
int numAnimationFrames; // Number of frames in animation
double timePerAnimationFrame = 1.0/50; // 50 fps
animationTime += dt; // Add passed time to animation
int currentAnimationFrame = int(animationTime / timePerAnimationFrame) % numAnimationFrames; // Get currently displayed frame, and loop

#5121226 Well into my first full game soundtrack. Any advice for advancing after this...

Posted by Madhed on 04 January 2014 - 04:44 PM

I can't give you any advice on this. Just dropping by to say I really enjoyed the music! Well done!

#5121125 Has there ever been game engines or libraries in assembly?

Posted by Madhed on 04 January 2014 - 07:56 AM

The Lucas Arts Adventures like Monkey island and Day of the tentacle used a virtual machine called scummVM. Actually I don't know if they used assembly for the engine but given the time I'm pretty sure large parts of it were written in ASM.


Also, Another world (Out of this world) was written as a virtual machine and could thus be ported to a lot of different platforms.

#5120735 float unlimited increasing rotation or use a if

Posted by Madhed on 02 January 2014 - 11:45 AM

@ Madhed : What is meaned with high level optimalisation ?


Low level: Optimizing small self contained functions like sin() cos() min() max() that are repeated 1000s of times.

High level: Finding better algorithms so you don't even have to call those things 1000s of times.


I don't know the code, so I'm just guessing.


If you find out that you spend 50% of the time in a function that is called millions of times your first idea might be to make the function faster, while it might be even better and easier to make sure the function isn't called that often in the first place.


Can you try http://www.codersnotes.com/sleepy (Very sleepy) ? It's a simple stochastic profiler that you can use to measure your program performance. It shows you were your program is spending most of its time.


If you like you can post screenshots of the results, so maybe we can discuss what's going on there.

#5120057 float unlimited increasing rotation or use a if

Posted by Madhed on 30 December 2013 - 11:10 AM

Can a i7 be faster with sin() instead of a lookuptable? , and maybe a Celeron ( which is my current game development pc with onboard graphics ) cant ?


Lookup tables are so 1990's. Think of the cache. Processors have become lightning fast since then while ram speed has not.

Also the line "i,m telling you : games are not playable with functions like sin() and cos() and sqrtf() ( i still need to get some fast sqrtf function by the way )." had me a retro-chuckling.

#5118226 Camera shake

Posted by Madhed on 19 December 2013 - 02:52 PM

shape the falloff function so it goes from 1 to 0 in 5 seconds: f(x) = 1-x/5


Then that would give you: shake(x) = sin(2*x) * (1-x/5)


That would be a linear falloff and assuming x starts at 0.


This is called easing and here are some nice examples: http://www.gizma.com/easing/

#5115402 What Language or Languages for Web and Mobile Apps

Posted by Madhed on 08 December 2013 - 11:39 AM

You basically have two options: Create native apps or create packaged web apps.


The latter is just a frameless browser window, running in fullscreen, displaying a local webpage. The framework supplies additional functionality that you usually

can't access from the web though. Camera access, File system, Microphone, Cross domain requests, etc.


Pro: Can reuse most of the code on any supported platform. Can resuse code from your website.

Contra: Is relatively slow. Uses more resources. Not all device features available.


Native app:


Pro: Can be optimized to run very fast and efficiently.

Contra: Different codebase for each operating system.


Languages used:


Native iOS: Objective-C / C / C++

Native Android: Java / C / C++

Packaged web app: Javascript / HTML / CSS


You also have the option to use a cross platform engine like Unity3D for example, where most of the code is written in C#.


If you want to deploy to iOS you ultimately have to have a Mac since the software (XCode) is only available for that. Some people have had success with a hackintosh although I don't know the legal consequences of using one to create iOS software.


For going the WebApp route I have used http://cordova.apache.org/ in the past, I think it's the most popular at the moment.

#5115230 Game State Machine with Component Based Entity Design

Posted by Madhed on 07 December 2013 - 05:07 PM

The state should not be the owner of the subsystem. That's the problem. The subsystems are services that your engine provides. The state is a client that can access these systems, that doesn't mean they cease to exist after you switch from one state to another.




The "gameplay" state holds Physics System, Graphics System, and Input System, while the "main main" state holds GUISystem and InputSystem


This is an arbitrary separation. What if you want to display a physically correct exploding character in your main menu or you want to display a GUI over your game scene?

#5115142 timeBeginPeriod under Windows 8.1 is always 15ms using GetTickCount?

Posted by Madhed on 07 December 2013 - 11:02 AM

IIRC this function used to change the timing behaviour of the whole system. Maybe they changed its behaviour in windows 8...

I guess you'd be better off using QueryPerformanceCounter and QueryPerformanceFrequency