Menu

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.

Show posts Menu

Messages - Javed Ahmadzai

#1
Thanks for your views, I know it is very hard to build V8 and embed node.js and it never was my intention, I am talking about the light weight server node add-on which one would use like this.

Usage:


npm install vcmp
const vcmp = require('vcmp');
const npmModules = require('any npm module'); // user is free to use any npm module


vcmp.createServer(config => {
     .........
});

// events
vcmp.onStart = () => {};
vcmp.onPlayerSpawn = () => {};


run the server


node server.js

The vcmp server is provided as npm package everyone can download and use it just like a normal npm package, it does't contain v8 or node itself but the bindings and vcmp server implementation in c++, it also is ABI stable it will work on all version of node.js one does't have to worry about node or v8 version that is the main advantage of napi addons.  napi addons are easy to use easy to maintain both c and c++ versions are available.
Very light-weight since the server is just a node add-on written in c/c++ and used via node javascript, no additional setup for user he just needs to install node I think almost everyone has it, there is no need to provide sqlite or other database driver they can use anything of their choice since he can use other thousands of modules in npm package repository. It might also work on web servers that have nodejs installed so servers might be hosted on web servers.

Here is an example of both c and c++ version of node add-on


Anyways since I just presented an idea and since there is no open source material to implement own version of vcmp server, I would not mind closing the thread.


Thanks for your informative replies.
#2
I don't know anything about this. Stormeus why did't you aim to write VCMP Server in Node.JS it would have been a lot easier and quicker since you did't have to write hashing or sqlite modules. everything would have been provided out of the box by Node by writing VCMP Server as an add-on to Node developers would also had the advantage of Node's event loop since it is Non-blocking I/O.


Is there any VCMP documentation or repository about VCMP Server, API's and Stuff?
#3
That would be great to embed Node.js in VCMP server but you are right there is no proper documentation for that, Currently the aim is NAPI addon for Node but it would need some type of inter process communication or I don't know how the communication to VCMP server and Node.JS app will be done.


This post is good but still can't figure how they did it https://electronjs.org/blog/electron-internals-using-node-as-a-library
#4
I'm trying to write a small Node.js NAPI add-on for VCMP but I am confused how will it work with VCMP's module SDK.


I have seen the "vcmp-java-plugin" which embeds JVM and binds VCMP events to Java methods (Level 1 abstraction) and another plugin "vcmp-javascript-plugin" which is written on the top of vcmp-java-plugin that embeds JavaScript v8 engine in Java and binds JavaScript functions to java methods (Level 2 abstraction).


I very much like the "vcmp-java-plugin" since we can use Java freely and have the full advantage of the language, similarly if we could embed node in c/c++, interfaced with module SDK we might have the power of Node.js. It will also make the server development easier since many developers already know JavaScript.


There are some approaches to solve the problem.
We can write NAPI add-on for Node.js, it is nothing but c/c++ binding to Node.js, now the point is when we write Node.js add-on we have to run JavaScript code first for example: "node server.js" in terminal, it will start a Node.js script/process in a shell, but we want to run VCMP and handle the logic in Node.js, we could embed v8 engine and provide it as a dll plugin for VCMP server but that would't be effective since we cannot use the power of Node.js.

If anyone has a better idea or how to embed Node.js or use Node.js as an environment for VCMP servers please leave a clue then.

P.S: This is purely for learning purpose

#5
There is no proper documentation on how to use the Plugin SDK.


I have downloaded the blank server, where can I download the Plugin SDK from, the vcmp-plugin-header repository is bunch of c++ files, can someone please guide me on how to write a hello world server with c++
#6
Is there any way to create a vcmp server in other programming languages such as Java, C/C++, currently I think the possibilities are Squirrel and Pawn, but is there any server event binding available for other languages?
#7
function onVehicleRespawn( vehicle ) {
vehicle.Respawn( );
vehicle.RespawnTimer = 6000;
}

MS = Mili Seconds
#8
This is nice, Clan! Keep adding VC-MP Legends.