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!


Member Since 14 Jan 2014
Offline Last Active Apr 25 2015 09:08 AM

Topics I've Started

Creating a fluid-like shader

04 April 2015 - 05:17 PM

I'm toying with an idea in my head for a 2D game that involves a fluid like substance on the screen that changes color and moves as sprites move over (or "through") it. In my research I came across a few other games that do something similar to what I'm thinking.


One that I quite like is an old game called Plasma Pong. Here is an example.


From what I understand in this game he is using proper fluid dynamics, which is probably overkill for what I'm thinking. But the effect is similar. I'm thinking perhaps a pixel shader applied to a full screen quad. Then use a render target to set pixels for the position and color of the sprites on the screen. The pixel shader can then use this render target texture to change the "plasma" so it moves and changes color.


Would an approach like this work? I'm not a shader expert so just not sure where to start with this.

Equation for Zooming

01 March 2015 - 03:21 AM

For some reason I'm struggling to work out something that I thought would be simple. I'm working on a 2D game and I'm trying to get a zoom working. Here's what I've got to work with.


minZoom = 0.2f <-- This is the smallest zoom amount (i.e. so the whole map can be seen on the screen)

maxZoom = 4.0f <-- This is the largest zoom amount (i.e. the map is zoomed in 4x its size)


My first thought was that I could just linearly interpolate between the two values. I wanted to have something like 10 or 20 discreet steps in between minZoom and maxZoom (I'll decide on how many once I get this working and see how it feels). However liner interpolation doesn't work because with a fixed number of steps, the step size is the same between each step. This means that as you zoom out, the jump in pixel size gets bigger and bigger so the zoom becomes like an exponential zoom, which means that near maxZoom it is very slow (turn the mouse wheel a lot for not much zoom) and near minZoom it is very fast (turn the mouse wheel a little and it jumps a lot).


So to solve this problem I need to do some sort of easing I think, so that the number of steps is fixed, but the step sizes are variable. They should start out at size x at maxZoom and then get smaller as you approach minZoom. What size x is and how fast they get smaller will probably require so trial and error to get the feel right so that the zoom feels constant.


I'm stuck with working out the math for this. I've tried a number of things but can't get anything to work right. I found the quadratic easing in function here http://gizma.com/easing/#quad1, which seems to do what I want, but the problem with that function is it works over a period of time. I don't know what that "period of time" is.


I have my two extreme values (4.0 and 0.2) and the number of steps in between (let's say 10, but it could be 20 or 15). Each time the mouse wheel is "clicked" I want to increment that step by 1 up or down depending on which way the mouse wheel is rolled. I need to come up with a function that will interpolate between 4.0 and 0.2 in 10 steps (inclusive, i.e. step 0 = 4.0 and step 9 = 0.2) but with a variable step size so that it starts with a step size of x, which is reduced in size with each step in order to slow down the zoom.

RakNet still alive?

22 January 2015 - 08:47 PM

I've noticed that every since Oculus VR purchased RakNet it seems to have died? The last official release was in June. The github repository hasn't had any real updates since July last year, with a bunch of unattended reported issues. Rakker himself hasn't been active on the forums since March last year (obviously because he sold it) and the RakNet forums are so quiet now. In fact there is more spam on those forums than actual posts. Any actual posts from people looking for help just get no replies.


I'm just about to start a new project and am investigating networking at the moment, so have been looking into RakNet, but it just seems to have died now ever since Oculus VR took over? I don't want to start using something that has no support or active development. Does anyone know anything more about this?

Creating an object in C++

27 November 2014 - 05:20 AM

I'm just wondering if it is possible to actually create an asIScriptObject in C++ and add member variables to it.

I know I can create an AS class and use it to create an asIScriptObject, but what I'd really like to be able to do is parse an xml file of name and type pairs and then build an asIScriptObject from it.

For example if the xml had <testMember>int</testMember> in it, then I would like to create an asIScriptObject instance and then do something like testObject->addMember("testMember", "int").

The idea is that latter on I can pass these dynamic asIScriptObjects to AS scripts to be operated on.

Removing @?

19 October 2014 - 06:16 PM

I've been working the AngelScript for about 12 months now and am progressively get more tired of the @ symbol. For some reason it always confuses me and trips me up. I've read the documentation a number of times about it, but always seem to struggle with this one aspect of AngelScript. Other than that I've found AngelScript to be really good (except for the lack of a supported JIT compiler, but that's another question).


I was just browsing the AngelScript website and noticed the removal of the @ symbol under the "Work in progress" section, which made me pretty happy. Why wasn't this decision made earlier? I would love to see all ref types treated as handles. Aren't they almost the same thing anyway?


Is there a reason though why this change is under the "long term goals" and how "long term" are we talking here?