Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit/AppGameKit Studio Showcase / ShapeUp By Baxslash Resurrected

Author
Message
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 13th Aug 2020 23:11 Edited at: 30th Oct 2020 01:30
UPDATE, PLEASE READ FIRST:

For anyone that wants to use Baxslash's ShapeUp tool for polygon shape creation until these upgrade works are complete, you can download the working version of ShapeUp from this LINK. The link to Baxslash's original thread below will lead you to ShapeUp version that does not work in present AppGameKit as it has certain code incompatability and function with name in the ShapeUp tool that is in the present AppGameKit an official AppGameKit function with that same command name, hence the main problem. The edit mode is also fixed in this updated working version of ShapeUp.

PS There is still a minor imperfection in the edit of ShapeUp upon using zoom. Without zooming in, all will work well, with zoom, you will notice that the 1st point of the 1st shape will alter it's position upon editing of any of the points of any shape. I tried to remedy this, however to no avail, and as I have not got much free time at present, I cannot fix this at present. Forgive me.

ORIGINAL THREAD:

The original thread to the original author of this amazing tool can be found here:

https://forum.thegamecreators.com/thread/194938

On my journey of working on my personal project I was faced with a diffculty of the collision detection realm. Basically as part of my project, I need to create an entire interactive map that is divided to many regions and each region is of very different shapes and sizes. For this I will need to create ideally polygon shapes to be used for GetSpriteHitTest() function command. I started with creating a little program that will allow me to store the various points in a database and then once the shape was complete to WriteLine to a file, so that later I can just copy and paste the code from the txt file into the program without needing to type in the code for the polygon shapes. Whilst doing this, I encountered a problem that I could not understand until I discovered that the angles between 3 points cannot be greater than 180 degrees. I searched the forum for help on the subject and baxslash actaully created a very good tool for the job and he provided the source code that anyone can use in AppGameKit, so I did just that and started to add the principals of what I was doing into baxslashes code.

So far I managed to upgrade Baxslashes creation in that:

1) you can use the mouse wheel to zoom in and out

2) you can press the RMB to go back in points, which for my project is essential such flexability as the shapes I am dealing with are very not regular. Having such a function speeds up the work flow.

Further upgrades I want to add are:

1) Ability to input specific names for sprites and export of all data into a txt file with all the generated code, ready to use in AppGameKit or AppGameKit Studio.

2) Controls for the above to be able to export the data when all shapes for the given sprite with it's specific name are ready, then next sprite name can be input to repeat the entire process for as many sprites as one needs to generate polygon shape code.

In my case, we are talking about 47 Japanese prefectures of very various shapes and sizes, so a lot of different shapes to generate for a relatively precise interactive map by prefectures.

The original credit is to baxslash who provided such amazing code to play with. I am actually learning a lot from his code on how to use functions properly. I recommend you study his code for educational purposes and play around with it, it's pretty amazing what you can do with it.

Once, I have some proper upgraded version of Baxslash's program, I will post it here for anyone to use and modify and further upgrade to one's delight and make something even better.
????????
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 14th Aug 2020 02:05 Edited at: 14th Aug 2020 02:15
looking forward to seeing more on this where the notion is on my "to do" list. it would be helpful for any image map functionality found in hidden object games or a 2d level editor/mapper where simple boxes for tiles are not ideal, for example.

meanwhile, it's customary to post a screenshot or a vid of WIPs, much less Showcase items, if you could? personally, i'd like to see what you have "in action" where, like i said, i've had my own idea of how i'd go about it and wonder how others would.
[AGK Resource Directory] | [TGC @ GitHub]
[My Itch.io Home]
[CODE lang=AGK] Your Code Here [/CODE]
[VIDEO=youtube] VideoID [/VIDEO]
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 14th Aug 2020 14:20
Quote: " it would be helpful for any image map functionality found in hidden object games or a 2d level editor/mapper where simple boxes for tiles are not ideal, for example."


After looking at the link, it seems that the HTML image maps might also be good for the background images of the HTML5 builds since they can call JavaScript functions.

A little editing of the builds' page could make active menus etc. for those spaces outside of the game instead of just having them as a static background image.

I have been thinking about ways to make my backgrounds interactive and this seems to be a simple solution that I was overlooking.

I was just using them like a Marquee on an Arcade machine giving instructions and displaying logos, but this opens new door of opportunity.

Now, I just need to dust off the JavaScript books, and relearn something that I never used to really dress up the builds outside of AGK.

Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 14th Aug 2020 20:03
Good evening Virtual Nomad and Conjured Entertainment,

As for posting actual update on the tool, visually it is not any different from the original at present. I am also working full time and can only code in my free time, so please be patient with any future screenshots of video demonstrations. I will try to record a screen video this weekend of the present functionality of the undo point with RMB and the mouse wheel zoom function.

I am working on press wheel or middle mouse button to drag the screen, so as not to use the virtual joystick, however at present it is not working as I want it, so I also coded for the use of UP/DOWN/LEFT/RIGHT keys to be able to move the view and that works perfectly fine.

The more major part of the upgrade apart from the undo RMB is the actual database that will be used for storing each sprite and it's name and it's shapes with all it's points. The main code will then will be zeroed to collect data for the next sprite. Apart from that I will need to create code that will keep on displaying the already created sprite shapes, so that my boundaries between prefectures can be perfect in that certain shapes of sprite A will share the same points as certain shapes of sprite B. I reason a different colour code generated for each sprite shapes would be a good idea to be able to distinguish between the various shapes of different sprites.

Active menues, that is actually a topic crucial to my project and I reason also that Sprite shapes are a good solution to create interactive menues using one sprite as a collumn with the rows for the different sub menues as individual rectagular shapes of the sprite. Thank you for sharing that idea Conjured, as it was something I wasn't sure how to solve myself. With this polygon shape creation tool, the menues do not even need to be rectangular by nature, they could be all sort of crazy shapes and sizes.

In fact a menu system to access the various sprites and their shapes for editing would be a good idea for further upgrades, however first the priority is to create the entire system of database and code that will store and display the data for all sprites and their created shapes. I found the editing mode can be further improved as well, so that the point that is edited can be dynamically moved, meaning that you could visually see the changing angle between the 2 points that is adjusted with the 3rd middle point. At present you can select the point and click to adjust it to desired location, but when precision is required for the location of the lines themeselves, a visual dynamic preview would be ideally for this purpose, which I don't think should be too much a difficult task, knowing that the code Baxslash has provided us is really amazing!

I, myself, I am not a professional programmer, I am still learning from the masters themselves, like Baxslash in this example or Rick Vanner himself with his amazing tutorials, I still need to master his Ricktris code. As I progress on my AppGameKit programming discovery adventure, I will be more able to further upgrade this tool. For the initial period, I aim to accomplish the fundamental goals I need this tool to be able to do and then further implementations can be carried out, in fact, this could potentially become implemented in AppGameKit Studio itself, but that will depend on the schedule of the DarkBasic team and their priorities and I know they are very busy, so all in the right time.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 17th Aug 2020 00:18
OK, so here is a little update and the required footage of the current improvements:

https://drive.google.com/file/d/1CANIfoo0M9wxxCDlAa0yKQuJ2SMp7QCQ/view?usp=sharing

Just press play to watch it.

At present, the demonstration video presents:

1) scroll with keyboard up/down/left/right keys

2) Placing of points with LMB and undo of points with RMB

3) Input of Sprite ID name (later will be used to generate code required for AppGameKit Studio and for this the AppGameKit Scene input field is included also)

4) Storage of the individual shapes and it's respective points and total number of shapes into a database.

5) With the Save VirtualButton all the collected data in the databases is exported into a file.

At present, the exported data is raw with just the info of sprite number and name, number of shapes and coordinates for each point of each shape for each sprite, but later I will upgrade the code to generate the actual code that will be able to be copy and pasted into AppGameKit or AppGameKit Studio for use.

Also, with time I want to upgrade the code so as all the points of all shapes of all sprites will be interactive, because at present they are active only for the active sprite.

The scrolling function is not ideal, cause I cannot keep the EditBoxes with Texts static at all times, there is a slight movement during scrolling of screen, but for now it serves the purpose.

Have a good week.
Scribble
7
Years of Service
User Offline
Joined: 2nd Apr 2017
Location:
Posted: 17th Aug 2020 15:24 Edited at: 5th Nov 2021 12:31
Could you upload the videos to youtube or any video streaming website for easy viewing?
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 17th Aug 2020 20:57
Is it difficult to watch it via googledrive?

Is there any valid reason that you prefer it to be on Youtube?
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 17th Aug 2020 22:36 Edited at: 17th Aug 2020 23:29
Quote: "Is there any valid reason that you prefer it to be on Youtube?"

Then you could use the YouTube video tag and embed it in the thread...


Coding things my way since 1981 -- Currently using AppGameKit V2 Tier 1
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 18th Aug 2020 00:14
What a classic! I love Steve Ray Von!

In future posts I will upload it on youtube.

By the way, I managed it to generate the code already and after a little struggle, now it works perfectly fine in AppGameKit Studio, but it is a bit late to record the footage. I will update later.

Have a good night.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 18th Aug 2020 21:56 Edited at: 18th Aug 2020 22:34
Forgive me, in the end I need to share this via googledrive, as Youtube has these stupid Copyright laws, hence, I cannot publish the original, as though I was trying to make gold on people's creations, despite when we die none we take with us. What a pointless world.

Anyway the original post was:

Alright, so here is the Youtube (unfortunately NOT) update as requested by BITBITBIT and backed up by Conjured:

Instead here is your disliked googledrive upload, but atleast people can express themselves as they are without limits, here please:

https://drive.google.com/file/d/1D-QiZOh3LaZBJY_TCbNhWxxacrc8Vzz4/view

[NOTE: Download the original to view full resolution version. Next, time I will express myself less and publish it on Youtube for your convienience and quality without the hassle]

[NOTE 2: Seriously, Youtube was blocking this at first, but now I am able to view it without being logged in, but still the whole embedded code doesn't work due to Copyright, so here is the link anyway to the Youtube, so you can view in full resolution

https://www.youtube.com/embed/VHDMyGw2VH0

[NOTE 3: Forgive the hassle, the beer didn't help. I post all of it, in any case, one will work for sure]

I was able to solve the EditBox and Text movement issue in my previous version by the simple function FixText/EditBoxToScreen. You learn something new each day. That will be very useful for the rest of my project.

This version, allows the user to first input sprite name and then scene name for use in AppGameKit Studio, so you need to know your names first obviously.

Then you just create your shapes one by one and when you are ready to make the shapes for the next sprite, you just input the name of the next sprite and keep on going.

When all is ready, press Save and all the data is exported into a seperate txt file with all the code generated that can be copy and pasted into AppGameKit Studio to use, as demonstrated.

Further improvements to this are as described in the description video of youtube, but for the members of this forum, I will repeat:

1) I want all the points of all the shapes of each sprite to be interactive, because at the moment only the active sprite shapes points are interactive.

2) Store all the data to the data file, so that upon restart, they can be reloaded to continue works in the case required.

3) I aim to improve the edit function as at present it is not dynamic visually.

4) I don't know, but there will be a #4

Forgive me, I had too many beers tonight. Don't drink DAB from Dortmund, Deutschland, cause you might like it too much.

Have a good night/day.

PS I add music to these, as in the case I would have to watch this presentation without it, I would probably fall asleep in the middle of it, but to make these shapes themselves is enjoyable to be honest with you, to watch it being done, boring in my opinion.
Scribble
7
Years of Service
User Offline
Joined: 2nd Apr 2017
Location:
Posted: 18th Aug 2020 23:31 Edited at: 5th Nov 2021 12:32
Try to wrap only the
VHDMyGw2VH0
inside the TGC forum Youtube wrap.

Let's see...
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 19th Aug 2020 01:34
Thank you!
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 19th Aug 2020 03:23
how is the performance of the final result? IE, whatever you're using this shape-making project FOR where this has gone well beyond what Shape-up was meant to be and, perhaps, the realms of Box2D, as well, where "everything" is a polygon vs ANY benefit from actual box usage.

i ask because there may be an easier way (or 2). but, if the end result is what you're looking for, then please continue this, full steam ahead

with that, i did watch most of the initial video and believe i saw control points being added along, or adjacent to, edges from other shapes? my concern is "overlapping shapes" and some space on the map that isn't actually included in any shape, at all. then, where multiple shapes per sprite = true physics objects, again, my "performance" concerns above.

meanwhile, suffice to say, i'm following this with interest

[My Itch.io Home] | [AGK Resource Directory] | [TGC @ GitHub]
[CODE lang=AGK] Your Code Here [/CODE]
[VIDEO=youtube] VideoID [/VIDEO]
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 19th Aug 2020 05:15
I would be cool if you could use spritecshapechains as well
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 20th Aug 2020 07:14 Edited at: 20th Aug 2020 07:27
Hi Virtual Nomad and blink0k,

Quote: "how is the performance of the final result?"


I haven't got the final result ATM as I am at present focusing on improving this tool.

Quote: "IE, whatever you're using this shape-making project FOR where this has gone well beyond what Shape-up was meant to be and, perhaps, the realms of Box2D, as well, where "everything" is a polygon vs ANY benefit from actual box usage."


That's a very good point. I could implement a box making function, so that one could switch between making boxes or polygons. Also, a grid would be a good idea in the case box generation will be implemented as it will allow better visual judgement of where to place the points x1,y1 and x2,y2.

Quote: "i ask because there may be an easier way (or 2). but, if the end result is what you're looking for, then please continue this, full steam ahead"


Can you please share your ideas, I am very interested to know, as it may be a better solution.

Quote: "with that, i did watch most of the initial video and believe i saw control points being added along, or adjacent to, edges from other shapes? my concern is "overlapping shapes" and some space on the map that isn't actually included in any shape, at all. then, where multiple shapes per sprite = true physics objects, again, my "performance" concerns above."


First of all, this is just a presentation of the tools present capabilities, not actual shapes that I will be using for my project as I have still not decided on the type of map I will be using. I made the shapes as quickly as possible. The more one makes these polygon shapes, the better one gets at it, meaning the points at edges of other shapes are current imperfections of my lack of experience in making these shapes, only I knew I would place such a point on the edge, I could make it whilst making the previous shape to be used for the next shape. Not withstanding, a function could be created to not permit overlapping of shapes. Anyway, when I will be making the shapes required for my project for such a map, I will make them more accurate to cover all areas required, despite this is not going to be used for a geography software, so supreme accuracy is of no concern. This map will be used as a Japan map level for a Japanese Language Learning Tool RPG, where the player will be able to travel between various prefectures, each prefecture will have a city and travel will be permitted between cities only and each city will be a map in itself, the sort of Zelda style RPG. The more important cities will have a specific map, the rest a generic map. More on that in the future when I will be ready to post it here on a separate thread.

As for performance, I come from the DarkBASIC times, probably like yourself Virtual Nomad and I have not tested the performance of it nor do I know how the many polygon shapes impact performance in general, despite for my project, performance should not be an issue, as the central part of the final project will be a tool to help learn Japanese with an entire interactive interface with all dialogues interactive, so that one can access any information from the main database that one does not know at any moment in order to accelerate the process of learning the language.

Quote: "I would be cool if you could use spritecshapechains as well"


I wondered about that, can you teach me about the spriteshapechains, please?

Also, the other updates to this tool, an important aspect of it, is to allow better precision at higher magnifications, cause at present the circle the is displayed for the points does not reduce in size as one zooms in.

One other thing that I discovered whilst upgrading this tool is that AppGameKit does not have a function command that would allow to identify the shape number, such as for example GetSpriteShapeIdHitTest(spriteID, shapeID, x, y) or GetSpriteShapeId(SpriteID). If such a function existed, one could use one sprite with many different shapes to be used for programme logic, such as one that could be easily implement into making interactive menues.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 20th Aug 2020 07:46 Edited at: 20th Aug 2020 07:47
Little Update for Virtual Nomad:

I looked into the performance of the many shapes in AppGameKit studio and the results are as follows:

So with everything setup the same, in scenario one, I would have one sprite as the main map and 3 x sprites as the sprites for each prefecture, Hokkaidou, Aomori and Iwate.

In scenario 1, I used the defeault generated sprite shape box by AppGameKit for each sprite, so in total 3 x sprite shapes in total and FPS was about 29.99985 FPS.

In scenario 2, I used the same sprites, except the 3 sprites of the 3 prefectures have in total 59 shapes and FPS was about 29.99985 FPS, so no difference in performance so far.

As for the same on mobile devices, that is a different matter, will need to do the same test on my phone. Will update later.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 20th Aug 2020 21:43
An update as to the performance on an android phone.

With 4 sprites, 3 of which with auto generated box shapes, the performance was in general at 29.999 FPS, however at times it would drop to 29.97 and even lower with a lot of input especially.

With 4 sprites, 3 of which with 59 various polygon shapes, the performance was very similar if not better averaging at about 29.999, with same falls as in previous scenario, however less dramatic and would last less longer, in other words the performance was overall better with the 59 polygon shapes.

The other difference between the two scenarios is the overall area of the shapes, for in the first scenario we have a quiet big rectangles x 3, in the second scenario the total area is much less, hence the premature conclusion, that the number of shapes of all sprites is of less importance to the performance of the code than the actual total area of all the shapes of all sprites. This just a premature conclusion, would require more testing to prove, like when the entire map is complete, that would be more better to see the actual difference between the two.

I have to work this Saturday, so might not have too much time to progress with the further implementations. Patience is a virtue.

Have a good night.
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 20th Aug 2020 22:45
Havent tested similar myself but i would test at sync rate 0 and note any drop vs, apparent, 30? Really, i thought u had a lot more shapes involved (ie, dozens per prefecture). Again, if it aint broke (ie, ur getting what u need), dont "fix" it.

One of the ideas i had for your main project (the map, anyway) was to have an image loaded (as a memblock) with each prefecture represted by a unique color then, wherever the pointer is, u could immediately find the pixel underneath and its color, then look up which prefecture the color represents.
[My Itch.io Home] | [#LowRezJamAGK2020]
[AGK Resource Directory] | [TGC @ GitHub]
[CODE lang=AGK] Your Code Here [/CODE] | [VIDEO=youtube] VideoID [/VIDEO]
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 20th Aug 2020 23:31 Edited at: 20th Aug 2020 23:39
Little update: My friend Jessika07 just told me of another solution to my collision problem, something I was thinking at first, however I did not find or understand which command function to use for the transparency of sprites to work this kind of collision thing. She implemented the 2D collision thing, the original thing I wanted to use for this map part of the project, but my lack of understanding of the AppGameKit commands led me on this path of polygon shape generation tool, and I am glad, cause without it, I would not even look for such a tool as ShapeUp, and thanks to Baxslash's tool I have learnt at last how to use functions to pass on data into the function and produce a meaningful result, something that I could not picture until Baxslash's code opened my eyes. So, I will continue with upgrading this tool, as it will be vary handy for the future, especially for the generation of the specific boundaries for houses where doors will not be transparent and will need to use these shapes for whatever other implementations required in my present main project and future projects. In the end, it will be available for anyone requiring such a tool for whatever purpose, so it serves the community and those that use AppGameKit to make wonderful things.

PS She is able to implement this in DarkBASIC, her preferred programming language ATM, I have not yet implemented her mechanics in AppGameKit, not sure how to make this work in AppGameKit at present.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 21st Aug 2020 00:51 Edited at: 21st Aug 2020 00:51
Thank you for the advice Virtual Nomad. I think your solution is what I was originally looking for. So 59 shapes that is in total for 3 sprites, meaning for 3 prefectures. In total there are 47 prefectures, meaning 47 sprites, so about 60 shapes per 3 sprite, 20/sprite*47=940 shapes in total, more or less. I think your memblock implementation is a much better solution. Not sure how to get the ink color to recognize, I understand that I would use CreateMemblockFromImage() function, correct? And then?
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 21st Aug 2020 07:57 Edited at: 21st Aug 2020 08:06
i don't want to continue steering this thread into something different so i've posted this one to explain the ColorMap idea referenced above. it takes a little work putting the map together but it seems a lot less than adding thousands of vertices (even tho you state you enjoy it ).
[My Itch.io Home] | [#LowRezJamAGK2020]
[AGK Resource Directory] | [TGC @ GitHub]
[CODE lang=AGK] Your Code Here [/CODE] | [VIDEO=youtube] VideoID [/VIDEO]
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 21st Aug 2020 10:04
Quote: "I wondered about that, can you teach me about the spriteshapechains, please?"


It's the same a regular spriteshape only you aren't limited by the number of points and you can have concave shapes
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 22nd Aug 2020 23:15 Edited at: 22nd Aug 2020 23:16
Virtual Nomad you are AMAZING!!!

Thank you sooo much!

That is awesome. Thank you very much for your help.

I hope both methods will benefit the people reading both threads, so they can become aware of the possibilities and then choose the most appropriate method.

I'm not sure I will be able to dwell on your code tonight, as I finished work about 9pm and just got back, so my body and mind are a bit tired. I will study it better tomorrow. Tonight I will make some progress with ShapeUp, though in the morning I already managed to make a small improvment. In the original version, when you would zoom in the point snap function would snap to a point around a circle of radius 10 pixels, regardless of the magnification. I managed to recode it, so that now, the actual visual circle and radius of recognition around a point is scaled inversly proportional, meaning if magnification is 2x, then radius is rad/2 and it works. Before I couldn't make it to work, as the logic didn't make sense and I was addressing the problem in the wrong way. That is quiet important, as it allows for higher precision, in the case such is required. Also, I was studying Baxslash's code on how to implement this 3 dminesional array to store all data and make all points interactive and I can see it be done, but it will be like a major change to the code, I mean the fundamental structure of the functions will remain, they will only be expanded and each part needs to be expanded, so that it all works. It will be like taking a system apart and installing a new one and hoping it will all work. I still need to familiarize myself with the code better, but slowly I am able to capture what does what. In the final version of it, there will be an option between export to AppGameKit studio with Scene name or just sprite name or sprite id# (1,2,3 etc), depending on the needs of the user. Also, one file will have the code generated ready to copy and paste into AppGameKit or AppGameKit Studio, another file will use Baxslash's method to store the raw data of the sprite, shape and points, that can later be read using the ReadLine command and data inserted into the AddSpriteShapePolygon command etc. I learned this from Baxslash's, didn't know how to do that myself, and I think his method is a good one, like this if I would use the polygon shape method for prefecture recognistion it would save 5000 lines of code in the actual program and the program would rely on reading a txt file for the data. Not sure, which one is better performance wise, or in whatever respect, whether the data is on a txt file or in the code, does it make any significant difference? Anyone, can comment on that?

blink0k

Thank you, so what is the point of the of the Polygon Shapes, when Shape Chains have not such limits?
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 23rd Aug 2020 00:18 Edited at: 23rd Aug 2020 00:42
Quote: "what is the point of the of the Polygon Shapes"

polygons are filled/solid, chains are hollow and don't have to be "closed". IE, chains are just a bunch of connected lines/edges.

ie, you couldn't use chains for your map project where the chains would simply represent borders or outlines of the prefecture (which would be shared with adjacent prefectures, or, overlapping).

see more on shapes, in general @ the Box2D site HERE
Quote: "
Virtual Nomad you are AMAZING!!!"

heh. thanks, but not so much. you're just easily impressed right now as you're early in the language
[My Itch.io Home] | [#LowRezJamAGK2020]
[AGK Resource Directory] | [TGC @ GitHub]
[CODE lang=AGK] Your Code Here [/CODE] | [VIDEO=youtube] VideoID [/VIDEO]
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 23rd Aug 2020 21:51
I meant, you are AMAZING to help me!

Thank you!

For me all code is impressive, as long as it is logical and works.

As for the chain shapes, for the map it's not the best application.

Thank you for the link.

Have a good day/night.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 24th Aug 2020 21:28
A little update. I was able to get rid of the entire database system (except for the database that codes for sprite name, scene name and shapes total) and replaced it with a 3 dimensional array system that codes for the sprites, shapes and points. At first the change produced tragic results, as this was due to me copy and pasting from the function dealing with the x to the function dealing with the y and forgot to modify x to y in the y function. Now, it works fine, just need to make it 3 dimensional for the interactive point part. I could have done it as I was changing it, however if I faced some problems afterwards, like I did, then it would be a right mess with the extra for next to solve it, so I just wanted to see how the system works in the basic one sprite mode. Now, that it works, I can implement the interactive 3rd dimension. I will be doing overtime this week, so not sure when I will be able to do that this week and I also need to work on exporting one of the demos of one part of the project to Macintosh computers, something I have never done before.

Have a good night/day.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 27th Aug 2020 01:40 Edited at: 27th Aug 2020 01:42
UPDATE:

I have really good news as for this tool. I began to attempt to make all points interactive, meaning for anyone familiar with the tool, when you are creating the shapes one by one, all points are interactive, however when you want to code shapes to individual sprites, that is where the 3rd dimension has come into this tool and the moment you input 2nd sprite, all points of existing sprite shapes are non-interactive, because the tool has been designed as a polygon shape creation tool for one sprite only. I began to attempt to make them interactive and as usual I was faced with problems and when one is faced with a code problem one could be mistaken that the logic is incorrect when in fact it could be the variable used with the same id. I really thought I made a right mess of things, only to realise that I had a 3 dimensional for...next loop, where the first for was for i and the 3rd for was for i also, hence the problem. I write this as educational material for anyone who has not yet made that obvious mistake before, but it could save you a lot of time trying to fix a code that can be all good except one variable name double booked in the same loop sequence or something of a similar nature. Once I fixed that issue, everything works fine now and all points are interactive for all sprite ids. I will need to test this more and make sure everything is working well.

The final upgrade to this is the actual export, so that each time one can load the previously created sprite shapes with all the data and the actual generation of the file with the raw data and a file with the actual code, one for AppGameKit Classic with just sprite name or ID# and one for AppGameKit Studio with Scene name added to the sprite identification for the code generation string.

Have a good day/night.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 30th Aug 2020 02:24


I wanted to demonstrate the further implementations of the upgrading process. The demonstration video shows that all points now are interactive for all sprite IDs, as before they were interactive only for the active sprite. Also, the export feature, I managed to make it work properly now, so that it writes the data correctly and upon restart of the tool it loads the previously exported shapes for all sprites with all the data back in the respective arrays or database for sprite name and shapes total for each sprite. The only thing at the moment is that for some reason upon restart of the tool the exported shapes load correctly, however the points are no longer interactive. Also there is an issue with the zoom function as it messes up with the shape creation, sometimes the shapes do not want to create. It's kinda strange, cause after using the zoom function sometimes they would create and sometimes not.

On further progress updates I will seek to resolve both issues with the non interaction of the points for exported shapes upon reload and the zoom function. Also, I will want to expand the actual tools of the tool to be able to switch between Polygon/Box/Chain creatoin method as requested by some people. Not sure how long it will take to implement the later.

Have a good night/day.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 30th Aug 2020 22:21
Little UPDATE:

I was able to resolve the two issues with the points not being interactive upon restart of the application and reload of the shapes from the file, plus the zoom problem. For the points interaction the problem was that I was using one database type for the shapes number in the codes main for loops, but for export I would use another for the total number of shapes, hence all that was required is to pass on the total from the shapestotal database to the shapes database, for the points to be interactice again. As for the zoom problem, it had to do with using a float variable instead of an integer, I changed it and no problem with the zoom feature.

I began attempts on implementing the AddSpriteShapeBox to the program. I began to create it in a separate project, just to create the entire infrastructure, cause it works different from the polygon code with how the points are used to get the interactive box shape and then the shape. Took a little bit of time to figure some things out with displaying the dynamic lines correctly for the box shape, but I have managed to make it work properly with points interactive (in the original ShapeUp I wasn't sure which part was responsible for the points interaction, now I know). The next step is to copy and paste the code to the original project and create two virtual buttons, one for PolygonShape, another for BoxShape creation tool, so that the user can toggle between one and another.

As for the Chain creation mode, that can use the same principle code as the one for the polygon creation, however without all the limitations of creating polygon shapes and with a greatly extended point limitation. After successful implementation of the box code in the main programme, I will begin to implement the chain creation feature in a separate programme, like I did with the box code.

Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 1st Sep 2020 00:05 Edited at: 1st Sep 2020 00:15
UPDATE:

I was able to implement the Box editing feature into the original code and then to be able to export it, for which I had to create another array for storing the method for creating each shape, as the mechanics for creating polygon shapes and box shapes are very different where the export for box shapes involves only 2 points, despite 4 points are required for interaction, unlike polygon shapes that can use a for next loop for the points, hence the need for the differentiation between the two when exporting. Overall, one can now create various combination of shapes, box or polygon and upon export, each will be written unto the file according to the method it was created, so that upon reload it can be read correctly into the array and database to be displayed correctly with all points interactive to continue work from where one left off.

I haven't had time to attempt to implement the chain method at present and as I will be working all week in the day as standard and doing overtime each evening, so not sure I will have much time to progress with that implementation this week, but knowing myself I do tend to drift off into late hours, so who knows.

As for the box feature, whilst testing it, I can understand it being beneficial for creating specific square or rectangle shapes where required, however for maps this is not useful at all. Polygon shapes are much better suited for very ackward shapes and much more efficient to fill the area with less shapes and you can place points in places where later these points can be used for other shapes, which is essential for making sure there is no overlap between shapes. Box shapes are not really suitable for that in practice, after having tested it on the map of Nihon. Still the box feature is a really good feature where precise 90 degress angles are involved to create square/rectangle type shapes, something that would be difficult to implement whilst using the polygon shape creation method, meaning to get 90 degree angles each time. Both methods will be available, so that the most suitable tool method can be used to get the job done most efficiently and precisely.

Have a good night.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 3rd Sep 2020 23:29
UPDATE:

I have managed to implement the chain creation feature with a present limit of 77 points, don't know what is the AppGameKit limit for the chain points. The chain feature works without the limitations of polygon shapes and I have chose SPACE BAR as method of completion of shape, or when point limit has been reached or when starting point = final point, however at present I had problems with that last one, so I just remed it out. The export at present doesn't work for chain shapes.

With all these major changes to the entire tool, I had completely missed out the entire edit and delete features, which now don't work at all. Trying to edit points at present yields terrible results and no wonder as having both polygon shapes and box shapes will not be compatible with the present edit mode. Not sure how I will solve that one, especially that both box and polygon shapes can share the same points. I reason editing will need to be shape specific, meaning one will need to choose the shape before editing it's points, unlike previously one could edit any point of any shape. All in all, I am not sure how to tackle this edit problem, but I will do my best to make it work.

At present there are vritual buttons for POLY, BOX, CHAIN modes.

Further works will include sorting out the export for chain shapes, fixing the edit and delete modes.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 5th Sep 2020 03:12 Edited at: 5th Sep 2020 03:16
UPDATE:

I have been working on fixing the edit feature and at the moment it is a right mess, however I was able to understand the code for it better and the fundamental sprite creation.

Basically, in the original tool there was only one sprite for the lot.

To make this edit function work according to sprite number/ID, I had to change this to use an integer in the database to CreateSprite.

Before it was:



Now it is:



The 0 value for the database is used just for the base image. The actual sprites created for the spriteIDs go according to spriteID#, from 1 and above. Now, upon loading the entire code that was used for the initial loading of the data and creating the sprite has been substitued with a database[spriteID].spriteinteger = CreateSprite(1), which is also used when creating the sprite shapes originally.

Playing with this Baxslash's code has been some really good learning adventure/nightmare, cause at the moment the edit feature does not work at all due to the changes I have made to the entire sprite creation method, but really for anyone learning AppGameKit, I highly recommend to pick a tool someone else made for AppGameKit and work on improving it. You will learn so much in the process. I don't think I could have chosen better, however it was my personal need for such a tool that led me to Baxslash's tool, it worked out the perfect educational code playground. Thank you Baxslash, to me you are a master!

To be honest to reason one is a master can be an obstacle at times to improving the tool as one reasons the code is perfect, however to implement the database sprite creation tool, there are parts of the code I could just get rid off, which at first I thought the entire lot had to be there only to realize there is no need for it with the new system in place. The entire process adventure/nightmare or whatever one would want to call it, has been a really great learning process overall.

One little note about the Box creation feature, I reason to make it more compatible with the Edit feature, I will need to reprogramme the Box tool to use CreateSpriteShapePolygon rather than CreateSpriteShapeBox, simply because to make it work in the edit will be problematic, cause to set teh box shape, one only needs two points, hence the code used to generate operates on 2 points only, despite in the array there are 4 points, however only 2 are controlable and depending on how you created the box, meaning you could create it in 4 different directions, going towards right top corner, right bottom corner, left bottom corner, left top corner, will determine which points are controlable to modify the shape. To make such work with all points controlable, will be work for someone else to upgrade if they wish so.

For simplicity sake and functionalibility I will seek to make the box feature work as though it is a Box Shape creation command, but using the polygon shape creation command, so that upon edit mode, one can modify the points without problems of screwing up the box shapes, though editing of a point of a box shape would lead to loss of the 90 degree angle. That's the plan anyway, whether the original box shape creation will be kept or the more compatible polygon shape creation for boxes will be implemented will depend on how the process will unfold and whether I will find ways to solve it alternative ways.

Have a good night/day.
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 5th Sep 2020 20:58
UPDATE:

I have good news. I was able to sort out the edit feature without having to change the CreateShapeBox method. The problem was that the edit feature used a separate function to export temporary sprites, however with the new array and database system in place, I can just get rid of the temporary sprite export and just use the main export function and LoadSprite function to reload the sprite shape data with the new changes in place. Part of the problem for screwing up the shapes was that in the code the program was searching for a file with an extension that was no longer in use, however towards completion of the works on the upgrading of this tool, I will probably need to make that work with the file being created in the invisible AppGameKit AppData directory. For the time being I am just exporting the data to a file in a specific folder inside the media folder just to have clear access to the data.

Now the edit works perfectly fine with box and polygon shapes, I just need to work on the chain shape export for that to work also. The other thing, I need to make the box shape points be reloaded back into the array after editing of box shape points, cause at present the box shapes modifies correctly, but the two other points that do not control the box shape are not loaded back into the array with new location data. Also I will seek to make the interactive points of the box shape stand out, so that one does not need to click to see whether the point can modify the box shape. It is actually really nice, how the shapes are edited now, with dynamic point and line changes, so one can actually visually see where the lines will end up being placed.

I also put in place 2 x edit boxes for SpriteOffset X and Y data input, so that the user can decide on the sprite offset. At present I am using 0,0 for both x and y axis, however if one would want to use the defeault offset for sprites, then the code will need to be compatible with that, so will need to experiment with that and make it work for whatever the offset.
????????
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 6th Sep 2020 19:49
UPDATE:

After having got the edit mode working pretty OK, I began to make some major changes to how the edit mode functions and the result was a tragedy that led me to literally go a fraction from insanity. The entire thing screwed up big time and I seriously didn't know where the problem was, so in the end I was trying to solve the problem in the wrong way and places that only made things worst. I spent the entire Friday night until 6 in the morning battling this nightmare and then again Saturday night until I cannot even remember, my brain is fried. All in all, I knew I had to leave the problem and let my head cool down before reattempting to solve it and as was a case before where I would spend all night battling a relatively simple logic, I could not solve it, went to sleep, the next morning woke up and solved in less than half an hour. Same happened with this little nightmare, where in the end the problem was one little line of code in the wrong place, and I spend hours editting and amending tens of lines of code trying to solve the problem. I reason these experiences make a person grow in programming, though in the midst of it, it is even for the most patient, a difficult battle.

Now, that the problem is figured out I was able to focus on the actual new system for the edit feature. This new system, at first I reasoned was the problem for the major problem, but it was that one line of code. Now the new system works pretty well with both polygon and box shapes and the AddSpriteShapeBox works fine as well, though the box shape can only be modified with the 2 points that create it and in the edit mode when one goes over with the cursor on either of these two points the circle becomes filled with green to indicate it is controllable, the other points are interactive just visually in the edit mode and can be used as points for new shapes in drawing mode.

Also, the new array system for the edit mode, I had problems with it trying to modify several points of different shapes that share the same points led to breed some strange effects. This is where the Print() command for debugging purposes proved to address where the problem was and it was in the fact that each time a point was modified the data for the point was collected and passed unto the array of the edit mode, but upon several points being collected the data for the other points was still present and intefered with the editing, so I had to create a separate function to deal with the resetting of the edit mode array system to zero everything before collecting new data for the next point to be modified. Works really nice now, no problems so far.

Still need to implement the chain shapes to export, but as I was busy with this little nightmare, I had no time to deal with it. Also the delete feature is pretty screwed up at the moment also, so that will need to be fixed, probably using arrays again. It seems I have nearly changed the entire system to use the array system, so the old system is nearly nonexistent. This array system proves to be much more efficient and better way to handle the data overall, as an example:

Former functions for handling the edit mode for collecting the data for the points being edited, note that it uses a dp=dp+1 to keep track of the different points being collected as one point could be shared by 4 shapes or more, so the dp=dp+1 updates for each point:



Present array system:



I kept the dp=dp+1 for it was also used to keep track of the total number of points being editted, not that it serves any purpose any longer in the logic of collecting the point data for each shape.

This above code plays the role of making the shapes be modified dynamically with dropping the points constantly to where the cursor is followed by the redrawshapes() function to update the shape geometry in real time. It looks really nice.

There is one fundamental problem with the edit feature, it allows to modify polygon shapes even when the rules for creating them are borken. This lead to shapes being created that should not be and hence the GetSpriteHitTest() function doesn't work properly anymore with such incorrect polygon shapes. Not sure whether I will go into updating this to obey the polygon shape laws, Baxslash never included such logic for the edit mode, so I guess might be wise to avoid such potential nightmare of trying to implement that. In the case it will not be updated to that extent, one will need to be mindful when editing points of polygon shapes to keep the shapes concave.

Have a good night/day.
????????
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 8th Sep 2020 22:06 Edited at: 8th Sep 2020 22:35
UPDATE:

I decided to make the Box edit mode be controlable by all 4 points, I have gone that far with upgrading it, might as well make all the points of the box shapes controllable, though at present it is kinda working and not, so I need to investigate more to make it work properly. Virtual Nomad suggested this feature, and he has been super helpful to me and probably to many of you, so I really want this feature to work with all points conrtolable. Other than that it is really good to learn from, as it makes everything more complicated, so good playground to improve oneself.

Have a good evening/night.
????????
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 8th Sep 2020 23:40
One very handy feature would be if you clicked on a line between two points it would insert a point at that position
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 9th Sep 2020 01:01
Yes blibk0k, I was reasoning to get that implemented also, but I would leave that more towards the final stages to implement, cause that would be another level to make that work. It would be an interesting challenge.
????????
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 9th Sep 2020 08:38
This will return the distance between a point and a line. It will also return the point on the line which is closest to the point that is passed
pt = point to check
p1 - p2 = line

use x = .x and y = .z

Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 9th Sep 2020 21:20
Thank you. I need to digest this.
????????
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 9th Sep 2020 22:41 Edited at: 9th Sep 2020 22:55
To be honest with you with 3 points, pt, p1 and p2 we are dealing with a triangle and cause we know what each of the point is, we know both the distance between p1-p2 and we can calculate the distance between pt-p1 and pt-p2. Knowing the distance of 3 sides of whatever triangle we can use the formula cos(alpha) = b^2+c^2-a^2/2bc to calculate one of the angles between p1-p2-pt or p2-p1-pt. Once we can calculate that angle we can find the shared height of our 2 x right angle triangles that make up the triangle p1-p2-pt using sin(alpha) = opposite/hypotenuse equation to find out the opposite (height). Knowing that height we can use trigonometry to work out the the distance a for each of the right angle triangles on that line p1-p2 to know where the point needs to go, then we can calculate the dx_new and dy_new of that smaller triangle by calculating the factor using dz_new/dz (dz being the distance between p1-p2). Then that factor can be applied to the dx and dy to calculate the dx_new and dy_new to work out the location of the point on that line p1-p2 which would be an offset from either p1 or p2 by dx_new and dy_new +/- depending on the angle of the line as to x and y of p1/p2, meaning if ptx<p1x then dx_new would be subtracted from p1x, reverse if it was vice versa, same for the y.

I see how you have used the z as the y, meaning this is the 3D logic of AppGameKit and thank you for that intro, but at the moment I am far from the 3D realm of AppGameKit, though as Jessika my friend educated me, you can apply principles of 3D to help with the 2D stuff which is awesome.

As for your version of dealing with this problem, at present it is way beyond my ability to comprehend. In the case you are able to explain to me, so I can understand fully the logic of it, I would love to understand it completely. What I do not understand from your code example is this equation

t = ((pt.x - p1.x) * dx + (pt.z - p1.z) * dz) / (dx * dx + dz * dz)

The function appears very efficient, however it is beynod for me to understand that equation to be able to apply it, so I understand what is going on.

Also, the height of the 2 x rightangle triangles that make up the triangle p1-p2-pt can be used as the minimum height required to insert a point. So, basically Baxslash used the radius of a point to identify a point, meaning, if pointer x and y is within radius = 10 of any point, then you can only insert a point to that point. Same principle can be used with this height that can be utilised in the same way, so that if height <= 10 then insert point to that location, else you cannot. It is an important feature to be able to insert new points near a line and not anywhere.

Building upon Baxslash's creation, he uses relatively simple to understand mathematics, despite at present, I don't understand how his angle calculations works as I did not focus to understand them.

Blink0k if you can explain to me that equation, so I can understand it better, that would be awesome!
????????
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 10th Sep 2020 11:48 Edited at: 10th Sep 2020 11:48
I have no idea how it works.
I just plug in my numbers and i get the numbers i want
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 11th Sep 2020 02:53
Thank you blink0k for the function anyway. Personally, I need to understand how something works first before using it.

Also, I was busy implementing the edit feature for boxes to be able to control the box with 4 points and I struggled to make it work. So often it happens to me that the logic is good, but some stupid mistake of mine creates havoc. This time it was inconsistence of using the for next loops, meaning in some places I would use j for sprite i for shape and k for point, in other cases s would be the shape and sometimes the sprite and shape letter id in the for next loop would be reversed. I would copy and paste the code with one version from one place to another, not realizing that the location had a different letter ids in the for next loops sequence. I was wandering "Why is it always zero???". That was cause I kept exporting it to an array that was had no value other than zero. This shows me, that I need to fix the code for this lettering system so that it is unison everywhere to avoid further head banging.

After all this, I can say the edit feature for boxes works perfectly well now, controlable by all 4 points.

Now, I will need to focus on the export for chain shapes and attempt to implement that point insertion feature, which with the triangle principle, I can see how this can work.

Have a good night.
????????
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 11th Sep 2020 21:25
Nice one, thank you.
????????
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 14th Sep 2020 03:12 Edited at: 14th Sep 2020 03:13
OK, so I have made a little video demonstration for the edit mode to show box shapes are controlable by all 4 points and to demonstrate that the function that calculates the location for the insertion of the new point along a side of a polygon works, however at present there are anomalies that need to be fixed. There are lines that are drawn sometimes that are not supposed to be drawn. This is just to show that the fundamental calculation works fine, I just need to fix these issues and later implement the logic for actual insertion of the point and resorting of the points.



Have a good night.
????????
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 14th Sep 2020 21:11
UPDATE:

So I was able to sort out the strange extra lines anomalies and replaced the line draw function with the draw circle function that was made by Baxslash originally. I will modify the actual image of the circle for the edit mode, so that the circle has a cross hair allowing more precision to place the point where it needs to be. Also the zoom function and movement of image function in x and y axis does not work well with the funciton that calculates the location of this new point. I need to fix this. The other implementation is the actual dropping of the new point to the line and updating the point database for the given shape. As you can see in the demo, sometimes more than one circle will appear (other than the already interactive point), this is due to the magnification, as the lines can be so close that up to 3 lines can cover be covered with that minimum height required to place a point, height meaning the distance from the pointer to the side of the shape at 90 degress angle. With higher maginification this problem can be eliminated to allow to place the point more precisely where it needs to go. I reason the magnification ought to solve the problem. I could make the height minimum less than what it is at present, but the current value being 10 pixels reflects the radius around the point to make it interactive and it allows less care to be really close to the line in order to place a point. In the case the height was 1 pixel max, that would eliminate that problem, however then the user would need to really pin point +/- 1 pixel from the line to be able to place the point. That would not be user friendly and slow down the work flow of adding new points.



Have a good night.
????????
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 17th Sep 2020 22:25
UPDATE:

I was able to solve the various previous issues and managed somehow to implement the adding of the points to the polygon shapes with a limit of 11 points with 12th being equal to the 1st point to complete the polygon shape, that is in the case one would want to add the maximum number of points. Once the limit has been reached, no more points can be added to that shape which is demonstrated towards the end of the video.

At present one has to mindful of visually keeping the polygon shapes concave whilst adding points, as there is no logic to stop the user from dropping a newly added point in a location that will make the shape convex. I reason it would benefit to implement the logic to prevent the user from doing such by utilizing similar logic that Baxslash used for preventing to create convex shapes when creating the shapes themselves.

A delete point function is also a possible implementation, which I reason ought to be easier to implement than adding new points to the shape.



Have a good night.
????????
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 17th Sep 2020 22:57
Shape chains support concave shapes
Quote: "Chains are rigid and can be used to create hollow concave polygons, or 2D terrains."
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 17th Sep 2020 23:17
Thank you Blink0k. The limitations in the case implemented will concern polygon shapes only. Chain shapes will not have such limitations. I have been focusing on these various implementations mainly for polygon and box shapes, because once implemented to these, then to apply the same to chain shapes will be fairly easy, simply because the chain shapes are very flexible in how points are created and the total number of points. I don't even know the limit for maximum number of points for chain shapes, is it maximum memory?
????????
Lupo4mica37
4
Years of Service
User Offline
Joined: 1st Jun 2020
Location:
Posted: 19th Sep 2020 19:45
UPDATE:

So I had this idea for some time already whilst working on this to create a sort of Start Screen that will display a list of all the image files in the "input" folder (the folder where you place your image files to be edited) that the user requires to create the sprite shapes for. I have so far created this screen with a list of images in the folder and an edit box for input, so that the user can choose which image to work on. I also added an Restart button to go back to this screen to choose a different image.

At the moment, the user can change the images to work on, however as the sprite shapes data is exported to a single file, the same data for the sprite shapes is reloaded, regardless of the image. To implement the code being generated for each image separately, I will need to go back to Baxslash's original code that would generate a specific shp data file for each image separately. I was going to do that anyway, as exporting the data to one file in a specific folder was only for the purpose of the works on the various mechanics to do with the shapes and the points, just for simplicity and ease of access to not get confused with which file to look for the data as the shp files have names given according to the image file name without the suffix. Until now I used a txt file named "rawcode" placed in a folder within the media folder, so I know whatever changes are done to the sprite shapes is gonna be in that file.

So the plan is to reload data according to the image used. To add thumbnails to this list is also my intention so that the user can visually see what each image filename actually represents visually. Also, a browser for file to work on would be an interesting feature, so that the user can choose an image file in whatever directory on the computer.

Blink0k, if you know of the commands that allow to access the explorer to search for files, would be helpful.
????????

Login to post a reply

Server time is: 2024-11-08 23:49:08
Your offset time is: 2024-11-08 23:49:08