Developing for Android (or anything) using Construct 1!!!

Chat about anything not covered in these forums, but keep it civil!

Post » Tue May 25, 2010 3:25 pm

I've found a way to translate a cap file to Java very, very quickly. it requires some programming know how, and some initial setup time, but once that's over, damn it's fast. and anyone confident in their language of choice can do it. but first a little background info:

So, I was using Construct to prototype my ideas for my Android game, especially because it uses procedural animation exclusively, which requires alot of trial and error. I wanted the process to be as painless as possible, so I created java functions for all the construct functionality I'd need.

I have a 'sprite' class, with a 'move to position' function, a 'set angle towards' function, etc
I've got lerp.. basically every object type I'll be using I made a java equivalent class, and every action/condition/expression also has a java equivalent.

Then I discovered that you can right click on a construct event, and "copy as text".
if you set up your java classes to be as much like construct objects as possible, you can just copy/paste into something like notepad++, and then completely convert it to java using the same set of find/replace commands each time. The whole process of converting from cap file to java takes about 1 minute 30 seconds (because you have to copy/paste, etc). After I setup a macro to automate it, I'd say it'll probably take about 15 to 30 seconds to convert from cap file to java. in short, again, Construct is awesome always, now and forever, and ever has been.
Spriter Dev
B
96
S
21
G
12
Posts: 3,256
Reputation: 16,813

Post » Tue May 25, 2010 3:30 pm

Oh that's just sick.

You sicko.

How do you even come up with this stuff? I told you to go program something, I didn't mean to become an instant show-off. :D

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
56
S
21
G
37
Posts: 2,902
Reputation: 26,739

Post » Tue May 25, 2010 3:33 pm

oh here goes soldjah boy, showing up just long enough to say something stupid. :roll:


totally kidding sol. yeah, thanks again soljah, for suggesting I try plugin development again, you changed my life. if I become a millionaire developing mobile games, I owe you beer, or a joint, whatever you weirdos do over there. :wink:
Spriter Dev
B
96
S
21
G
12
Posts: 3,256
Reputation: 16,813

Post » Tue May 25, 2010 3:52 pm

Wow, that's awesome lucid. Post a video of your game running on android, I want to see this.
B
30
S
4
G
8
Posts: 1,207
Reputation: 6,865

Post » Tue May 25, 2010 4:10 pm

Mmm... I'm not persuaded this will work for complicated games though! You'd have to basically reinvent most of the runtime in Java. As you already point out, you have to write Construct-themed routines to be able to paste in, and that's the beginning of reinventing the engine.
Scirra Founder
B
378
S
220
G
84
Posts: 23,868
Reputation: 188,111

Post » Tue May 25, 2010 4:28 pm

DUDE... awesome.

Hmm... I wonder if there's some way to automate this a bit more. What exactly does the event exporter do? Could it be made to export to java code that could then use that engine to plug in to?

Or... is there some way that upon exporting, the java engine could be used like the directx engine at runtime, merely using the java one instead? And does it matter if he's basically creating a new runtime?
Moderator
B
91
S
32
G
33
Posts: 3,005
Reputation: 27,552

Post » Tue May 25, 2010 6:14 pm

[quote="Arima":d4q1ub3z] What exactly does the event exporter do?[/quote:d4q1ub3z]

converts to this:
[code:d4q1ub3z]+ MouseKeyboard: On Left mouse button Clicked
-> Sprite: Set position to mousex, mousey[/code:d4q1ub3z]
which after a few find/replaces (and I confess I forgot I have to manually add { }'s and ;'s until I learn to use the expression based find/replace in notepad++, but my time estimates remain the same) could be converted to this:
if (screentouched())
{
sprite.setpositionto(touchx,touchy);
}
[quote="Arima":d4q1ub3z]
Hmm... I wonder if there's some way to automate this a bit more. Could it be made to export to java code that could then use that engine to plug in to?[/quote:d4q1ub3z]
I don't think a plugin can be made to access the cap the way the Copy as Text function does. I was in the middle of asking this question earlier when the forums went down. But someone in chat recommended Autohotkey, which will automate most of it.
[quote="Arima":d4q1ub3z]
Or... is there some way that upon exporting, the java engine could be used like the directx engine at runtime, merely using the java one instead?[/quote:d4q1ub3z]
I don't think it's possible without rewriting construct itself, but construct 2 will be able to do things like this, according to ash.


[quote="Ashley":d4q1ub3z]Mmm... I'm not persuaded this will work for complicated games though! You'd have to basically reinvent most of the runtime in Java. As you already point out, you have to write Construct-themed routines to be able to paste in, and that's the beginning of reinventing the engine.[/quote:d4q1ub3z]
in some respects the game I'm working on is complicated: here's a typical event:

which was converted using the copypaste technique and works exactly as it does in construct.

I agree that I'm basically writing a java/android runtime, but that's something I wanted to do anyway.(quote="arima"And does it matter if he's basically creating a new runtime? :wink: ) As stated earlier, you have to understand the language enough to create the classes, so it's definitely not a way for someone squeamish about coding to 'export to everything'.

But I think we can all agree that construct is a much better tool for rapid prototyping than java, or objective-c is. Java and the android plugin is definitely not a gamemaker, and I needed to write code to move and track sprites, simplify and manage touch data, and for this game in particular, I needed the equivalent of imagepoints and hotspots. After prototyping in construct, it made sense to make those classes mirror those in construct to minimize the effort required to port the finished prototype. I had no idea there was a "copy to text" function, it was just dumb luck I stumbled upon it.

After importing the images, and setting them into my sprite class and initializing their hotspots, and imagepoints, I have to say, at this point I'm literally not writing any java code. I'll probably have to code some java again before the end, but as of now, I'm making this game in construct, and copy-pasting it to java. so like it or not, Ash, your tool is once again reaching beyond it's original boundaries. There are things that would have never been tweaked to their current level of perfection this early in the development process or even later for that matter, if construct didn't make it so fast and easy to mess up, and try again.

[quote="Davioware":d4q1ub3z]Wow, that's awesome lucid. Post a video of your game running on android, I want to see this.[/quote:d4q1ub3z]
I will definitely do so once it's further along. I'll post a side by side comparison, it's really neat to see the tiny exact replica responding to touch instead of mouse movements. Luckily, I designed this game as a mobile game meant to be enjoyed in short doses, so it's not one of my typical Towers of Babylon projects that are more suited to teams of thousands.

I predict a late summer release for the android version, and a simultaneous (thank you spellcheck) windows release if Steam will have me :)
Spriter Dev
B
96
S
21
G
12
Posts: 3,256
Reputation: 16,813

Post » Tue May 25, 2010 10:16 pm

Seems to me that just like I suggested in your thread about find and replace, you could also use Construct to make an app to set up your Java... that works like Construct.
Image ImageImage
B
164
S
49
G
138
Posts: 7,957
Reputation: 91,880

Post » Tue May 25, 2010 10:35 pm

[quote="newt":w4000otu]Seems to me that just like I suggested in your thread about find and replace, you could also use Construct to make an app to set up your Java... that works like Construct.[/quote:w4000otu]
definitely, but looking back at the infinite wake of my unfinished projects, if I've learned anything, it's that unless it's your fulltime job, or you don't have one, working on an editor instead of a game should only be done if absolutely necessary, at least that's the case for me
Spriter Dev
B
96
S
21
G
12
Posts: 3,256
Reputation: 16,813


Return to Open Topic

Who is online

Users browsing this forum: Juancarlos, pranshu, The cowboy and 1 guest