First of all, sorry for the vague title. I have no other ideas of what could possibly be put there, but you'll see this for yourself as you read on.
I am a very new Java developer for android and a martian to game development, therefore my question is not so related to particulars as it is related to theory and possibilities.
I'm interested in how I can develop my game so if holding the phone horizontally and it is tilted one way or another, an object will move in that direction. I'm sure this is very common and easily done but what about if I wanted the top speed to increase the further it was turned, and the acceleration to increase the quicker it was turned?
I honestly have no idea of the complexity of this question, whether you will laugh and give me one line of code or whether it's something you just can't teach.
Either way, thanks for reading, I look forward to your responses.
Check this out http://mobilestrategist.blogspot.com/2010/01/android-accelerometer-and-orientation.html
This gives you what you need to do what you're asking for, but as the other answer suggests, you may be running before you crawl here. I have been writing Android for 2 years and have yet to take advantage of the accelerometer. Though if you're just looking to noodle around with the device's capabilities, this is as good a place to start as any, I suppose.
You could read about sensors & sensor events.
TYPE_ACCELEROMETER is perhaps what you are looking for...
Related
i'm a CS student and for my semester project I want to make an app that tracks user time in different programs, prepares reports with time spent user spent "productive" and how much procrastinating, shows how much time user spends doing some tasks ans stuff like that.
I know there is a bunch of applications like that but I feel completely clueless about where should i start and how i might make it work.
I wasn't able to find any tutorials or articles on the subject, so i try to ask somebody for help. Maybe somebody could hint me in right direction or give a link to related tutorial.
Thank you in advance
In case anyone out there having same question.
In C# there's actually a class Process (https://msdn.microsoft.com/en-us/library/system.diagnostics.process(v=vs.110).aspx)
It has a lot of useful methods like getProcess() which returns all processes currently running on a computer.
And about this class there are articles like (https://www.c-sharpcorner.com/uploadfile/puranindia/understanding-process-in-C-Sharp/) with in-depth explanation how everything works and how to use it.
Ok, granted, you're a "budding" programmer. As is the case for any huge task (your app doesn't sound like a college class calculator program), the first step is to break the problem into pieces. Did you pay attention to the class you took (I'm sure its part of your CS class curriculum) regarding requirements and design? So, I think the first step would be to put coding aside for the moment, sit down with paper and pencil, and jot down some program requirements for your user time tracking app. What are the expected inputs to your app? What transformations will your app make to this inputs? Finally, what outputs should your app produce?
A good way of making your brain think about these topics is to write use cases or user stories. Once you understand what your app needs to do, you can think about a design (e.g., Steps to design) and then writing the code. One major decision during design time will be a high level decision regarding how you'll approach the design. Two (of many) primary approaches being procedural (a.k.a. functional) or object-oriented.
For an app of this size, you have a lot to do before writing the first line of code, IMHO.
What is the best method to track/recognize an object using a Kinect and Java or C programming after having a constant track on the object in 3D space I wanted to have the coordinates.
I know the exact object I wanna tack and wanted to the most convenient way to track the object.
I've currently programming with processing using Java, I'm a newbie to this any help would be appreciated.
Stack Overflow isn't really designed for general "how do I do this" type questions. It's designed for more specific "I tried X, expected Y, but got Z instead" type questions. That being said, I'll try to help in a general sense:
Break your problem down into smaller pieces.
Step 1: Can you get Kinect data feeding into your code? Don't worry about doing anything with the data, just display it on the screen for now. Googling something like "Processing Kinect" returns a ton of results, or you could check out the Processing libraries page.
Step 2: After you get that working, then can you identify your target point? Then can you track that point? Again, google is your friend. You might also consider treating this as a separate problem and using something like OpenCV to do image processing on the Kinect feed.
Open Kinect by Daniel Shiffman is a pretty good starting point, and it contains a bunch of examples that get you closer to your goal.
That should be a reasonable starting point: break your problem down into smaller steps, then use google searches to approach those steps one at a time. If you get stuck on a specific step, come back and ask a specific question (don't forget the MCVE) and we'll go from there. Good luck.
I would like to do some audio and video analysis in Java.
In a bit more detail, I would like to identify the points in audio/video that have either been monotonous for quite some time or have drastically changed compared to some previous state.
If you want to look at it in a mathematical way, I can try to explain it like this:
Example:
You have an audio file. You should extract the waveform of that
audio file. You could try to approximate that waveform with some
simpler function, that can be expressed as a closed formula. Let's
call that function f(t).
Now, to find out how your function behaves (is it increasing or decreasing) at some point or interval, I guess I could use the first derivative,f'(t). If I'd like even more information, I assume second derivative, f''(t) would also come in handy.
So, if we assume we can do that then I guess I'd have 1 piece of information about the audio.
However, if I'm not mistaken, audio files can also have spectrograms, so I'm unsure how they fall into all of this.
So, the real question goes here: Is there a way to do this in Java (efficiently)? I've been doing some digging and I've found MusicG, however, the last update date is July 2012, which leads me to believe this may be abandoned.
The second part refers to video files, but without their audio component.
This is where I'll have more questions, so I'm just gonna go and shoot them.
How do you identify points of change in "pace" in videos?
Here's an example:
Imagine the video shows car driver's point of view while he's driving
on a long, straight road. Since the surroundings are mostly the same,
the pace could be described as "not changing much". At one point, the
road begins to curve but the driver, due to him falling asleep" is not
following the road that precisely, so the surroundings start to change
somewhat, and so does the pace. At the apex of that curve there is a
tree, which grows bigger and bigger as the car is approaching it.
Here, the POV (and the pace) is changing quite a lot, since the tree
is getting bigger and bigger. In the end, the car crashes into a tree,
all hell breaks loose, the car starts to roll uncontrollably, which
indicates a really intense pace.
I'm assuming one way could be to do an image segmentation and somehow determine which portions of the frames are changing, and how big are those portions to try to determine pace, but I'd like additional input.
If anyone has had prior experience doing any sort of related work in Java, what approaches did you explore and/or use? One thing that immediately comes to my mind is JavaCV, but as I said, with my limited experience, I'm unsure what to actually try.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
First question: What would be the best language to create a video player in? / Anyone point me in the direction of a tut that can help me write said script?
Second Question: How can I code such player to echo a embed code for each video: Ala youtube/break/viemo.
^ whats amazing to me, is the fact I searched google for a day and a half and haven't even come close to someone explaining how to build a video player, let alone have a option for it to spit out a embed code or any other sharing options.
Usage info: Once the player is finished it will be imported into wordpress, so I can have total control of each video and manage them accordingly. Not asking for help for importing to WP but any tips would be great.
{Please don't point me to VideoJS or any other video service, as I will make my own and not pay for a license.}
In general, a video player is a picture gallery, where twenty four (or more) pictures are displayed in order every second during the entire duration of the film. Twenty four is the lowest limit for a person to visually confuse static pictures with motion, for better effects I would recommend thirty or more.
The second component of a video player is typically a music player, which displays many "frames" of music per second, which blend through the digital to analog playback system into something resembling continuous sound.
Getting these two subsystems to operate without letting one get ahead of the other is generally required for a "video playback" system. There are many "already done" systems, but it sounds like you envision building your own (to add in unique "features").
Keep in mind that there are very large volumes of data moving around in "video playback". This means that if it is possible, compressing the data is vital for reasonable performance. Compression routines are not as simple as they seem, and the major video codecs are those that do a good job of balancing CPU cycles to decompress, file size, and resulting image quality.
Assuming you really don't want to write a video player, but just want to use someone else's video player "with enhancements", you will be at the mercy of how well built the existing video player is, whether or not it supports any kind of customization, and if it does, how well it supports the customization you have in mind.
Since speed is such a consideration, even though more advanced languages exist, traditionally these things are done in C, assembly, or even hardware acceleration chips.
These are my thought, although you should try to search a little better... Tutorials are very easy to find ...
You could use Flash / ActionScript to create a custom video player. It's still common on the net, although more and more non-flash players are rising (HTML5). I still prefer Flash because of the performance, but keep in mind that iPhone / iPad doesn't support Flash...
If you are going to script your own videoplayer in Flash, this tutorial will set you off to create your own implementation...
For your second question:
Just create a database with a unique ID for every video URL your player will have. When you create the embed code you can include this unique ID as a URL var to the main video player.
From there on you can call your player page with URL vars (example: http://www.yourlink.com?videoid=ID).
When you embed your SWF object you can then pass the videoid along with a FlashVar, or prefetch the matching video URL and send that URL with a FlashVar to your SWF. It's not so complicated, more info can be found here.
try osmf.org. You can either use the strobe media playback with it or build your own player around it. OSMF is pretty robust
I'm coming to the end of my first year of CS and I thought a great way to consolidate all the things I've learnt this year would be a personal game project.
I would like to implement a 2D based rts, I'm thinking along the lines of starcraft I, warcraft II or even command and conquer. I will have about 3 months without interruptions to implement the game.
So to anyone experienced with java game programming, I have a few questions:
Is it realistic to design a 2D rts engine from scratch in 3 months?
If so what are some good books/resources to get started?
Would it be better to modify some existing project? I would think the experience of having to work with a lot of someone else's code would be good since our exposure to such topics in an undergrad cs degree seems very rare, if non-existent.
Are there any decent open source 2d rts projects that anyone could recommend? I've looked through a few but most seem to be written in c/c++
My humble thanks
Edit: Thanks for the quick responses, I think that perhaps it was a bad idea to post this in a rush since I think I misrepresented what I want to do.
When I say "along the lines of warcraft II etc" I mean more like that style of rts using sprites. I don't intend to implement a game nearly that complex, more like just a basic prototype.
My goal would be some thing more like a flat textured map with some basic obstacles like trees, a single unit producing structure like a barracks. I'd like to have the units to have health bars, be able to move and attack and die (and possible morph into another unit).
Far off goals would be to implement some basic pathing using a modified version of the dijkstra shortest path algorithm, ranged units with missle attack, etc.
I don't plan to implement any opponents or ai or networking or anything like that.
I'm thinking along the lines of starcraft I, warcraft II or even command and conquer
Make sure you purge your mind of matching the full scope of any of those. They took large teams of developers multiple years to make, with multi-million dollar budgets, so you can't even hope to approach those. They're called AAA for a reason. That being said, there's no reason you can't very minimally ape their design, or make a tiny game in their genre, assuming you have previous experience making small games.
A sub-genre of RTS that might be doable in that amount of time is a Tower Defense game. Plants vs Zombies is a good example. The reason I suggest this sub-genre is that you can avoid implementing any sort of AI or path-finding, which are notoriously difficult to get working, and I think technically impossible to implement "perfectly", especially with a limited CPU budget.
Make sure to reign in your scope. Favor a "complete" game over new features, because you can then call it "done" at any time. Get your game playable ASAP, and don't sweat the polish or details until you have to. Add one enemy type and one type of player unit (with only one ability, if you were thinking of implementing multiple abilities per unit). Make a title screen, menus (even if the menu is just "click screen to play"), game over screen, level complete or stat screens, cross-level player statistics, etc. Once you have all that ironed out, spend equal time adding new features and polishing the gameplay/graphics/bugs.
Once you have a playable, "complete" game ready (no matter how small in scope), find a real artist to do graphics for you. A shiny game always draws an audience, no matter how simple the gameplay.
It is very unrealistic to think you could implement a 2D RTS engine anywhere even close to the complexity in those kind of games. You could maybe get something very rough if you were experienced, but with only one year I think it's doubtful.
I can't help but feel like it would be much better for you if you used an existing engine or framework and built off of it. Like you said, working with other code would probably be a good learning experience as well. It would allow you to experiment without getting bogged down in having to do everything.
Keep it simple or you will simply drown in complexity before getting around to have anything playable. Since you have not tried it before, you will have a lot of nuts to crack and you don't know how long they will take.
Also remember that report writing and documentation takes time too.
The idea is good, and I think you can pull off a whole game if you find good building blocks. I would suggest discussing this with your teacher to hear what is acceptable for you to use. Would it e.g. be ok to do a game on an open source engine if you add some non-trivial functionality?
Update: Seems to be several engines available from Java at http://www.devmaster.net/engines/list.php?fid=6&sid=1
People often forget, that creating games is MUCH MORE than just coding the technique thing. Its about content creation, game design, sound and music, the "fun factor". If you make heavy use of existent APIs or engines, it will be possible, but writing it from scratch with no experience in 3 month is like asking yourself if you can code 100,000 LOC in this time which means 1111 LOC per day. This might be possible, but not if you have to desing and think, and just having the code makes no game.
Perhaps it would make sense to look at some existing efforts to get a feel for the scope of what you are looking at. These should give you some ideas or even code to build on:
http://www.duncanjauncey.com/btinternet/old/javagame/game.html
http://en.wikipedia.org/wiki/Lightweight_Java_Game_Library
http://www.ardor3d.com/
http://en.wikipedia.org/wiki/JMonkeyEngine
It would be a lot for me to bite off (from scratch) in the time given that is for sure. That is about all I can say.
EDIT: I thought maybe JOGRE was not what you are looking for. Then I thought about it and it seems like it would have all the right kinds of plumbing for what you are trying to do.
EDIT AGAIN: After my answer, one of the related questions links on the side seemed relevant: Java Game Programming: JOGL vs LWJGL?
Well if it gives you any hope at all, my team and I are currently working on an RTS game called "The Genesis Project". We call ourselves MotherBoard Games, or MBG for short. If you would like, I am always looking for more coders. You can email me at mpmn5891#gmail.com, I can give you some advice and tips form my 6 year experience, 2 of which have been spent making this game (to give you a scope)