GDR Forum Index
Podcast Podcast
Dev Dev Logs
Search Search
RSS RSS
Register Register
Log in Log in
Reply to topic GDR Forum Index -> Game Developer's Refuge -> Development Log - RogueOpcode Page Previous  1, 2, 3, 4  Next
View previous topic :: View next topic  
Author Message
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Fri Oct 22, 2010 9:48 am    Post subject: Reply with quote

Cleaned up collision code a bit and squashed a few bugs.
Almost ready to throw some dummy menu items on screen and make sure everything works like I think it's going to.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sat Oct 23, 2010 2:27 am    Post subject: Reply with quote

Got a a couple dummy dialogs up and running. I can spawn dialogs and have them open new dialogs in response to human input. They respond reasonably to clicks and keyboard input.

It is taking a lot more code to get these things on screen than I really want, but I'm not sure yet if that's because the design is more convoluted than I'd intended, or if it's because I'm still programming at such a low level. I'm imagining a slim but comprehensive widget set that is easily configurable and customizable, but it's just not there yet.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Mon Oct 25, 2010 10:38 pm    Post subject: Reply with quote

Note to self: don't spend an hour and a half tweaking and debugging code if you haven't spent 30 seconds tweaking it's parameters yet.

>_<
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sun Oct 31, 2010 1:59 am    Post subject: Reply with quote

Ok, got collision working finally. I had to resort to manually drawing all my bounding boxes (not in the framework yet) to see what was actually colliding with what. Turns out the Rectangle class I was using in C# was floating point, but the Java equivalent is integer. Obviously, that's gonna mess things up if I'm assuming I have float values.

Sprite sheets are partially implemented now, as well. So I don't have all three frames of the ship sprite flying in formation on the screen anymore. Animation still doesn't quite work, and I'm not sure why. Probably some assumption I was making in the code before that doesn't hold true in Java.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sun Oct 31, 2010 2:31 am    Post subject: Reply with quote

Ok, sorted that out. Just need to get it neatly integrated into the framework. Pretty much everything in the game is working more or less as it was in .net, except for sound, image rotation, and particle rendering.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Thu Nov 04, 2010 6:24 pm    Post subject: Reply with quote

So I missed the October deadline, which doesn't surprise me too much. I made quite a lot of progress, though. I'm a little depressed that most of this has simply resulted in it not quite working as well as it did in XNA, but we're amassing a tidy bundle of portable, very reusable code.

If anyone has any questions about deving in Java or Android, I will have some insight to share in the coming weeks.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Bean
Admin

Joined: 20 Aug 2005
Posts: 3772

PostPosted: Fri Nov 05, 2010 9:38 pm    Post subject: Reply with quote

I'm sure a lot of us would like any Android insight you may have to share :)


-Bean
_________________
Kevin Reems | Nuclear Playground | Solid Driver
View user's profile Send private message Visit poster's website
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Fri Nov 12, 2010 3:01 am    Post subject: Reply with quote

1) Don't use the collections form java.util. Ever. Seriously. All the memory they throw around like candy pisses off the garbage collector and it WILL kill your frame rate. This means your choices are arrays or custom data structures. I have written some that are free for anyone to use. I may get fancy with memory reclamation pools so you can garbage collect them later at your convenience (but be careful!)

2) Inlined fixed-point code doesn't seem to be appreciably faster than floats on the G1 or the MyTouch 3G, despite claims that they don't have an FPU. Overall, it is a little faster at best, and sometimes significantly slower(!!!) I wouldn't recommend you even bother testing it out unless you were optimizing down to the microsecond.

3) Never do casts between numeric data types in a tight loop if there's any way to avoid it. The extra memory copies and conversions will inflate the execution time by a factor of 4 in some cases.

4) You'll get much better performance if you set up a SurfaceView for canvas drawing than if you use a standard View. With some extra shenanigans, this allows you to call lock and unlock on the canvas, which does explicit page flipping and gives you a non-trivial performance boost.

5) If you're going to poke at a member variable more than 2 or 3 times, you should always assign it to a local reference or copy. It can make a big difference in a tight loop. I'm assuming the extra layer of indirection through the this pointer is what's slowing you down.

6) Never trust the frame rate you see when you launch your game app from Eclipse. Even if you're not debugging, it'll run 3 or 4 times faster if you launch it from your app menu on the phone, once it's updated and installed. I was blown away how fast my shit was actually running, once I figured this out.

7) Holy shit, OpenGL. For serious. Night and day, between the standard Canvas drawing and GL with DrawTexture extensions. Not only is it faster and smoother, but the sprites just look better. Once you've got your game up and running with the SurfaceView, it'll be worth the effort to get GL working.

8) I'm not there yet, but I'm coming to the conclusion that you're probably best off using Java to set up your window and just jump into a native C/++ routine. After you've transitioned to OpenGL for rendering, it should be simple to get all your rendering code running in C++. The main things that you'll still depend on Java for are user IO, audio (wtf!), and utility kinda tasks like databases, network, camera, accelerometer, etc... The bulk of your game logic could be 100% pure native code. Just saying it makes me giggle a little.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sun Nov 14, 2010 12:04 pm    Post subject: Reply with quote

Turns out (6) above might partially be a bug. Sometimes, a "second" according to the clock APIs is actually more like 250 - 400 milliseconds. I don't know WTF this is all about. I want to say it's my fault because other games seem to work at reasonable speeds on my phone, but the particular combination of stuff I'm dong may be triggering an OS level bug. I need to research this some more, because it totally messes up everything.

You'll still run slower if you debug because of the overhead, and even just being on the cable will send debug messages to Eclipse, but I think I have proved to myself that the calls I'm using aren't always reporting accurate milliseconds.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Wed Nov 17, 2010 1:16 pm    Post subject: Reply with quote

The Android lifecycle is kind of a nightmare if you don't really understand it. Depending on how you left your program and what happened in between, returning to your program will generate a different set of events that you have to respond to. If you don't (or don't handle them correctly) your program WILL crash.

I think I have it mostly figured out, but I'm still trying to wrap my head around when certain things will happen, and what I'm responsible for at each of them. Once I have this down 100%, I will look into abstracting this away in a friendlier manner.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10862
Location: Canadia
PostPosted: Wed Nov 17, 2010 1:35 pm    Post subject: Reply with quote

I ran in to some similar fun doing Windows/Mac/Linux ports recently. The exact series of events triggered by minimizing an application were ever so slightly different between the 3 OS.
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Wed Nov 17, 2010 9:24 pm    Post subject: Reply with quote

Wonderful... :-/

How does program lifecycle work on iOS? My understanding is that traditionally you would just go away whenever anyone else had the floor, but that iOS4 handles multitasking a lot more like Android does...
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
PoV
Moderator

Joined: 21 Aug 2005
Posts: 10862
Location: Canadia
PostPosted: Wed Nov 17, 2010 11:50 pm    Post subject: Reply with quote

Originally you'd get either a kill notice, or a go in to the background message (incoming call/overlay). Now you're supposed to save your state any time you're backgrounded, since there's a chance you may never come back.
_________________
Mike Kasprzak
'eh whatever. I used to make AAA and Indie games | Ludum Dare | Blog | Tweetar
View user's profile Send private message
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sun Nov 28, 2010 12:39 am    Post subject: Reply with quote

To facilitate testing and development until I get this all sorted out, I put in some minimal lifecycle code (read: full reset whenever the user so much as looks the screen too hard). Clearly this would not be ok for a release, but in the mean time I can at least run my software without it crashing or things failing to show up.

I nuked the mercurial repository on google code. It turns out SVN is just a lot more convenient for our team workflow, and we are going to end up throwing out a lot of our previous codebase anyway, when we get all of Android's idiosyncrasies sorted out. A lot of the core classes have been basically rewritten from scratch. Also on the organizational front, we moved all of our framework classes out from any sub-packages into the top level package. This makes absolute/qualified identifiers shorter and the hierarchy flatter and simpler. But I'm not convinced it actually makes the project easier to work with. For instance, if I want to work with all of the abstract geometric classes (vectors, rectangles, etc.) because I'm changing them or I need them handy for reference, I have to go down the file list and individually open each one that I want, hoping I don't miss any along the way. Seems like things would be easier if I could just open the geom package and pop up a tab for everything in there. I think limiting the hierarchy to at most one sub-level would keep thing simple, while still giving greater organizational benefits. Thoughts?

Currently on the workbench: I am porting my C++ Soundy synthesis code to Java. This is something I've been meaning to do for a while, but I put it off because I was poking through the Android APIs and found some classes for JET audio, which is a kind of interactive midi engine. It seemed great for game use, and that's basically the standpoint the docs take. Your game can affect the music, and the music can affect the game. One small problem: there's a VST plugin you need for your midi composer, to make sure the song you write sounds like the song you end up hearing on the device. This plugin DOES NOT EXIST. I spent like 5 hours poking around google, searching for a download. I finally came to the conclusion that JET was not an option, so I had to port my synth code. It blows my mind that a facility that has been in the public Android API since 6 freaking versions ago is still basically unusable because the tools don't exist. What the hell, google?

Related to this, because I'll be generating my own waveforms on the fly, I have complete control over content and effects. So I decided to write some support code to load and playback SFXR files directly. I can generate, audition, and tweak all my sounds on my mac, and then recreate them at runtime on my phone. For a comparison, a .sfs file is always about 100 bytes, whereas a sample "asplode" sound exported as a .wav file with default settings is 82k. On a PC, 82k is basically equivalent to 0k, but on a phone it starts to add up quickly, especially when older versions of the OS force the user to install software on the limited built-in memory rather than an arbitrarily large sd card.

One thing I'm rather happy about is my Spritey3d class. It automatically repositions and scales graphics based on Z depth, giving a good approximation of 3d perspective. Looks slick and runs surprisingly smoothly, even without OpenGL rendering.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9442
Location: Not Finland
PostPosted: Sun Nov 28, 2010 8:01 am    Post subject: Reply with quote

Quote:

One small problem: there's a VST plugin you need for your midi composer, to make sure the song you write sounds like the song you end up hearing on the device. This plugin DOES NOT EXIST.


So, what you're saying is that this is MIDI with a procedurally generated patch set? Or am I reading that wrong?


Quote:

On a PC, 82k is basically equivalent to 0k,


Even on PC it can add up faster than you'd imagine. Inimicus currently uses 105k of graphics files, and 7.38 megs of sound effects. The numbers are relatively small, but the ratio is the kicker.
_________________
NoOP / Reyn Time -- The $ is screwing everyone these days. (0xDB)
View user's profile Send private message Visit poster's website
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Mon Nov 29, 2010 4:22 pm    Post subject: Reply with quote

Sirocco wrote:
So, what you're saying is that this is MIDI with a procedurally generated patch set? Or am I reading that wrong?

I'm not sure where the sound sets actually come from, but I do know the playback engine is custom, and it sounds slightly different from what you'll get from other midi playback sources. Plus you have to make sure your instrument IDs match what it's expecting; a demo song I wrote ends up with every track being rendered as piano in JET because I don't have their VST to write to.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Wed Dec 01, 2010 1:24 pm    Post subject: Reply with quote

Screen shots!





These show off the pseudo-3d perspective for sprite rendering. What the still shots don't capture is how awesome it looks with a swarm of asteroids flying at your face.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9442
Location: Not Finland
PostPosted: Wed Dec 01, 2010 3:43 pm    Post subject: Reply with quote

That's the problem with screenshots... depending on your art and animation style, they may looks like ass at any given moment ;)

I do like the contrast between the purplish cosmos and the asteroids.
_________________
NoOP / Reyn Time -- The $ is screwing everyone these days. (0xDB)
View user's profile Send private message Visit poster's website
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sat Dec 04, 2010 11:30 pm    Post subject: Reply with quote

So I think I've figured out the Android app lifecycle stuff, as far as when things happen and what I'm responsible for. What's still not totally clear is the correct way to react to these events. I know I want to save all my state, but our first two attempts have been less than satisfactory. I feel like I shouldn't have to recreate the Java serialization protocol from scratch, but I'm not seeing a better way of doing this on the interwebs.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Fri Dec 10, 2010 9:22 pm    Post subject: Reply with quote

If anyone has requests for a from-scratch SFXR implementation with REAL envelopes and a music composer, drop your 2p here.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Sirocco
Moderator

Joined: 19 Aug 2005
Posts: 9442
Location: Not Finland
PostPosted: Sat Dec 11, 2010 11:31 am    Post subject: Reply with quote

I wouldn't mind seeing a lib to create output from SFXR files at runtime, as you mentioned earlier.
_________________
NoOP / Reyn Time -- The $ is screwing everyone these days. (0xDB)
View user's profile Send private message Visit poster's website
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Mon Dec 13, 2010 7:27 pm    Post subject: Reply with quote

Ok, so now that I wrote an operating system from scratch for my advanced OS class (including an interpreted language I wrote in about a day), I can get back to some game stuff My goal is to get soundy up and running tomorrow. Just get some funky digital squelches coming out of my phone. If I can get there, I'll be happy. But if I have time left over, I'd like to get it loading and playing SFXR files, too.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Mon Dec 20, 2010 2:23 pm    Post subject: Reply with quote

Ok, finally got the core synthesis stuff up and running. It's really flexible and powerful, which means it's rather complex and hard to use. I'm working on the architecture of my higher level interfaces that will make this thing easier to use.
_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
xearthianx
Developer

Joined: 28 Sep 2006
Posts: 771
Location: USA! USA!
PostPosted: Sat Mar 05, 2011 8:40 pm    Post subject: Reply with quote

BOOM.

_________________
Ionoclast Laboratories - Scientia et Dominatia!
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
sonrisu
Moderator

Joined: 31 Aug 2005
Posts: 4990
Location: Silicon Valley!
PostPosted: Sun Mar 06, 2011 6:43 pm    Post subject: Reply with quote

Wow. That's a lot of knobs you've got there. :]
_________________
loomsoft :]
View user's profile Send private message Visit poster's website
Reply to topic GDR Forum Index -> Game Developer's Refuge -> Development Log - RogueOpcode Page Previous  1, 2, 3, 4  Next
Game Developer's Refuge
is proudly hosted by,

HostGator

All trademarks and copyrights on this page are owned by their respective owners. All comments owned by their respective posters.
phpBB code © 2001, 2005 phpBB Group. Other message board code © Kevin Reems.