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 - StevenC

Pages: 1 2 [3]
31
SFML projects / Re: SFML2 V8 JavaScript Binding
« on: June 17, 2012, 04:06:25 am »
Rogof,

Your changes have been applied. The latest version adds spaces to prevent the <:: issue. I was a little concerned about some of the warnings related to the casting function overloads... Hopefully they were caused by the spacing issue, but I am not certain.

I have setup a wiki on the github page. I will try and make a few entries with every major version release.

-Steven

32
SFML projects / Re: SFML2 V8 JavaScript Binding
« on: June 16, 2012, 06:04:39 am »
Hello Rogof,

First, before I comment on your feedback, I want to thank you for taking the time to give feedback.

Regarding node.js:

My position on node.js is that it is a great platform which I know very little about and have absolutely no free time with which to learn more of. From what little I currently know, my objectives put my implementation at odds with some of the design goals of node.js. The biggest difference is that node.js emphasizes asynchronous JavaScript. My design is adherence to the SFML API design and not to make it asynchronous. So if I brush off any comments about doing things along the lines of  node.js it is simply because I cannot resolve my own design goals with my understanding of node.js's design goals. Because I can't find a common ground, I disregard it completely.

Still, I am open to compatibility with the node.js code base. If there is anything that I've done with the C++ side of the wrapper that makes it incompatible with node.js I would love to know how to improve it (within the design goals that I have already set forth.) Changing the C++ wrapper code to make it more node.js friendly is not against my design goals. AFAIK though all one needs to do is write an NPM module include the wrapper code. Not really my thing, someone else can do it.. its probably a dozen lines of code.

Regarding formal documentation:

The purpose of the wrapper is to implement such a complete implementation of SFML that documentation is largely unnecessary. Some conversions need to made. For example, JavaScript has no concept of namespace or classes so both are implemented as JavaScript objects. Ideally the 'sf' namespace should be implemented as the 'sf' object and if one does that then one need only convert the C++ syntax to the appropriate JavaScript syntax. There are probably a few exceptions to do this, but for the most part everything works as expected.

var myobj = new sf.RenderWindow(...);

is equivalent to:

sf::RenderWindow *myobj = new sf::RenderWindow(...);

Any place where the C++ and JavaScript don't match up 100% is either a defect in the wrapper or a limitation that I will need to add a workaround for.

You wrote "show how to interact between JavaScript and C++." That is a good idea. I definitely hope to add some examples showing how to do clever things with the wrapper code if the project gains enough traction and people are asking for it. One thing I ask you to consider though, calling C++ from JavaScript or vice versa is not really specific to my project. My project only makes it possible to use SFML within JavaScript, nothing more or less so most documentation that I will write will focus on differences between the SFML C++ and JavaScript syntax.

That said, if you need help with C++/V8 just let me know. I am happy to help, but I am a still a complete noob with both so don't be surprised if I have no clue. :) Maybe in a few months this will have changed.

Regarding linux and mingw:

I wish I had the patience to try and compile V8 in MingW. I was thinking about trying it last night, though after a few Google searches I decided it was a waste of time. SFML would compile easily, but the V8 dev team doesn't seem interested in supporting MingW out of the box. GYP is alien to me and I refuse to learn python (hence why I made this project). So, I will probably never bother with mingw even though I would love to have it working. Contributions and suggestions enabling support for mingw compilation are welcome.

Linux is a big priority for me. Although I am a windows guy, I really love the idea of giving users the freedom to choose their OS so Linux is a must-have. I haven't had time to setup the tool chain yet. Last I tried. I ran into a snag with getting SFML v2.0 RC1 to link. Laurent linked it against versions of libraries that I could not find releases for in my Ubuntu VM... More libs to compile I guess. I am sure in a few weeks I will have some time to set it all up.

The main issues I am anticipating with Linux have to do with the overloaded casting operators. It is entirely possible though that it would actually compile, the code is massive but not very complex.

Regarding help with the Linux port:

Your assistance is appreciated and welcome. If you attach a list of any compiler errors or warnings you get, I address them ASAP (assuming I know what is wrong). Changes can be safely made to v8wrap.h/.cpp too if you want to contribute modifications using GitHub I would definitely accept the assistance. (Avoid changing the wrapper itself since those changes made will not be compatible with future versions.)

Thank you,
-Steven

33
SFML projects / Passing parameters in a JavaScript object
« on: June 14, 2012, 11:15:52 am »
Version 0.4 adds support for passing parameters in a JavaScript object. For example, one could construct a vector like:

var vec = new sf.Vector2f( { y: 100, x: 50 } );

This could be used in other ways too. For example, if you already have a JS object in your code that has an x and y variable you could pass that object to construct a Vector, as any additional object properties would be ignored.

Like:

var PlayerActor = { x: 1, y: 1, name: 'Bob', otherstuff: { ... } };

var vec = new sf.Vector2f(PlayerActor);

The names of the parameters are the same as those found in the SFML 2.0 documentation except that they are always lowercase.

34
SFML projects / Re: Endaeva - A Universe-Sandbox RPG!
« on: June 11, 2012, 10:47:26 pm »
Thanks.  My motivation has been hit pretty hard since I released and attempted funding.  I think I'm bad at going public with work, or something...it's frustrating.  I know people would enjoy what I'm making if I could just properly convey it.

Hello Tom,

Don't get discouraged. I think you have great potential as a game designer and can't wait to see your completed game. Even if you don't succeed in getting the project funded this time around, you can always try again in the future.

I'd also be willing to help with the project.

-Steven

35
SFML projects / Re: SFML2 V8 JavaScript Binding
« on: June 08, 2012, 07:33:31 pm »
so how should I look at this? you have a C++ project with V8 JS as a sandboxed scripting environment? or would one be running the V8 JS VM and all code would be in JS?

Either way. For my project I am writing everything in JS. It is possible to register only certain classes in the V8 engine, although its intended use is to expose everything SFML has to offer.

You could probably do half and half where maybe your core engine is written in C++ and you draw the UI using JavaScript or you could also make it so your application supports event handlers written in JavaScript.

I am open to suggestions on how to improve it. Some things I am considering or working on for future versions:

1. Make it modular to match how SFML is already divided up.
2. Expose C++ operators as methods in JavaScript.
3. Add a copy method to clone an object from within JavaScript (Copy constructors are not supported in the current implementation.)
4. Allow parameters to be passed using a Javascript object, i.e. sprite.setPosition({x: 100, y: 50}).

The time frame for these improvements depend on what other people request. Otherwise I will implement the features as I run into problems on my project.

In a couple weeks (or months) I will release my project as open source so there will be an example of a JS game engine written in JavaScript using SFML.

-Steven

36
SFML projects / Re: Before the Reign
« on: June 07, 2012, 01:34:09 am »
One more thing, which version did you test? Version v1.1.0, or the indev version which is included at the top of the OP?
Hello Jake,

I tested the indev version. I managed to get it to run once, and after that I went looking into the source code for v1.1.0. I didn't try compiling it though to see if the issues in the indev were present in the v1.1.0. I assumed they were fairly close, but it sounds like you may already be in the process of rewriting it.

-Steven


37
SFML projects / Re: Before the Reign
« on: June 06, 2012, 05:14:54 am »
Hello. I checked out the game and I saw you had a fair bit of code there. I wasn't sure if you were looking for feedback, but I thought I might make a few suggestions.

I think going forward your main obstacle for expanding the program is going to be the fact that a fair bit of the coding is specific to the game's quest. That is, your code cannot be easily reused for a different game that features similar content without rewriting code.

My suggestion would be to consider how you might turn parts of your prototype into reusable modules and to separate game details into data files. It may not be easy, but one thing you will find as you spend more time writing software is that productivity and modular code tend to go hand in hand.  Although it may take a little bit more time to design something to be reusable, it will save you tons of time later on.

You should also replace the switch statements used to produce "number" strings with formatted strings either using sprintf style or stl stringstream style. Another option might be although less efficient to use std::string and to_string like:

string mymessage = string("You did ") + to_string(DamageAmount) + string(" damage!");

This is not the most efficient way of doing this, but I sometimes use less efficient methods that produce easier to read (and maintain) code in situations where performance and efficiency are irrelevant.

Finally, the game crashed 90% of the times I tried to run it. I checked code and found this:

class Game_city : public cScreen
{
private:
    int movement_step;
    int posx;
    int posy;
    sf::Sprite Sprite;
...
};

Game_city::Game_city()
{}

And noticed that you failed to initialize non-class values in the constructor. Although the assumption might be that movement_step, posx, and posy are initialized to zero, in reality their initial value is undefined.

To prevent random unexplained crashes all of you constructors should initialize all non-class fields to zero or another safe value. For example:

Game_city::Game_city()
{
    movement_step = 0;
    posx = 0;
    posy = 0;
}

or

Game_city::Game_city() : posx(0), posy(0), movement_step(0)
{
}

If you don't assign values, the initial values may be zero, or it may be something random.

-Steven


38
SFML projects / Re: Endaeva - A Universe-Sandbox RPG!
« on: June 03, 2012, 12:05:36 am »
Ever since playing Daggerfall, I've always enjoyed the idea of playing a game with massive amounts of content. Although the game play isn't my usual preference, it definitely has my attention.

How do you intend to handle death/saving/loading etc?

Also, do the worlds just represent "backdrops" for the various "stages" or are there interesting things to explore in each world? They look like console RPG maps, but why would one want to dig through to the other side of a planet?


39
SFML projects / Examples of SFML 2.0 in JavaScript
« on: May 28, 2012, 10:16:13 pm »
Accessing a static class method:

var modes = sf.VideoMode.getFullscreenModes(); // Returns an Array of VideoMode objects.

Creating new objects:

var vm = new sf.VideoMode(1024, 768);
var window = new sf.RenderWindow(vm, 'Hello World');

Accessing enumeration constants:

if ( ev.key.code = sf.Keyboard.G ) { // User pressed the letter 'G'
   // do something
}

Essentially you should be able to turn C++ code into JavaScript code fairly easily with just a few syntax changes.

40
SFML projects / SFML2 V8 JavaScript Binding
« on: May 28, 2012, 12:27:09 am »
Greetings,

I am new to SFML and am going to be using the library in a project powered by the V8 JavaScript engine. I wanted to share with the community my V8 Binding for SFML 2.0.

If you identify any major issues with the binding please let me know. You can post your issues to this thread and I will attempt to address them if they are within the scope of the project. I will release new versions as needed to address the issues reported.

Before using the binding in a project you may want to consider looking at the ISSUES.TXT file. If that doesn't scare you off then go for it. So far though, everything appears stable. The binding works on Linux and Windows.

---- Update ----

I have updated the binding to version 0.5. Version 0.5 adds some important features such as the ability to copy and delete objects. Also, the JavaScript instanceof operator now works with the classes so one can distinguish between an sf.Image and an sf.Texture without testing for specific methods.

v0.5.1. The binding project now includes a sf_v8.js file. This JavaScript file contains definitions for context sensitive help for Eclipse. You will need to "link the file" to your Eclipse JavaScript project and then Eclipse will give you tool tips when using SFML JavaScript objects. This should make it 1000 times easier to write SFML code in JavaScript. Note: Full descriptions of methods and variables are still only available using the C++ documentation.

Updated to version 0.6.0 - The binding is now in the beta stage. It is stable and supports type-checking for classes to prevent crashes. I've tested it quite a bit internally and feel it is probably good enough for production use. It does need more testing though before I am ready to say that it is finished.

The binding is available for download on GitHub:

https://github.com/StevenChristy/SFML2-V8-Binding

Pages: 1 2 [3]
anything