I'm looking for something like Twisted in Python (event-driven networking engine). I've found Boost:Asio but it is hard for me. So I need something much easier (without low level programming).
I'd recommend to start with Asio from implementing and changing the examples.
Boost.Asio is the-state-of-the-art today and one of the easiest way to start asynchronous/event-driven networking programming with C++.
So give Boost.Asio 2nd chance as it is one of the best tools around.
Related
all.
We are game development company and we develop casual games for PC/MAC/iOS/Android with our own engine written in C++ (90-100%) and we are happy with it!
Now we want to target XNA/WP7 and flash.
What is the best way for doing this ?
Of course we will have to rewrite some low-level stuff like sprite rendering/timing/audio support, but we want to put as less efforts as possible in porting game code itself.
A. We do not want to rewrite game code two time more
B. Ideally even one time more :)
For flash we are going to use Haxe together with this library.
It would be awesome to have C# target support in Haxe. It has been announced but never released and I think it will not be released in nearest future. But I think it will be released in 1-2 years. So in porting different engine components to Haxe is potentially great investment.
Until then we have to decide how to meet A and B.
Possible variants for dealing with it:
Using mokey. However languaged seems to be so primitive and so different from C++/AS3/C#/etc what we decided not to use it.
First of all develop XNA port with the help of brains and C++ to C# converter. Then use C# to Haxe converter. This approach seems to be the best one at this moment, but I have no idea about how much time convertors will save compared to straightforward code rewrite. However, I think they will help.
It is also possbile to use Adobe Alchemy for flash support. However we will have to develop new architecture to separate render/audio and logic into different languages and we want to avoid this - it seems to be more complex than code porting.
So what do you think about 1-3 and do you know better options to achieve A and B ?
Maybe other meta languages/approaches/technologies ?
Thanks a lot!
This is your absolute best/ideal solution:
http://www.mandreel.com/?page_id=48
http://www.leebrimelow.com/?p=2593
Basically it's a framework/compiler that will compile c/cpp/objc to iOS, Android, Flash, WP7, and much more.
I'm searching for a library / framework / codesnippet that helps me build a really simple server / client. Both should be portable (linux/win/mac).
A picture says more then a thousand words so:
The server should be able to seperate diffrent clients.
What I'm looking for is only a hint on how to do the transfere. I've little experience with languages other then c++, and it was mostly plain easy to create a server that stores all the clients connected in an array and interacts with each one of them once you got pointed in the right direction.
What I looked into for C++ was RakNet and Boost.Asio.
I don't want to use RakNet because I might sell the application at some point (you never know) and Boost.Asio seems way to complex for me to understand and way to low-level. All I really need is a simple send/recieve functionallity.
The json will be handled by me (I already looked into jsoncpp). One message will have a maximum length of 2048 bytes.
Any suggestions / hints / help on what to look into / what to use?
I'm really looking for something easy and not so much low-level to use as I don't need the low-level functionallity.
Thanks in advance,
Robin.
Have you done Network programming before? Its pretty straight forward in C. And what you want can be implemented in a few hours. I used this manual below to finish my assignments back when i was a student.
http://shoe.bocks.com/net/
Just read this and you are good to go. Its really not very hard.
Good Luck!
I enjoyed Beej's guide to network programming.
As cross-platform and easy-to-use are both requirements I would recommend Qt. It's pretty easy, reliable and cross-platform.
http://qt.nokia.com/products/developer-tools/
It comes with lots of samples including 13 networking samples (take a look at the threaded server tutorial which I believe it's just what you're after).
I am currently looking for a discrete event simulator written for C++. I did not find much on the web written specifically in OO-style; there are some, but outdated. Some others, such as Opnet, Omnet and ns3 are way too complicated for what I need to do. And besides, I need to simulate agent-based algorithms capable of simulating systems of thousands of nodes.
Does anybody know anything suitable for my needs?
Others have good direct answers, but I'm going to suggest an alternative. If I understand you right, you want a system in C++ or such where you can post events that fire in the future, and code is run when those events fire.
I had a project to do like this, and I started out trying to write such an event system in C++ and then quickly realized I had a better solution.
Have you considered writing your program in behavioral Verilog? That may seem strange to write software in a hardware description language, but a Verilog simulator is an event-based system underneath, and behavioral Verilog is a very convenient way to express events, timing, triggers, etc. There is a free Verilog simulator (which is what I used) called Icarus Verilog. If you're not using Ubuntu or some Linux distro with Icarus already in a package, building from source is straightforward.
I would recommend having a second look to OmNet++. At first sight it may look quite complex, but if you look it into more detail you will find that most of the complexity is in the network add-on (the INET Framework). Unless you are going to do a detailed network simulation you do not need the INET.
Using OmNet++ core is not specially difficult and it may be simpler than other similar tools.
You may want to have a look to an intro.
One of the things that makes OmNet++ attractive to me is its scalability. Is possible to run large simulations in a desktop. Besides, it is possible to scale the same simulation to a cluster without rewriting the code.
You should consider SystemC, although I'd also recommend taking a second look at OmNet++.
We use SIMLIB at my school. It is very fast, easy to understand, object oriented, discrete and continuous simulator. It might look outdated but it is still maintained.
There is CSIM from Mesquite Software which supports developing models in C, C++ and Java. However, it is paid-commercial, AFAIK.
Take a look at GBL library. It's written in modern C++ and even supports C++0x features like move semantics and lambda functions. It offers several modeling mechanisms: synchronous and asynchronous event handlers, preemptive threads, and fibers. You can create purely behavioral, cycle accurate, and real-time models, or any mixture of those.
I really like these tools when it comes to the concurrency level it can handle.
Erlang/OTP looks like much more stable solution but requires much more learning and a lot of diving into functional language paradigm. And it looks like Erlang/OTP makes it much better when it comes to multi-core CPUs (correct me if I am wrong).
But which should I choose? Which one is better in the short and long term perspective?
My goal is to learn a tool which makes scaling my Web projects under high load easier than traditional languages.
I would give Erlang a try. Even though it will be a steeper learning curve, you will get more out of it since you will be learning a functional programming language. Also, since Erlang is specifically designed to create reliable, highly concurrent systems, you will learn plenty about creating highly scalable services at the same time.
I can't speak for Erlang, but a few things that haven't been mentioned about node:
Node uses Google's V8 engine to actually compile javascript into machine code. So node is actually pretty fast. So that's on top of the speed benefits offered by event-driven programming and non-blocking io.
Node has a pretty active community. Hop onto their IRC group on freenode and you'll see what I mean
I've noticed the above comments push Erlang on the basis that it will be useful to learn a functional programming language. While I agree it's important to expand your skillset and get one of those under your belt, you shouldn't base a project on the fact that you want to learn a new programming style
On the other hand, Javascript is already in a paradigm you feel comfortable writing in! Plus it's javascript, so when you write client side code it will look and feel consistent.
node's community has already pumped out tons of modules! There are modules for redis, mongodb, couch, and what have you. Another good module to look into is Express (think Sinatra for node)
Check out the video on yahoo's blog by Ryan Dahl, the guy who actually wrote node. I think that will help give you a better idea where node is at, and where it's going.
Keep in mind that node still is in late development stages, and so has been undergoing quite a few changes—changes that have broke earlier code. However, supposedly it's at a point where you can expect the API not to change too much more. So if you're looking for something fun, I'd say node is a great choice.
I'm a long-time Erlang programmer, and this question prompted me to take a look at node.js. It looks pretty damn good.
It does appear that you need to spawn multiple processes to take advantage of multiple cores. I can't see anything about setting processor affinity though. You could use taskset on linux, but it probably should be parametrized and set in the program.
I also noticed that the platform support might be a little weaker. Specifically, it looks like you would need to run under Cygwin for Windows support.
Looks good though.
Edit
Node.js now has native support for Windows.
I'm looking at the same two alternatives you are, gotts, for multiple projects.
So far, the best razor I've come up with to decide between them for a given project is whether I need to use Javascript. One existing system I'm looking to migrate is already written in Javascript, so its next version is likely to be done in node.js. Other projects will be done in some Erlang web framework because there is no existing code base to migrate.
Another consideration is that Erlang scales well beyond just multiple cores, it can scale to a whole datacenter. I don't see a built-in mechanism in node.js that lets me send another JS process a message without caring which machine it is on, but that's built right into Erlang at the lowest levels. If your problem isn't big enough to need multiple machines or if it doesn't require multiple cooperating processes, this advantage isn't likely to matter, so you should ignore it.
Erlang is indeed a deep pool to dive into. I would suggest writing a standalone functional program first before you start building web apps. An even easier first step, since you seem comfortable with Javascript, is to try programming JS in a more functional style. If you use jQuery or Prototype, you've already started down this path. Try bouncing between pure functional programming in Erlang or one of its kin (Haskell, F#, Scala...) and functional JS.
Once you're comfortable with functional programming, seek out one of the many Erlang web frameworks; you probably shouldn't be writing your app directly to something low-level like inets at this late stage. Look at something like Nitrogen, for instance.
While I'd personally go for Erlang, I'll admit that I'm a little biased against JavaScript. My advice is that you evaluate few points:
Are you reusing existing code in either of those languages (both in terms of source code, and programmer experience!)
Do you need/want on-the-fly updates without stopping the application (This is where Erlang wins by default - its runtime was designed for that case, and OTP contains all the tools necessary)
How big is the expected traffic, in terms of separate, concurrent operations, not bandwidth?
How "parallel" are the operations you do for each request?
Erlang has really fine-tuned concurrency & network-transparent parallel distributed system. Depending on what exactly is the project, the availability of a mature implementation of such system might outweigh any issues regarding learning a new language. There are also two other languages that work on Erlang VM which you can use, the Ruby/Python-like Reia and Lisp-Flavored Erlang.
Yet another option is to use both, especially with Erlang being used as kind of "hub". I'm unsure if Node.js has Foreign Function Interface system, but if it has, Erlang has C library for external processes to interface with the system just like any other Erlang process.
It looks like Erlang performs better for deployment in a relatively low-end server (512MB 4-core 2.4GHz AMD VM). This is from SyncPad's experience of comparing Erlang vs Node.js implementations of their virtual whiteboard server application.
There is one more language on the same VM that erlang is -> Elixir
It's a very interesting alternative to Erlang, check this one out.
Also it has a fast-growing web framework based on it-> Phoenix Framework
whatsapp could never achieve the level of scalability and reliability without erlang https://www.youtube.com/watch?v=c12cYAUTXXs
I will Prefer Erlang over Node.
If you want concurrency, Node can be substituted by Erlang or Golang because of their light weight processes.
Erlang is not easy to learn so requires a lot of effort but its community is active so can get help from that, this is only the reason why people prefer Node .
I am planning to build an inverted index searching system with cassandra as its storage backend. But I need some guidances to build a highly efficient searching daemon server. I know a web server written in Python called tornado, my questions are:
Is Python a good choice for developing such kind of apps?
Is Nginx(or Sphinx) a good example that I can look inside to learn its architecture to implement a highly efficient server?
Anything else I should learn to do this?
Thank you~
Twisted framework is a good starting point for develop backend servers. It is fast and scalable.
Python is unlikely to allow you to write the most efficient server possible. However, it may just be that it will be fast enough, because for most applications it is.
Therefore, one path you could take is starting with Python. It's a great language for prototyping, much better than C++ for the stage in which you're not even sure which architecture to adopt. As you finish the project, you can see if Python is efficient enough. If it isn't and there's no easy way to make it much faster (such as rewriting a small routine that takes up most of the work in C), you can rewrite it in C++ using the Python prototype as a basis.
For search, http://github.com/tjake/Lucandra may be interesting prior art.