Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Groogy

Pages: 1 2 [3] 4 5
31
General / Destroyable environment without tiles. [DISCUSSION]
« on: July 05, 2011, 02:04:50 pm »
I am not 100% sure if I put this in the right forum but here it goes.
I have had this on my mind for a long time and tried to figure out logically how to do it. I am not interested in actually implementing it but rather how to. This topic is if anyone interested in starting a discussion on how to achieve this functionality. So I urge, no implementation details or anything like that. Just plain mind game. If you guys are interested of course.

A sandbox game where you can destroy the environment(ground, objects, etc.) and it have an effect on the game world. For a quick example of what I mean then Minecraft. But Minecraft has the easiest way to implement this. Using tiles. Infiniminer which goes a bit more advanced on this subject used voxels. Though it still had that squarish look to it. Which I want to avoid. There is no requirement that the maps are generated procedurally but it would be a bonus if the system would support that.

So far what I've come up with is faking it with tiles. So let's say we have a grid of tiles. And we hit one of the tiles with a pickaxe. Where we hit with the pickaxe we add a vertex a bit inside so it looks like the tile has collapsed a bit inward. The problem is when to remove the tile. Because when removed it will get back to that squarish look again. Plus some other game design problems come to mind if you just think some extra steps forward.

Anyway my basic idea is "when hit" deform the tile.
Anyone else interested that got suggestions/ideas?

32
SFML projects / Groogy's Game Engine
« on: June 21, 2011, 08:20:56 pm »
GG Engine - Groogy's Game Engine
Groogy's Game Engine is a multi-threaded 3D game engine I have been working on for the past year. I don't got much of imagination when it comes to names so I named it to Groogy's Game Engine but lucky enough it's acronym results into GG Engine, GG which is also an acronym for Good Game.

So what's so good about it? Well I've tried to make the complex and hard things to be simple to work with. For instance threading in the SDK is non-existent for the user and does not need to concern himself about it at all. Most of the 3D math for rendering is also handled internally by the engine and most optimisations that needs to be done will be hidden behind the public API. What will be in focus is to make a game and not a decent frame rate or how things are culled by a frustum.

The Users
Who is this aimed at? Well I made it for use by myself but who knows there might be someone else that want to jump straight into game making without having to worry about multi threading, model loading, skeleton animation, efficient culling and the like.

Features
Here's a list of the features that it currently support:
  • Seamless multi-threaded input, logic, rendering. The user only need to define the logics.
  • Nice wrap around OpenGL for 3D rendering.
  • Nice wrap around SFML for Windowing, Input and 2D Rendering.
  • Object-oriented interface to rendering.
  • Instance-Model Graphs.
  • Wavefront Object and Material file parsing.
  • Helper Design Patterns like Singleton, Component-based Objects, Observer Objects, etc. etc. (These are added overtime, not all have been made yet)
  • Resource Management.
  • Flexible post master system(though I call it signals)
  • Vector and Matrix classes for 3D uses.
  • An Orientation class that makes Matrixes and Vector's easier to use for newcommers to 3D math.
  • Automatic Frustrum against Oct-tree culling for rendering thread.
  • Easy to implement and use debug information at runtime.
And a list for things that is planned to be implemented:
  • Generate bounding boxes when loading a model.
  • A modifiable origin for 3D objects.(Kind of like sprites in SFML)
  • Skeleton Animations.
  • An interface that is easier to work against
  • System to handle configurations and parsing from a file or maybe the OS.
  • State stack with some predefined states.
  • Properly pass material parameters to OpenGL for use in shaders.
  • Lighting interface to the rendering thread.
  • Allow object-specific shaders.
  • Shader function library for common used things.
What I am thinking about but is not my highest priority:
  • Encapsulate SFML entirely so the user don't even need to know that SFML is used.
  • Bindings to ruby, since only one thread is exposed to the user it's perfect.
  • Base GUI system.
  • Plugin system.
  • Rendering Optimization, currently everything is rendered intermediate.
  • Dynamical Destructible Objects(Won't look good but can be disabled)
Example
An example that will render a sprite and a rotating 3D model on screen. Will handle the even that the window closes and also let's you move around in the 3D world.
Code: [Select]
#include <GGE/Application/Application.hpp>
#include <GGE/Application/ApplicationLogics.hpp>
#include <GGE/Application/Sprite.hpp>
#include <GGE/Application/Text.hpp>
#include <GGE/Application/Object.hpp>
#include <GGE/Application/Camera.hpp>
#include <GGE/Application/BasicCameraController.hpp>

class MyApplication : public GGE::ApplicationLogics, GGE::Signals::Receiver
{
public:
MyApplication()
{
myRotation = 0;
GetSignalSender().SubscribeReceiver( this, "Signal.Window.Quit" );

GetSignalSender().SubscribeReceiver( &myPlayer, "Signal.Mouse.Moved" );
GetSignalSender().SubscribeReceiver( &myPlayer, "Signal.Keyboard.Pressed" );
GetSignalSender().SubscribeReceiver( &myPlayer, "Signal.Keyboard.Released" );
}

~MyApplication()
{
GetSignalSender().UnsubscribeReceiver( this, "Signal.Window.Quit" );
}

void Initiate()
{
GGE::Graphics::TextureHandle texture = GGE::Graphics::TextureManager::Instance().Get( "resources/hal-9000-eye.jpg" );
GGE::Graphics::ModelHandle model = GGE::Graphics::ModelManager::Instance().Get( "resources/TexturedCube.obj" );

myTestText = GGE::Interface::Text( "test.text" );
myTestText.SetString( "Hello World!" );
myTestText.EnableRender();

myTestSprite = GGE::Interface::Sprite( "test.sprite" );
myTestSprite.SetTexture( texture );
myTestSprite.SetScale( 0.5f, 0.5f );
myTestSprite.SetPosition( 100, 100 );
myTestSprite.EnableRender();

myTestObject = GGE::Interface::Object( "test.object" );
myTestObject.SetModel( model );
myTestObject.EnableRender();

GetContext().GetCamera().SetPosition( 0, 0, 10 );
myPlayer.SetCamera( GetContext().GetCamera() );
}

void Update( const sf::Uint32 aDelta )
{
myRotation += aDelta / 1000.f;
myTestObject.SetRotation( 0, myRotation, 0 );

myPlayer.Update( aDelta );
}
private:
bool ReceiveSignal(const GGE::Signals::Base &aSignal)
{
if( aSignal.GetType() == "Signal.Window.Quit" )
{
GGE::Application::Instance().Exit();
return true;
}
return false;
}

GGE::Interface::Text myTestText;
GGE::Interface::Sprite myTestSprite;
GGE::Interface::Object myTestObject;
GGE::Utilities::BasicCameraController myPlayer;
float myRotation;
};

int main()
{
   GGE::Application::Create( new MyApplication() );
   GGE::Application::Instance().MainLoop();
   GGE::Application::Release();
   return 0;
}

The SDK
Alright I would say an alpha version has been released now: https://github.com/Groogy/GGE
So far everything to my knowledge works and it's stable.
A lot of more features will be implemented. If you feel "I need this thing now" then just give me a message about it and I'll implement it as fast as  I can.

Documentation
Groogy's Game Engine Tutorial 1 - Introduction: Youtube, Download
Groogy's Game Engine Tutorial 2 - Getting Started Part 1: Youtube, Download
Groogy's Game Engine Tutorial 2 - Getting Started Part 2: Youtube, Download part 1, Download part 2
Groogy's Game Engine Tutorial 3 - Drawing 3D: Youtube, Download part 1, Download part 2

Questions & Suggestions
I am very happy to answer any questions or listen to suggestions you might have. You can ask/suggest privately or here in the thread. Of course you can also send me a message on Github or use any of the great tools Github provides for communication.

33
General discussions / Shared libraries management with Windows
« on: June 14, 2011, 09:34:41 pm »
[split from another topic]

Quote from: "Silvah"
Not true.


Not used any more since VS2010
http://msdn.microsoft.com/en-us/library/bb531344.aspx
http://msdn.microsoft.com/en-us/library/dd293574.aspx
Now names are used instead in Windows and this does not count as a good management of versions as you has to manually add the version. Linux operates in that you link against the library name and not the version so the latest one will always be used. This is done without any interference from the user/developer as Side-By-Side Assemblies require.

Also, Windows still lack a common place to have DLL's in order to not duplicate them.

So no I was pretty true in my statement.

34
Graphics / How to get glCreateShader and other 3.x > functions
« on: June 11, 2011, 11:13:56 pm »
Yeah well as I continue with my engine the only thing left that is not wrapped in the rendering part is shaders. Got an interesting idea that I'll have for my engine but this is my first time ever using shaders in OpenGL so it's fairly new concept for me.

I looked in the Shader.cpp source for SFML and found you used the ARB version? What is the difference from using the GLuint glCreateShader(GLenum shaderType); function?

Also I tried using the glCreateShader function but according to my VS2010 it's an undefined symbol... I tried both with including <gl/GL.h> and <SFML/OpenGL.hpp> but no prevail. I was missing several functions I think was added in OpenGL 3, how do I get the correct development files for that?

Also what is recommended to use? Fairly new to this so any suggestions, ideas and opinions are appreciated.

UPDATE: Got a hold of glCreateShader from GLEW but still would like to know what the pro's and con's are, what the difference is and what I should use.
Also curious, I could get a OpenGL 3.3 context but if taking OpenGL 4.1 it reverted back to 3.3, is OpenGL 4.1 supported at all by SFML or is it just that my laptop is too crappy?

35
Graphics / I'm missing something with sf::Context and sf::Image
« on: June 03, 2011, 06:07:37 pm »
Aight well I am missing something. As you know or may not know I am doing my stuff multi-threaded so I have to create a context for the thread if I want to load images. The weird thing is, it worked without a context in Debug but not in Release? The problem appeared as that the sprite is rendered with it's correct size but it's texture is not applied. With debug information in release I do get that the sprite's pixel pointer actually got the correct values in it so it seems like the image actually was loaded.

Anyway I thought nothing of it and tried adding a context to my logic thread like this:

Code: [Select]

// NOTE: This is actually my base class that wraps around a sf::Thread.
void Threading::Looper::Loop()
{
sf::Context context; // Added here <-----
while( mySynchro.myShouldThreadExit == false )
{
if( mySynchro.myIsThreadAllowedToStart == true )
{
Init();  // Image is loaded to memory here <-----
break;
}
System::OS::Yield();
}

while( mySynchro.myShouldThreadExit == false )
{
if( mySynchro.myIsThreadAllowedToStart == true )
{
mySynchro.myIsThreadAllowedToStart = false;
Frame();
mySynchro.myIsThreadFinished = true;
}
else
{
System::OS::Yield();
}
}
}


No change what so ever EXCEPT that when I exit now I see the sprite with it's actual graphics for one frame before the window closes.

So what am I missing? Is there nothing on the SFML side I've missed and it has to be something stupid on my behalf? Since it works in Debug but not in Release I feel like I have a race condition. But it freaks me out that I could load the image without a context and that's why I'm checking here first.

Ow yeh moving the loading of the image to the main thread does solve it for release. But I don't find this acceptable as then I can't have a responsive loading screen(Main handles events and thread synchronization).

36
Window / Save/Restore - GLStates got me really confused
« on: June 02, 2011, 12:38:20 am »
Well yeh. The title says it all. I hope this is getting changed when the new graphics API comes because it's like try and error to get it working.

First and foremost, it was like if not all values were being saved, I have to implement my own "Graphics::Context::State" class to keep track of the values that were not properly set which was back face culling and setting polygon mode to only render lines(wireframe).

This behaviour can be replicated by just adding this to the opengl example:
Code: [Select]
glEnable( GL_CULL_FACE );
glCullFace( GL_BACK );
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);


No sprite nor text will be shown when these is enabled. Commenting out glPolygonMode so we do a fill instead of a line between vertexes will still not render any sprite or text. Doing the same with culling but leaving glPolygonMode on will make it so that only a wire frame for the sprite and text is shown. Shouldn't Save/Restore - GLStates handle this so that these values are properly set?

Like I said would be much nicer if we had some cleaner more secure way to do this. Maybe some kind of state class? So we can save away several states and then push them into the render target?

Something like this:
Code: [Select]
sf::State stateFor2D = window.GetDefaultState();
sf::State stateFor3D = stateFor2D;
stateFor3D.SetWireframe( true ); // Not that wireframe is useful in 2D rendering but the only value that came to mind right now.
// Set some more values for our 3D view.

window.SetState( stateFor3D );
// Render 3D
window.SetState( stateFor2D );
// Render 2D
window.Display();


NOTE: After thinking about it, this ain't needed just need to force ALL values in SaveGLStates to be values that SFML drawables expect and then reverse it in RestoreGLStates. Though I feel this approach would be nicer actually.

I don't know if I'm missing some vital point here or something? Just me getting annoyed that I have to try-and-error my way trough to get it working.

Also having another problem that might be related to this but not sure quite yet so I'm holding it off for the time being.

37
General / Getting Ruby-Opengl to work
« on: May 18, 2011, 11:46:48 pm »
I don't know how many out there that uses the binding but I've had some activity at least. So I hope there is someone that can answer me on how to get ruby-opengl working with Ruby 1.9.2-p180 RubyInstaller on Windows. I haven't even gotten past including the damn library.

Would like to know if it works together with rbSFML or not. Don't have an active Linux installation at the moment but it should be easier to get up and working there if someone would go to the trouble of trying that out. Might as well if you want post a test script that I can include in the repo under './testing/' so people can verify that they have a properly working installation.

38
Graphics / Can't draw a sf::Text when having culling enabled.
« on: May 10, 2011, 12:57:45 am »
Well I think it was working before so might be something else being wrong but here's what I've narrowed it down to.

While I was struggling with loading in an OBJ file I noticed that my FPS counter wasn't showing anymore, tried to boil it down to that wrong context was on( since the window is created in main and passed to another thread ) but no that was not the problem. Then I just thought... What if the vertexes are written wrong? So I removed these lines:

Code: [Select]

glEnable( GL_CULL_FACE );
glCullFace( GL_BACK );


And my test was able to display my sf::Text, sf::Sprite AND my own model. Though the question is, why did the culling go over to the sprites? Am I doing something wrong? I am using PreserveStates.

Code: [Select]
if( myShowFPS == true )
{
myContext.Prepare2DView(); // <- Simply wraps SFML
sf::Text fps( ConvertToString< float >( 1 / delta ) );
fps.SetPosition( 1, 1 );
myContext.Render( fps );
myContext.Prepare3DView(); // <- Simply wraps SFML
}




How it looks when rendered correctly. When it was incorrect both the sprite and the text disappeared. Nevermind the low FPS, I get some spikes then and then when it drops(usually lies around 700-1000 for this), probably my threading that needs a look at.

39
Window / [SOLVED]I've screwed up my depth buffer :S
« on: May 04, 2011, 10:51:31 pm »
Ah well I somehow screwed up my depth buffer somehow and I don't know how I did it and even worse, how to reverse it. What the problem is that I can't have any value outside the range 1 to -1 if I want it to show. If z goes outside that range the vertexes won't be rendered.

Here's my test code:
Code: [Select]

// aRenderer just wraps gl* commands.
aRenderer.PushModelView();
aRenderer.LoadModelView();
aRenderer.Translate( 0, 0, -2 ); // Won't show anything!
aRenderer.StartPrimitive( Graphics::Renderer::QuadPrimitive );
aRenderer.AddVertex( 0, 0, 0 );
aRenderer.AddVertex( 1, 0, 0 );
aRenderer.AddVertex( 1, 1, 0 );
aRenderer.AddVertex( 0, 1, 0 );
aRenderer.EndPrimitive();
aRenderer.PopModelView();

Also tried without pushing the matrix, still same effect.

My Init function:
Code: [Select]
// Setup some basic opengl.
glClearColor( 0.f, 0.f, 0.f, 0.f );

glEnable( GL_DEPTH_TEST );
glDepthFunc( GL_LEQUAL );
glDepthMask( GL_TRUE );
glClearDepth( 1.f );

//glCullFace( GL_BACK );

float width = static_cast< float >( myContext->GetWidth() );
float height = static_cast< float >( myContext->GetHeight() );

glMatrixMode( GL_PROJECTION );
glLoadIdentity();
gluPerspective( 90, width/height , 1, 500 );

40
System / For newcomers to Parallel Computing/Threading
« on: April 12, 2011, 11:09:47 am »
Hi!

I've seen pretty many people in this forum having no clue about threading. So I came up with a great idea for you guys to start out somewhere simple before entering the real madness. I am going to share with you, my own homework! Instead of trying to separate your game into different threads try creating this first so you can experience what can go wrong and how to correct it in a more "controlled environment".

Your new homework is to implement 5 sorting algorithms, and have each algorithm run in their own thread and display this visually using SFML. This task requires you to synchronize threads( rendering thread <- algorithm threads ) which is where most people seem to have trouble.

http://www.youtube.com/watch?v=VI45Y_4hGEs

Try to do what I did and you should have a fair understanding of how threading works and how to implement it in a nice way. I'll of course be here to help you out if you get into trouble.

I highly recommend newcomers to try this first. If I find anyone asking again for directions I'll refer back to this post.

@Laurent: Hope you don't mind me putting this here ^^

41
SFML wiki / Conversion from the C++ Lightmanager to Ruby
« on: April 09, 2011, 04:02:14 pm »
Aight I've done a working conversion of the light manager in the french wiki here: http://www.sfml-dev.org/wiki/fr/sources/lightmanager (Thx to google translation)

It can be found here: https://github.com/SFML/SFML/wiki/Ruby-Light-Manager

Also note that I do not require or load rbSFML in the file at all, I expect that you do this somewhere else in your application( I just realized I forgot to load the library after I uploaded it ).

Side Note: While doing this I found 4 bugs in rbSFML ^^

42
General / Getting a hold of the rotation from the 3x3 section of a 4x4
« on: April 03, 2011, 03:40:59 am »
Aight so I am working on a SFML-inspired wrapper for SFML :P Kind of like adding a sf::Renderer class that supports 3D coordinates (Opposed to do direct OpenGL calls in sf::Drawable::Render).

Anyway to my problem. I am implementing right now a class that would be a 3D version of sf::Drawable that I call Graphics::Object that has a 4x4 matrix where the 3x3 section contains the 3D rotation which is calculated like this:


Stolen from Wikipedia :)

What I want is convert the 3x3 section of the matrix to a vector with dimension 3. Currently my API looks like this:
Code: [Select]
void SetRotation( const Vector3f aRotation );
void SetRotation( const float anX, const float anY, const float anZ );
Matrix33f GetRotation() const;


But I want it to look like this:
Code: [Select]
void SetRotation( const Vector3f aRotation );
void SetRotation( const float anX, const float anY, const float anZ );
Vector3f GetRotation() const;

Notice the change in the return value type of GetRotation()

So is there any magical mathematician here that knows how to do that? :D
I myself have problem with math. But well I have the standard mathematical vector and matrix operations implemented and working.

Would it be easy enough to just have a Zero-vector and multiply it with the matrix?
Code: [Select]
return Vector3f::Zero * myMatrix.Get33();
EDIT: Well after some thought... that would just give me another zero vector wouldn't it?

What I want the returned vector to represent is the amount of rotation for each axis.

43
General / Process forking for rbSFML?
« on: February 06, 2011, 04:08:20 am »
Well since Ruby's native threading isn't perfect. I got to thinking, if something like Distributed Ruby can share objects over the network, why wouldn't I be able to do something over several processes?

It's way in the future for me to get time to do something major like this. Who knows maybe someone beats me to it. But was interested in hearing peoples thoughts on this. Also Laurent if you like the idea and if I should include it directly into the bindings to compensate real native threading, or if I should keep it separated from the bindings.

For you Laurent that isn't familiar with Ruby. Previously ruby(1.8.x) had green threads so they were managed internally by the VM. But in the latest ruby(1.9.x) they have switched to native threads, BUT there's a GIL(Global interpreter lock) in place which enforces only 1 thread to be running ruby code(though any extensions to ruby using threads can still run). So more or less, if you create a thread in Ruby you do get parallelism, but not the benefits of it. That's what I want to try and achieve.

Anyway my idea is something like:
Code: [Select]

thread = SFML::Thread.new do |thread|
  # This is run in another process, so it isn't really a thread.
  thread[:var] = 5
  thread[:obj] = Object.new
  while thread.continue?
    thread[:var] += 1
    thread.yield # When yielding, the process will look if it got any pending messages.
  end
end

puts thread[:var] # Send a message to the thread that we would like to look at :var
puts thread[:obj].to_s # Any method calls to objects also will go trough inter-process messaging.
object = thread[:obj] # Actually only returning a virtual object wrapping any calls on to the process.


The only problem with this that I can't get around is that there will be A LOT of blocking between the processes. Every time we want data from the "thread" the parent will have to wait for the child to yield and any pending messages processed. Then again, if you need to exchange a lot of data between threads, then things aren't really paralleling.

Also worth noting, this is already more or less supported. You can use distributed ruby, but then all "messaging" will go trough the network in order to reach your process.

44
SFML wiki / Ruby resource manager!
« on: February 05, 2011, 05:08:56 pm »
Well there were so many resource managers for C++ so I decided to make one for Ruby too ^^

http://www.sfml-dev.org/wiki/en/sources/ruby_resource_manager

I'll soon add my animation class too as soon as I have it fully tested.

45
Feature requests / Non-drawable Shape
« on: January 18, 2011, 11:21:50 am »
Yo!

We're going trough 3D math(don't know how to translate it from Swedish so let's just call it that) at school right now and I realized that you are missing a Shape class that are not for being drawn but for checking intersections.

Kinda like the Rect class but by using a normal vector(Again, I think that's the correct translation) on each line we can check if a point is inside the shape and so on.

This is more or less a simple utility that for most of the time will be used for collision detection for more complex shapes. If you feel that you don't got time for that I could just make it myself and add it to the Wiki and then you can add it to SFML2 if you feel it fits ^^

Pages: 1 2 [3] 4 5
anything