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.


Messages - Strikerklm96

Pages: [1] 2 3 ... 5
1
SFML projects / Ray Tracer
« on: April 14, 2016, 07:45:15 pm »
For a class project I had to build a ray tracer from scratch, but we were allowed to use any program we wanted to display and manage things like color etc. So I use sfml to display and save the images, as well as sf::Color. I obviously had to make my own Vector and Geometry classes though.

It (can) use an Octree to speed up the ray tracing, but it only starts to pay off above a few hundred objects in the scene.

Features:
Octree
Soft and Hard Shadows
Antialiasing
Multijittering
Directional, Point, and Area Lights
Potentially Unlimited reflection recursion.
Any object can have varying levels of Reflection, Diffuse Shading, Specular Reflection, Object Color
Mesh Loading
Spheres
Triangles
Parallelograms
Infinite Planes
Camera (moves, pitches, yaws, rolls)

The camera actually moves all the objects in the scene by the inverse transformation.

I'll post the code when the class ends (to prevent other students from finding my code and potentially copying and getting me in trouble). In the mean time, here are some of the best images.

Click to enlarge:
1000x1000; 4 sample Multi-jitter; Unlimited reflective recursion; Area light with 36 samples (6x6); Various Diffuse,Specular,Reflective values for the spheres and planar floor. Took 4 minutes to render.


1601 Spheres.

A purple cow.

Purple Teapot.

2
General discussions / Re: AW: sf::Rect variable names
« on: April 14, 2016, 07:17:43 pm »
I don't understand what caused you problems. Can you elaborate?

Sorry, I never really stated the problem  :P
A constructor of sf::Rect takes (left, top, width, height), and that's how they are stored too.
So if you want a 2x2 square surrounding (0,0), you would just do (-1,1,2,2) right? Wrong (maybe).
The left and top in a standard coordinate system with a positive width and height would be minX (left) and maxY(top), but sf::Rect took into consideration that most users would be using window coordinates where Y is negative. So (left,top) isn't actually the top left coordinate in the standard coordinate system, it's the bottom left. This through me for a loop when trying to use the class in a standard coordinate system (for it's various other functions of intersecting and contains).

"minX" and "minY" are wrong, since the width and height may be negative. Obviously, the same reasoning applies to "left" and "top".
Lol, you got me, that is totally valid.

Personally, I would even migrate from 4 scalar coordinates to 2 vectors. It makes so many things simpler and enables higher-level reasoning. Vectors are ubiquituous in SFML, yet sf::Rect is one of the few places that doesn't play well with them. Maybe also the negative size topic is worth reconsideration.
What is the point of negative dimensions other than making it go the other direction?
2 Vectors makes a lot of sense to me and was how I would think of it, even if they get stored as 4 seperate items in the class, the interface for a rectangle would make perfect sense in Vectors. Would you want to store two vectors like (minX,minY and maxX,maxY) or (position, dimensions)?

3
General discussions / sf::Rect variable names
« on: April 13, 2016, 10:23:39 pm »
I understand why sf::Rect uses left and top as variables, but this causes, as I just experienced, significant confusion. I wanted to use it in a standard coordinate system, and that caused strange bugs as you can imagine.
What the class actually wants is minX and minY. And what coordinate system you are in shouldn't change how you think about a class. For example, even though the vector class is in sf::namespace, and intended for the screen coordinate system, the Vector class doesn't ask for down and right instead of x and y.

Edit to clarify the problem:
A constructor of sf::Rect takes (left, top, width, height), and that's how they are stored too.
So if you want a 2x2 square surrounding (0,0), you would just do (-1,1,2,2) right? Wrong (maybe).
The left and top in a standard coordinate system with a positive width and height would be minX (left) and maxY(top), but sf::Rect took into consideration that most users would be using window coordinates where Y is negative. So (left,top) isn't actually the top left coordinate in the standard coordinate system, it's the bottom left. This through me for a loop when trying to use the class in a standard coordinate system (for it's various other functions of intersecting and contains).

4
SFML projects / Stellar Reaction: Space Combat MOBA
« on: February 05, 2016, 08:36:38 pm »
I have been working on and off this project for over a year, and am now a Senior in Computer Science. I have to work on a nine person team on some project, and got mine approved! Here is a video of the current state of the project. Over the next few months, me and the team will work on this hopefully to completion.

I had to record this video in a hurry and wasn't able to find someone to play with in time. There will be another video showing multiplayer in the future.

Features so far:
Fully functional multiplayer and chat.
Customizable ship.
Money and capture points.
Ship destruction.
Module stats are controlled by json blueprints.
When modules are destroyed, they stop functioning.
Art by a friend.

In addition to SFML:
TGUI
Box2D
jsoncpp

Screenshots:

5
SFML projects / Re: Let There Be Light 2
« on: November 14, 2015, 08:27:43 pm »
For some reason this code:

        vector<sf::Vector2f> points;
        points.push_back(sf::Vector2f(0, 0));
        points.push_back(sf::Vector2f(0, 100));
        points.push_back(sf::Vector2f(100, 100));
        points.push_back(sf::Vector2f(100, 0));

        std::shared_ptr<ltbl::LightShape> lightShape = std::make_shared<ltbl::LightShape>();
        lightShape->_shape.setPointCount(points.size());
        for(int j = 0; j < points.size(); j++)
                lightShape->_shape.setPoint(j, (points[j]));
        lightShape->_shape.setPosition(Simple2D::b2ToSf(Vec2(3,3)));

        ls.addShape(lightShape);
produces a backwards occluder. I tried defining them CCW also. 

Edit: I just realized, is this the intended functionality? How could I just make a line segment that blocks light?

6
SFML projects / Re:creation - a top down action rpg about undeads
« on: September 17, 2015, 05:57:51 am »
This game looks awesome :) and as a novice programmer, I had some questions.

How do you make components interact? When a player damages another, what code and functions does that flow through?

For your lua, how does this get translated to an actual c++ instance of a GraphicsComponent?
Do you have to go through and set each value for the instance of GraphicsComponent to each value in the lua?
Like:
GraphicsComponent gc;
gc.filename = lua("GraphicsComponent.filename");
  GraphicsComponent = {
        filename = "res/images/chest.png",
        animated = true,
        defaultAnimation = "closed",
        z = 0,
        animations = {
            closed = {
                frame = {0, 0, 16, 16},
                numOfFrames = 1,
                frameTime = 0,
                looped = false
            },
            opened = {
                frame = {16, 0, 16, 16},
                numOfFrames = 1,
                frameTime = 0,
                looped = false              
            }
        }
    },


Or is there some way to get it to auto assign the values?

7
Audio / Re: Many sounds for a game.
« on: February 28, 2015, 06:36:35 pm »
Yes, and that's exactly what I was doing, thanks for clearing that up though! I was using the terms Single-instance and Singleton interchangeably when I shouldn't have.

8
Audio / Re: Many sounds for a game.
« on: February 22, 2015, 05:49:50 pm »
Ok, and to clarify, it may not technically be a singleton, because you can instantiate multiple. It's just that every world that get's created only has 1, and my game would never create more than 1 world, so there will only ever be 1 or 0. This is essentially what i'm doing:
http://gameprogrammingpatterns.com/singleton.html
ctrl-f: Get it from something already global

search that text to see what I have been doing (and was planning on doing)

9
Audio / Re: Many sounds for a game.
« on: February 22, 2015, 05:38:01 pm »
Sorry, but I don't think I fully understand. Put a bunch of sound instances somewhere and sprinkle them around to the objects that need them?

10
Audio / Re: Many sounds for a game.
« on: February 22, 2015, 04:28:09 pm »
Ok, that is a pattern I need to stop using, but how else should I do it?

11
Audio / Many sounds for a game.
« on: February 22, 2015, 02:15:24 am »
I see that the max number of sounds is 256, but in the game i'm making, there are more than 256 things that can make noise. So i'm wondering if my solution would be a good approach:

Have a singleton class that holds around 20-30 sound instances, and also holds all sound buffers for the game.
When an object wants to make noise, that object calls a function on this class with the requested sound name, like Singleton.noise("Explosion1", myPosition). Then the singleton selects a sound instance not being used, sets it's buffer to the explosion1 buffer, and plays the sound at that location.

I don't see anything wrong with my approach, but I don't want to write this just to have it fail because I didn't realize something about the way sfml does things. So thank you for your input  :)

12
Network / Networked vs Local
« on: January 28, 2015, 03:12:24 am »
I am testing a game locally on my computer, by running two-three instances at once and telling them to connect to 127.0.0.1 with the appropriate port, and the game works perfectly. But if I connect over a network, in several instances I have gotten strange behavior, mainly having to do with receiving a packet with random garbage in it (or at least it is not in the format it should be, and gives values that should never have been sent through a packet, such as negative numbers when they are always supposed to be positive, or just too big). This usually results in the client program crashing, but in at least one instance it just received a tiny bit of garbage and carried on. Other than latency, what are the differences between locally connecting vs two computers over a VPN or LAN? Any hints as to what the source of the problem could be?

13
Network / Re: Sending enum through a packet
« on: January 24, 2015, 04:22:05 pm »
I thought I read somewhere that enums aren't necessarily always the same type, which made me worried that they might not cast to the same value. I was having a few problems and just wanted to eliminate that as a possibility. I think I found my actual problem though.

And I thought the following question didn't deserve a new thread: It makes sense use both UDP and TCP in the same program right? I want TCP for data that can't get lost or duplicated ect. Do I need to bind each socket to different ports so my program actually uses two ports?

14
Network / Sending enum through a packet
« on: January 24, 2015, 07:58:07 am »
Is it safe to do this?
Packet packet;
packet << static_cast<int32_t>(Protocol::Control);//Protocol is an enum class
send(packet);
I am trying to send different types of commands through the network, and i'm not sure if this is reliable.

15
Network / Making Sure Special Command Arrived
« on: January 22, 2015, 07:12:33 pm »
In my game, when the Host hits "Launch", it sends data in a udp packet to each of the clients to let them know what level to load, and what entity they are in control of. How can I make sure they received it? Could I just send it several times? Is this where I would want to use TCP? Will packets ever be completely lost, or just delayed/out of order?

Pages: [1] 2 3 ... 5
anything